Universidade Federal de Alagoas Instituto de Computação

Trabalho Prático AB2

Disciplina: Sistemas Distribuídos

Semestre letivo: 2016.1

Professor: André Lage Freitas

Especificação

Importante. Leia atentamente essa seção pois só serão aceitos trabalhos que obedecerem as a especificações a seguir.

Baseado(a) no exemplo a seguir de implementação do B-multicast em Julia, façam os exercícios descritos nesse documento.


In [12]:
function B_multicast(g,m,B_deliver)
    for p in g
        remotecall(p, B_deliver, m)
    end
end

# Adding 3 processes (workers)
#addprocs(3)

# My group is composed by all workers
g = workers()

# Multicasting "oi!" message to group `g` by assuming `println` as B_deliver function.
B_multicast(g,"oi!",println)


oi!

Exercício 1: Sincronismo (2,0 pontos)

Adicione 10 processos com o comando addprocs abaixo.

Atenção: sua instalação local de Julia pode não conseguir adicionar 10 processos, use a JuliaBox.


In [26]:
# Implementation of the asynchronous B-multicast.
function B_multicastAsync(g,m,B_deliver)
    for p in g
        remotecall(p, B_deliver, m)
    end
end

# Remove all existing processes
rmprocs(workers())

# Add 10 processes (workers)
addprocs(10)

# My group is composed by all workers
g = workers()

# Multicasting "oi!" message to group `g` by assuming `println` as B_deliver function.
B_multicastAsync(g,"oi!",println)


	From worker 131:	oi!
	From worker 127:	oi!
	From worker 124:	oi!
	From worker 125:	oi!
	From worker 123:	oi!
	From worker 126:	oi!
	From worker 130:	oi!
	From worker 122:	oi!
	From worker 128:	oi!
	From worker 129:	oi!

Modifique a implementação do B-multicast para utilizar communicação síncrona.


In [24]:
# Implementation of the synchronous B-multicast.
function B_multicastSync(g,m,B_deliver)
    for p in g
        remotecall_wait(p, B_deliver, m)
    end
end

# Remove all existing processes
for i in workers()
    rmprocs(i)
end

# Add 10 processes (workers)
addprocs(10)

# My group is composed by all workers
g = workers()

# Multicasting "oi!" message to group `g` by assuming `println` as B_deliver function.
B_multicastSync(g,"oi!",println)


	From worker 112:	oi!
	From worker 113:	oi!
	From worker 114:	oi!
	From worker 115:	oi!
	From worker 116:	oi!
	From worker 117:	oi!
	From worker 118:	oi!
	From worker 119:	oi!
	From worker 120:	oi!
	From worker 121:	oi!

Execute as duas versões do B-multicast (síncrona e assíncrona) e compare as saídas.

A ordem das mensagens das saídas foram as mesmas para ambas versões do B-multicast? Por quê?

Resposta: Não foram as mesmas. A primeira versão (assíncrona) retornou as mensagens em ordens aleatórias para cada execução feita. Já a segunda versão (síncrona), retornou para cada execução a mesma sequência de mensagens ordenada pela ordem de emissão da mensagem. Isso se deve ao fato de que após uma chamada remota síncrona a próxima chamada só será executada após o termino da chamada corrente. Já no B-multicast assíncrono todas as chamadas remotas são executas na saquência independentemente do retorno de uma outra chamada retorna e a mensagem é mostrada conforme ela é retornada.

Exercício 2: Análise de desempenho do B-multicast (2,0 pontos)

Meça o tempo de execução duas versões do B-multicast (síncrona e assíncrona). Dica: utilize a macro @time.

  • Execute 50 vezes essa medição e construa um gráfico em forma de barras:
    • cada barra representando cada versão do B-multicast;
    • calcule e coloque no gráfico o intervalo de confiança com nível de 95%.

In [54]:
function B_multicastAsync(g,m,B_deliver)
    for p in g
        remotecall(p, B_deliver, m)
    end
end

function B_multicastSync(g,m,B_deliver)
    for p in g
        remotecall_wait(p, B_deliver, m)
    end
end

# Remove all existing processes
for i in workers()
    rmprocs(i)
end

# Add 10 processes (workers)
addprocs(10)

# My group is composed by all workers
g = workers()

times = Array(Any, 50)

for i = 1:50
    times[i] = @elapsed B_multicastAsync(g,"oi!",println)
end

for i = 1:50
    print(times[i])
    print("\n")
end


	From worker 419:	oi!
	From worker 415:	oi!
	From worker 420:	oi!
	From worker 412:	oi!
	From worker 414:	oi!
	From worker 417:	oi!
	From worker 421:	oi!
	From worker 413:	oi!
	From worker 418:	oi!
	From worker 416:	oi!
0.003972481
0.000267819
0.00027937
0.0002815
0.000254429
0.000263762
0.000258352
0.00028436
0.000256199
0.00026636
0.000259677
0.000262339
0.00025599
0.000278149
0.000252685
0.000258775
0.000270075
0.034623275
0.000245352
0.000248491
0.000241128
0.000243585
0.000246744
0.000320037
0.000239917
0.000231932
0.000233587
0.000237236
0.000177958
0.000198386
0.000173564
0.000173374
0.000160036
0.000174465
0.000167987
0.000161711
0.00016183
0.02995212
0.000294181
0.00046214
0.000255809
0.000296582
0.000258546
0.000276425
0.000236738
0.00028138
0.000257235
0.000245229
0.00023978
0.000237117
	From worker 419:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 419:	
	From worker 419:	
	From worker 420:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 420:	
	From worker 419:	
	From worker 415:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 419:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 415:	
	From worker 414:	
	From worker 420:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 415:	
	From worker 414:	
	From worker 414:	
	From worker 414:	
	From worker 414:	
	From worker 414:	
	From worker 413:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 413:	
	From worker 418:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 413:	
	From worker 418:	
	From worker 413:	
	From worker 418:	
	From worker 413:	
	From worker 418:	
	From worker 418:	
	From worker 418:	
	From worker 418:	
	From worker 418:	
	From worker 418:	
	From worker 416:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 418:	
	From worker 416:	
	From worker 412:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 418:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 416:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 412:	
	From worker 417:	
	From worker 417:	
	From worker 417:	
	From worker 417:	
	From worker 417:	
	From worker 417:	
	From worker 417:	
	From worker 417:	
	From worker 421:	oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!oi!
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	
	From worker 421:	

Após executar 50 vezes o B-multicast síncrono e assíncrono foi gerado um arquivo ".csv" que foi utilizado no ambiente R para a geração de alguns dados importantes que segue logo a baixo:

Síncrono Assíncrono
Min. :0.001607 Min. :0.0005104
1st Qu.:0.001690 1st Qu.:0.0005534
Median :0.001757 Median :0.0005762
Mean :0.001942 Mean :0.0016471
3rd Qu.:0.001930 3rd Qu.:0.0006123
Max. :0.007594 Max. :0.0253185

Gráfico:

Observação: Os dados usádos e o código em R usados para gerar esse gráfico podem ser encontrados em: https://github.com/danielsanfr/universitys-homeworks/tree/master/distributed-systems

  • Qual das duas versões teve o menor tempo de execução? Por quê?

Resposta: Como é possível notar no gráfico a cima, a versão assíncrona tem menor tempo de execução em média, porém seu intervalo de confiança é muito grande em comparação ao da versão síncrona, logo, levando em consideração os intervalos de confiança é sensato afirmar que a versão sincrona tem o menor tempo de execução!

Isso se deve ao fato da versão assíncrona ter que se preocupar com o gerenciamento do recebimento e envio das mensagens assíncronas, o que não ocorre na versão síncrona, que para situações mais simples e de pouca transferência de dados acaba sendo mais eficiente.

Exercício 3: Análise de desempenho do R-multicast (3,0 pontos)

Implemente duas versões do algoritmo R-multicast: uma assíncrona e outra síncrona.

  • R-multicast síncrono

In [17]:
# Implementation of the synchronous R-multicast.

function R_multicastSync(g, m, B_deliver)
    received = Int[]
    for p in g
        remotecall_wait(p, B_deliver, m)
        push!(received, p)
    end
    for p in g
        if !(p in received)
            remotecall_wait(p, B_deliver, m)
            push!(received, p)
        end
    end
end

# Remove all existing processes
for i in workers()
    rmprocs(i)
end

# Add 10 processes (workers)
addprocs(10)

# My group is composed by all workers
g = workers()

# Multicasting "oi!" message to group `g` by assuming `println` as B_deliver function.
R_multicastSync(g,"oi!",println)


	From worker 162:	oi!
	From worker 163:	oi!
	From worker 164:	oi!
	From worker 165:	oi!
	From worker 166:	oi!
	From worker 167:	oi!
	From worker 168:	oi!
	From worker 169:	oi!
	From worker 170:	oi!
	From worker 171:	oi!
Worker 157 terminated.
Worker 152 terminated.
Worker 159 terminated.
Worker 155 terminated.
Worker 153 terminated.Worker 156 terminated.Worker 154 terminated.


Worker 160 terminated.
Worker 158 terminated.
  • R-multicast assíncrono

In [21]:
# Implementation of the asynchronous R-multicast.

function R_multicastAsync(g, m, B_deliver)
    received = Int[]
    for p in g
        remotecall(p, B_deliver, m)
        push!(received, p)
    end
    for p in g
        if !(p in received)
            remotecall(p, B_deliver, m)
            push!(received, p)
        end
    end
end

# Remove all existing processes
for i in workers()
    rmprocs(i)
end

# Add 10 processes (workers)
addprocs(10)

# My group is composed by all workers
g = workers()

# Multicasting "oi!" message to group `g` by assuming `println` as B_deliver function.
R_multicastAsync(g,"oi!",println)


	From worker 197:	oi!
	From worker 196:	oi!
	From worker 195:	oi!
	From worker 201:	oi!
	From worker 194:	oi!
	From worker 192:	oi!
	From worker 193:	oi!
	From worker 198:	oi!
	From worker 200:	oi!
	From worker 199:	oi!
Worker 194 terminated.Worker 196 terminated.Worker 197 terminated.Worker 200 terminated.Worker 192 terminated.Worker 193 terminated.Worker 198 terminated.Worker 195 terminated.Worker 199 terminated.








Faça a mesma análise de desempenho para o R-multicast que você fez no Exercício 2.


In [30]:
function R_multicastAsync(g, m, B_deliver)
    received = Int[]
    for p in g
        remotecall(p, B_deliver, m)
        push!(received, p)
    end
    for p in g
        if !(p in received)
            remotecall(p, B_deliver, m)
            push!(received, p)
        end
    end
end

function R_multicastSync(g, m, B_deliver)
    received = Int[]
    for p in g
        remotecall_wait(p, B_deliver, m)
        push!(received, p)
    end
    for p in g
        if !(p in received)
            remotecall_wait(p, B_deliver, m)
            push!(received, p)
        end
    end
end

# Remove all existing processes
for i in workers()
    rmprocs(i)
end

# Add 10 processes (workers)
addprocs(10)

# My group is composed by all workers
g = workers()

times = Array(Any, 50)

for i = 1:50
    times[i] = @elapsed R_multicastSync(g,"oi!",println)
end

for i = 1:50
    print(times[i])
    print("\n")
end


	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
	From worker 292:	oi!
	From worker 293:	oi!
	From worker 294:	oi!
	From worker 295:	oi!
	From worker 296:	oi!
	From worker 297:	oi!
	From worker 298:	oi!
	From worker 299:	oi!
	From worker 300:	oi!
	From worker 301:	oi!
1.034427273
0.008702309
0.002138434
0.005351077
0.005285807
0.002178636
0.002133345
0.003645125
0.003565262
0.003651172
0.015489131
0.002347807
0.001947598
0.002029229
0.002099909
0.001968235
0.001904769
0.002115173
0.001890012
0.001844306
0.001799628
0.00174573
0.001756307
0.00287548
0.001707578
0.001688141
0.001830576
0.001711331
0.00171939
0.001746348
0.001685608
0.001639871
0.001646364
0.001850513
0.00170623
0.001578177
0.001639942
0.001577799
0.001732889
0.001656858
0.001692475
0.001615957
0.002053251
0.001712348
0.001788717
0.001716804
0.002630891
0.001747238
0.001622842
0.001673312
Worker 282 terminated.Worker 289 terminated.Worker 287 terminated.


Worker 286 terminated.
Worker 290 terminated.
Worker 284 terminated.
Worker 285 terminated.
Worker 283 terminated.
Worker 288 terminated.

Após executar 50 vezes o R-multicast síncrono e assíncrono foi gerado um arquivo ".csv" que foi utilizado no ambiente R para a geração de alguns dados importantes que segue logo a baixo:

Síncrono Assíncrono
Min. :0.001578 Min. :0.0002562
1st Qu.:0.001707 1st Qu.:0.0002874
Median :0.001815 Median :0.0004611
Mean :0.023165 Mean :0.0037654
3rd Qu.:0.002137 3rd Qu.:0.0005044
Max. :1.034427 Max. :0.0700710

Gráfico:

Observação: Os dados usádos e o código em R usados para gerar esse gráfico podem ser encontrados em: https://github.com/danielsanfr/universitys-homeworks/tree/master/distributed-systems

  • Qual das duas versões (R-multicast síncrono e assíncrono) teve o menor tempo de execução? Por quê?

Resposta: No caso do R-multicast pudemos notar que a versão assíncrona teve um tempo de execução muito menor. Isso se deve ao fato de que como agora é necessário fazer uma verificação se a mensagem foi recebida, a versão síncrona acaba demorando bem mais nessas verificações.

Exercício 4: Análise de desempenho: B-multicast vs. R-multicast (3,0 pontos)

Para cada uma das comparações abaixo, qual dos algoritmos teve o menor tempo de execução? Por quê?

  • B-multicast assíncrono vs. R-multicast assíncrono.

Resposta: O algoritmo B-multicast teve o menor tempo de execução pois nesse algoritmo não é necessário verificar se a mensagem foi recebida.

  • B-multicast síncrono vs. R-multicast síncrono.

Resposta: Aqui novamente o algoritmo B-multicast teve menor tempo de execução, isso ocorreu pelo mesmo motivo mostrato na pergunta anterior, o B-multicast é mais simples e não precisa verificar se a mensagem foi recebida.

Entrega

As respostas deverão ser entregues nos devidos campos desse arquivo, ou seja, em Markdown e no formato IJulia Notebook.

O programa deve ser implementado na linguagem de programação Julia. Seu trabalho será testado na JuliaBox, portanto teste seu arquivo IJulia na JulizBox antes de enviá-lo.

Forma

O arquivo IJulia Notebook deverá ser entregue ao Professor exclusivamente por e-mail para o seguinte endereço: prof.alage (no) gmail com

Será registrada como data de recebimento do trabalho a data indicada pelo servidor de e-mail do Professor.

A responsabilidade sobre a integridade do arquivo contendo trabalho é exclusivamente dos discentes. Serão ignorados os trabalhos cujos arquivos não conseguirem ser abertos ou se o e-mail não chegar à caixa de entrada de e-mail do Professor.

Prazos

O prazo de entrega sem atraso é o dia 12/10/16.

Trabalhos entregues com atraso serão aceitos, no máximo, até o o dia 16/10/16. Serão descontados 5% da nota obtida por dia de atraso.

Pontuação extra

O(a) discente que realizar mais tarefas, além do que foi especificado neste trabalho, o professor atribuirá de 0,5 a 1,0 ponto extra a depender da relevância da contribuição no programa. O critério será decidido pelo professor.

O(a) discente deve indicar qual é a tarefa executada. Por exemplo, adição de funcionalidades, armazenamento de dados em arquivo, documentação de código, comentários em inglês sem erros ortográficos, etc.

Plágio A nota zero será atribuída caso haja qualquer tipo de cópia parcial ou integral assim como as devidas medidas legais. Leia a cartilha sobre plágio.

Disclaimer

Esse material foi elaborado pelo Prof. André Lage Freitas e está licenciado sob a licença GNU General Public License v3.0.