-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18_snowFlock.html
1138 lines (1138 loc) · 90.6 KB
/
18_snowFlock.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="BrOffice 3.3 (Unix)">
<META NAME="AUTHOR" CONTENT="Mario Amaral">
<META NAME="CREATED" CONTENT="20110531;21293400">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGED" CONTENT="20110905;23273300">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<META NAME="CHANGEDBY" CONTENT="Mario Amaral">
<STYLE TYPE="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
TD P { margin-bottom: 0.21cm }
H2 { margin-bottom: 0.21cm }
H2.cjk { font-family: "WenQuanYi Micro Hei" }
H2.ctl { font-family: "Lohit Hindi" }
A:link { so-language: zxx }
CODE.cjk { font-family: "WenQuanYi Micro Hei", monospace }
-->
</STYLE>
</HEAD>
<BODY LANG="pt-BR" DIR="LTR">
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>Capítulo
18. SnowFlock</I></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><BR><BR>
</P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>A
<SPAN STYLE="background: #ffffff">computação na nuvem (Cloud
Computing)</SPAN> oferece uma plataforma atrativa de computação
acessível. Ao invés de comprar e configurar um servidor físico,
<SPAN STYLE="background: #00ffff">com todo o tempo envolvido</SPAN><SPAN STYLE="background: #ffffff">,
esforço e custo inicial, os usuários podem alugar “servidores”
na nuvem com alguns 'cliques' do </SPAN><I><SPAN STYLE="background: #ffffff">mouse</SPAN></I><SPAN STYLE="background: #ffffff">
por menos de 10 </SPAN><I><SPAN STYLE="background: #ffffff">cents</SPAN></I><SPAN STYLE="background: #ffffff">
por hora. Os provedores da computação na nuvem mantém seus custos
baixo por prover Máquinas Virtuais(MVs – Virtual Machine) ao invés
de computadores físicos. O fator decisivo é o software de
virtualização , chamado de Monitor de Máquina Virtual (Virtual
Machine Monitor – VMM), que emula uma máquina física. Usuários
estão seguramente isolados em suas respectivas MVs, e estão
alegremente inconscientes que normalmente compartilham a máquina
física (“host”) com muitos outros.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><BR><BR>
</P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.1.
<I>Introduzindo SnowFlock</I></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><BR><BR>
</P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>A
computação na nuvem é uma <SPAN STYLE="background: #ffff00">benção</SPAN><SPAN STYLE="background: #ffffff">
para as organizações agéis. Com servidores físicos, usuários são
obrigados a esperar impacientemente enquanto outros (lentamente)
aprovam a compra do servidor, o lugar para fazer o pedido, alocar o
servidor, instalar e configurar o Sistema Operacional (SO) e todos os
aplicativos. Em vez de esperar semanas pelos outros para a entrega, o
usuário da nuvem mantem o controle do processo e pode criar um novo
servidor autônomo em minutos.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Infelizmente,
poucos servidores de computação na nuvem são autônomos <SPAN STYLE="background: #ffff00">(few
cloud servers stand alone)</SPAN>. Guiados pela instanciação rápida
e pelo modelo <I>pay-per-use</I>, servidores da nuvem são
normalmente membros de um grupo variável de servidores configurados
de forma semelhante a execução de tarefas dinâmicas e escaláveis
relacionadas à computação paralela, <SPAN STYLE="background: #ffff00">mineração
de dados - </SPAN><I><SPAN STYLE="background: #ffff00">data mining</SPAN></I>
– ou servidores de páginas da web. Por <SPAN STYLE="background: #ff0000">'bootar'</SPAN>
repetidamente novas instâncias da mesma template estática,
servidores da nuvem comerciais deixam de cumprir a promessa de
computação sob demanda verdadeira (<SPAN STYLE="background: #ffff00">commercial
clouds fail to fully deliver on the promise of true on-demand
computation)</SPAN>. Após instanciar o servidor, o usuário da nuvem
deve continuar gerenciando os membros do <I>cluster</I> e intermediar
a adição de novos servidores.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>SnowFlock
aborda estas questões com a clonagem de MVs, nossa proposta de
chamada a API da nuvem (<SPAN STYLE="background: #ffff00">our
proposed cloud API call</SPAN>). Do mesmo jeito que o código do
aplicativo rotineiramente invoca serviços do SO através de uma
interface <I>syscall</I>, poderia também agora invocar serviços na
nuvem através de uma interface similar. Com a clonagem de MVs
SnowFlock, a alocação de recursos, o gerenciamento de cluster e a
lógica da aplicação pode ser interligados de modo programável e
tratados como uma única operação lógica.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>A
MV chamada clone instancia múltiplos servidores na nuvem que são
cópias idênticas a MV original até o ponto da clonagem.
Logicamente, os clones herdam todos os estados de seus pais,
incluindo SO – e <I>caches</I> de aplicativos. Além disso, clones
são automaticamente adicionados a uma rede interna privada, portanto
efetivamente ingressam em um <I>cluster</I> dinamicamente escalável.
Novos recursos computacionais, encapsulados como MV idênticas, podem
ser criados <I>on-the-fly</I> e podem ser dinamicamente <SPAN STYLE="background: #ffff00">alavancados</SPAN>
quando necessário.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Para
ser de uso prático, a clonagem de MV deve ser aplicável, eficiente
e rápida. Neste capítulo nós vamos descrever como a implementação
de SnowFlock na clonagem de MV pode ser efetivamente interligada em
diversos modelos de programas e <I>frameworks</I>, como isto pode ser
implementado para manter o tempo de execução de aplicativos e
prover sobrecarga mínima, e como isto pode ser usado para criar
dezenas de novas MV em cinco segundos ou menos.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Com
uma API para o controle programável da clonagem de MV com
vinculações em C, C++, Python e Java, SnowFlock é extremamente
flexível e versátil. Nós temos utilizado o SnowFlock com sucesso
em implementações de protótipos de vários sistemas bem
diferentes. Em cenários de computação paralela, nós temos
alcançado excelentes resultados pela explícita clonagem de MV em
produção que cooperativamente distribui a carga em muitos <I>hosts</I>
físicos. Para aplicativos paralelos que utilizam a interface de
troca de mensagem (Message Passing Interface – MPI, padrão para
comunicação de dados em computação paralela) e tipicamente
executam um <I>cluster</I> de servidores dedicados, nós modificamos
o gerenciamento de inicialização da MPI para fornecer aplicativos
inalterados com bom desempenho e muito menos sobrecarga por fornecer
um <I>cluster</I> novo de clones sob a demanda para cada execução.
Finalmente, em um caso de uso bem diferente, utilizamos o SnowFlock
para melhoar a eficiência e performance de servidores elásticos.
Hoje, os servidores elásticos baseados na nuvem possuem uma nova
inicialização, <SPAN STYLE="background: #ffff00">trabalhadores
frios</SPAN> como necessários para picos de demanda <SPAN STYLE="background: #ffff00">(Today's
cloud-based elastic servers boot new, cold workers as needed to
service spikes in demand.)</SPAN>. Em vez de clonar uma MV em
execução, SnowFlock traz novos <SPAN STYLE="background: #ffff00">trabalhadores</SPAN>
online 20 vezes mais rápido, e por herdarem o <SPAN STYLE="background: #ffff00">warm
buffer</SPAN><SPAN STYLE="background: #ffffff"> de seu pai, elas
atingem seu desempenho máximo mais rápido.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><BR><BR>
</P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="background: #ffffff">18.2
A clonagem de MV</SPAN></I></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><BR><BR>
</P>
<P ALIGN=JUSTIFY><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Como
o nome sugere, os clones das MVs são (quase) idênticas a sua MV
pai. Existem na verdade algumas pequenas mas necessárias diferenças
para evitar questões tal como conflitos de endereço de MAC, mas nós
vamos voltar a isso depois. Para criar um clone, todo o disco local e
o estado da memória devem ser disponibilizados, o que nos traz para
o primeiro maior </SPAN><I><SPAN STYLE="background: #ffffff">design</SPAN></I><SPAN STYLE="background: #ffffff">
</SPAN><I><SPAN STYLE="background: #ffffff">tradeoff</SPAN></I><SPAN STYLE="background: #ffffff">
</SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="background: #ffffff">(expressão
que define uma situação em que há conflito de escolha): nós
devemos copiar o estado na frente ou sob demanda?</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">A
maneira mais simples de realizar a clonagem de MV é adaptar o padrão
MV de capacidade de migração<SPAN STYLE="background: #ffff00">(</SPAN><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">to
adapt the standard VM "migration" capability)</SPAN></SPAN>.
Normalmente, a migração é usada quando a MV em execução precisa
ser movida para um <I>host </I>diferente, tal como quando o <I>host</I>
fica sobrecarregado ou deve ser desativado para manutenção. Devido
a MV ser meramente software, ela pode ser encapsulada em um arquivo
de dados que pode então ser copiado para um <I>host</I> novo e mais
apropriado, <SPAN STYLE="background: #ff0000">onde</SPAN> voltará
para execução após uma breve interrupção. Para efetuar isto, o
VMM cria externamente um arquivo contendo um <I>checkpoint</I> da MV,
incluindo o seu sistema de arquivos local, a imagem da memória, os
registros da CPU virtual (VCPU), etc. Na migração, a recém-iniciada
cópia substitui a original, mas o processo pode ser alterado para
produzir um clone deixando a original em execução. Neste processo
“impaciente”, o estado da MV inteira é transferido, o que provê
a melhor performance inicial, porque todo o estado da MV esta em
vigor quando a execução começa. A desvantagem da replicação
“impaciente” é que o penoso processo de copiar a MV inteira deve
acontecer antes da execução poder começar, o que deixa
significantemente mais lenta a instanciação.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">O
outro extremo, adotado pelo SnowFlock, é a replicação de estado
“preguiçosa”. Em vez de copiar tudo o que a MV pode precisar,
SnowFlock transfere somente as partes essenciais para iniciar a
execução, e transfere o estado depois, somente quando o clone
precisar. Isto possui duas vantagens. Primeiro, ele minimiza a
latência de instanciação fazendo o menor trabalho possível.
Segundo, ele aumenta a eficiência, copiando somente o estado que é
realmente utilizado pelo clone. O rendimento deste benefício, é
claro, depende do comportamento do clone, mas poucos aplicativos
acessam todas as páginas da memória e todos os arquivos no sistema
local de arquivos.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">No
entanto, os benefícios da replicação “preguiçosa” não são
livres. Como a transferência de estado é adiada até o último
momento, o clone deve aguardar pelo envio do estado antes de
continuar a execução. Esta situação de troca paralela de memória
para o disco em estações de trabalho de tempo compartilhado:
aplicativos são bloqueados esperando pelo estado a ser obtido a
partir de uma fonte de alta latência (<SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">This
This situation parallels swapping of memory to disk in time-shared
workstation: applications are blocked waiting for state to be fetched
from a high latency source.)</SPAN></SPAN><SPAN STYLE="font-weight: normal">.
No caso do SnowFlock, o bloqueio degrada o desempenho do clone; a
gravidade da perda de desempenho depende do aplicação. Para
aplicações de computação de alto desempenho que nós encontramos,
esta degradação tem pouco impacto, mas um servidor de banco de
dados clonado pode funcionar mal a princípio. Deve-se notar que este
é um efeito transitório: em poucos minutos, a maior parte do estado
necessário foi transferido e o desempenho do clone corresponde ao do
pai.</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ff00ff">Como
um aparte(As an aside)</SPAN></SPAN><SPAN STYLE="font-weight: normal">,
se você esta acostumado (well versed in VMs) com MVs, é provável
que esteja perguntado se as otimizações utilizadas pela migração
“ao vivo” são úteis. A migração “ao vivo” é otimizada
para reduzir o intervalo entre a suspensão da MV original e a
retomada da execução da nova cópia. Para realizar isto, o Monitor
de Máquina Virtual (VMM) copia previamente o estado da MV, enquanto
a original continua em execução, então suspende a original,
somente as páginas alteradas recentemente precisam ser transferidas.
Esta técnica não afeta o intervalo entre a requisição de migração
e o tempo em que a cópia começa a ser executada, e assim não deve
reduzir a latência de instanciação da clonagem “impaciente” de
MV.</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="font-weight: normal; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="background: #ffffff">18.3
A abordagem do SnowFlock (<SPAN STYLE="background: #94006b">SnowFlock's
Approach</SPAN>)</SPAN></I></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">O
SnowFlock implementa a clonagem de MV com um primitivo chamado “<I>VM
Fork</I>”, que é como um “<I>Unix fork</I>” padrão, mas com
algumas diferenças importantes. Primeiramente, em vez de duplicar um
único processo, o <I>VM Fork</I> duplica uma MV inteira, incluindo
toda memória, todos os processos e dispositivos virtuais, e o
sistema de arquivos local. Em segundo lugar, ao invés de produzir
uma única cópia em execução no mesmo <I>host</I> físico, <I>VM
Fork</I> pode simultaneamente gerar muitas cópias em paralelo.
Finalmente, as MVs podem ser divididas em servidores físicos
distintos, permitindo-lhe aumentar rapidamente sua capacidade de
nuvem conforme necessário.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Os
seguintes conceitos são fundamentais para o SnowFlock:</SPAN></FONT></FONT></FONT></P>
<UL>
<LI><P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Virtualização:
a MV encapsula o ambiente de computação, tornando “nuvens” e a
clonagem de máquinas possível;</SPAN></FONT></FONT></FONT></P>
<LI><P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Propagação
“preguiçosa”: o estado da MV não é copiado até ser
necessário, então os clones “ganham vida” em poucos segundos;</SPAN></FONT></FONT></FONT></P>
<LI><P ALIGN=JUSTIFY STYLE="font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="background: #ffffff">Multicast</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="background: #ffffff">:
clones irmãos possuem necessidades similares em termos de estado de
MV. Com o </SPAN></SPAN><I><SPAN STYLE="background: #ffffff">multicast</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="background: #ffffff">,
dezenas de clones começam a executar tão rápido quanto apenas um;</SPAN></SPAN></FONT></FONT></FONT></P>
<LI><P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Falhas
de página: quando um clone tenta utilizar uma memória inexistente,
isto falha e dispara uma requisição para o pai. A execução do
clone é bloqueada até a página necessária chegar;</SPAN></FONT></FONT></FONT></P>
<LI><P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Cópia
na escrita (</SPAN></SPAN></SPAN><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Copy
on Write</SPAN></SPAN></I><SPAN STYLE="background: #ffffff"> –
</SPAN><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">CoW</SPAN></SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">):
tomando uma cópia de sua memória e páginas de disco antes de
sobrescrevê-las, a MV pai pode continuar executando enquanto
preserva uma cópia “congelada” deste estado para ser usado
pelos clones.</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
</UL>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Nós
implementamos o SnowFlock utilizando o sistema de virtualização
Xen, então é útil introduzirmos alguns termos específicos do Xen
para que fiquem claros. Em um ambiente Xen, o VMM é chamado de
<I>hypervisor</I>, e as Mvs são chamadas de domínios. Em cada
máquina física (<I>host</I>), existe um domínio privilegiado,
chamado “domínio 0” (dom0), que tem acesso total ao <I>host</I>
e a seus dispositivos físicos, e pode ser utilizado para controlar
um convidado adicional, ou “usuário”, MVs que são chamadas
“domínio U” (domU).</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">De
modo geral, SnowFlock consiste de um conjunto de modificações no
<I>hypervisor</I> do Xen que o permitem recuperar sem problemas
quando os recursos em falta são acessados, e um conjunto de
processos de suporte e sistemas que são executados no dom0 e
cooperativamente transferem o estado da MV que falta, e algumas
modificações opcionais para o SO executar dentro de MVs clonadas.
Há 6 componentes principais.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">-
Descritor de MV </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">(VM
Descriptor)</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">:
Este pequeno objeto é usado para semear o clone, e mantém o
esqueleto </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>dos
bare-bones (<A HREF="http://en.wikipedia.org/wiki/Barebone_computer">http://en.wikipedia.org/wiki/Barebone_computer</A>
– colocar?) da MV como necessário para começar a execução.
Falta-lhe a coragem e o músculo necessário para realizar qualquer
trabalho útil;</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">-
Sistema de Distribuição Multicast (</SPAN></SPAN></SPAN></FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">mcdist):
Este sistema do lado do pai distribui eficientemente as informações
de estado da MV simultaneamente para todos os clones;</SPAN></SPAN></SPAN></FONT></FONT></FONT></CODE></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">-
Processo de Servidor de Memória <SPAN STYLE="background: #ffff00">(Memory
Server Process)</SPAN>: Este processo do lado do pai mantém uma
cópia congelada do estado do pai, e torna disponível para todos os
clones sob demanda através do mcdist;</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">-
Processo <I>Memtap</I>: Este processo do lado do clone atua a favor
do clone, e se comunica com a o servidor de memória para solicitar
páginas que são necessárias mas estão faltando;</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">-
Iluminação do clone (<SPAN STYLE="background: #ffff00">Clone
Enlightenment</SPAN>): O <I>kernel</I> convidado em execução dentro
dos clones pode aliviar a transferência sob demanda de estado da MV,
fornecendo dicas para o VMM. Isto é opcional, mas altamente
desejável para eficiência;</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">-
Pilha de controle: <I>Daemons</I> são executados em cada <I>host</I>
físico para orquestrar os outros componentes e gerenciar o pai
SnowFlock e as MVs clonadas.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=CENTER STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<UL>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #23ff23">FIGURA!</SPAN></FONT></FONT></FONT></P>
</UL>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Figura
18.1: Arquitetura de replicação de MV SnowFlock.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Pictoricamente
falando, a Figura 18.1 descreve o processo de clonagem de uma MV,
mostrando as 4 etapas principais: (1) interromper a MV pai para
produzir um descritor da arquitetura; (2) distribuir este descritor
para todos os <I>hosts</I> alvo; (3) iniciar os clones que são
estados sábios quase vazios (<SPAN STYLE="background: #ffff00">initiating
clones that are mostly empty state-wise</SPAN>); e (4) propagar o
estado sob demanda. A figura também mostra o uso de distribuição
<I>multicast</I> com mcdist, e busca evitar a iluminação através
de convidado(<SPAN STYLE="background: #ffff00">and fetch avoidance
via guest enlightenment</SPAN>).</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Se
você esta interessado em experimentar o SnowFlock, ele esta
disponível de duas maneiras (</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #00ffff">it's
available in two flavors</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">).
A documentação e o código-fonte aberto para a pesquisa original do
SnowFlock da Universadade de Toronto estão disponíveis [1]. Se você
preferir obter a versão industrial para teste, uma licença livre e
não-comercial esta disponível no GridCentric Inc [2]. </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">(The
documentation and open source code for the original University of
Toronto SnowFlock research project are available<A HREF="http://www.aosabook.org/en/snowflock.html#footnote-1">1</A> If
you'd prefer to take the industrial-strength version for a spin, a
free, non-commercial license is available from GridCentric Inc.<A HREF="http://www.aosabook.org/en/snowflock.html#footnote-2">2</A>)</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><SPAN STYLE="background: #ffffff">
</SPAN></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Devido
ao SnowFlock incluir alterações ao </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">hypervisor</SPAN></SPAN></I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><SPAN STYLE="background: #ffffff">
</SPAN></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">e
requerer acesso ao dom0, instala-lo requer acesso privilegiado nas
máquinas de </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">host</SPAN></SPAN></I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">.
Por esta razão, você precisará usar seu próprio </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">hardware</SPAN></SPAN></I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">,
e não estará apto a experimentá-lo fora como um usuário num
ambiente comercial de nuvem tal como o EC2 da Amazon.</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Ao
longo das próximas seções nós descreveremos as diferentes partes
que cooperam para atingir clonagens instantâneas e eficientes. Todos
os pedaços que se encaixam nós descreveremos, como mostrado na
Figura 18.2.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #23ff23">FIGURA!</SPAN></FONT></FONT></FONT></P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Figura
18.2: Componentes de Software do SnowFlock.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=CENTER STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<H2 CLASS="western" ALIGN=JUSTIFY STYLE="margin-top: 0cm; margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">18.4
Descritor Arquitetural da MV (Architectural VM Descriptor)</SPAN></FONT></FONT></FONT></H2>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>O
decisão-chave de design para o SnowFlock é adiar a replicação de
estado da MV para uma operação de tempo de execução “preguiçosa”.
Em outras palavras, copiar a memória de uma MV é uma operação de
ligação tardia, permitindo muitas oportunidades de otimização.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>O
primeiro passo para realizar esta decisão de design é a geração
de um descritor de arquitetura do estado da MV. Esta é a semente que
será usada para criar as MVs clonadas. Ela contém o mínimo
necessário para criar uma MV e torná-la escalonável (</FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">schedulable</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">).
Como o nome indica, este mínimo é composto por estruturas de dados
necessários para a especificação básica de arquitetura. No caso
do SnowFlock, a arquitetura é uma combinação de requisitos do
processador Intel x86 e os requisitos do Xen. O descritor de
arquitetura, portanto, contém estruturas de dados tal como tabelas
de páginas, registros virtuais, dispositivos de metadados, </SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">wallclock
timestamps</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">,
etc. Nós encaminhamos o leitor interessado para [<A HREF="http://www.aosabook.org/en/bibliography.html#bib:snowflock:tocs">LCWB+11</A>],
para uma descrição detalhada dos conteúdos do descritor de
arquitetura.</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Um
descritor de arquitetura possui três propriedades importantes:
Primeiro, ele pode ser criado em pouco tempo; 200 milissegundo não é
incomum. Segundo, ele é pequeno, tipicamente três ordens de
magnitude menores que a alocação de memória da MV de origem (1 MB
para 1 GB de MV). E terceiro, uma MV clone pode ser criada a partir
de um descritor em menos de um segundo (normalmente 800
milissegundos).</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>O
problema, com certeza, é que as MVs clonadas perdem a maior parte de
seu estado de memória no momento em que são criadas a partir do
descritor. A seções seguintes explicam como nós resolvemos este
problema – e como aproveitamos as oportunidades de otimização
apresentadas.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<H2 CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-weight: normal">18.5
Componentes do lado-pai </SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">(18.5.
Parent-Side Components)</SPAN></SPAN></FONT></FONT></FONT></H2>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Uma
vez que a MV é clonada ela se torna um pai para seus filhos ou
clones. Como todos os pais responsáveis, ela precisa vigiar pelo
bem-estar de seus descendentes. Isso se dá pela criação de um
conjunto de serviços que fornecem memória e estado de disco para a
MVs clonadas sob demanda.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.5.1
Processo <I>Memsever</I> (<SPAN STYLE="background: #ffff00">servir
memória</SPAN>)</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Quando
o descritor de arquitetura é criado, a MV é interrompida em suas
faixas ao longo do processo. Assim o estado da memória da MV é
resolvido; antes de realmente pausar uma MV e desindexar da execução,
controladores internos quiesce – pausa ou alteração do estado de
processos em execução no computador - do SO em um estado do qual os
clones podem reconectar para o mundo externo em suas novas MVs
anexadas. Aproveitamos este estado quiesce para criar um “servidor
de memória”, ou memserver.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ff0000">(When
the architectural descriptor is created, the VM is stopped in its
tracks throughout the process. This is so the VM memory state
settles; before actually pausing a VM and descheduling from
execution, internal OS drivers quiesce into a state from which clones
can reconnect to the external world in their new enclosing VMs. We
take advantage of this quiescent state to create a "memory
server", or </SPAN></SPAN></SPAN></FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ff0000">memserver</SPAN></SPAN></SPAN></FONT></FONT></FONT></CODE><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ff0000">.)</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">O
servidor de memória irá fornecer todos os clones com os bits de
memória que eles precisem dos pais. A memória é propagada para
granularidade de uma página de memória x86 (4kbytes). Em sua forma
mais simples, o servidor de memória fica à espera de pedidos de
página a partir dos clones, e serve uma página por vez, um clone
por vez.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Todavia,
esta é a mesma memória que a MV pai necessita usar para se manter
em execução. Se permitíssemos o pai ir em frente e modificar esta
memória, nós serviríamos conteúdo de memória corrompido para
clonar as MVs: a memória servida seria diferente da que no momento
da clonagem, e os clones seriam confundidos <SPAN STYLE="background: #ff0000">(</SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ff0000">would
be mightily confused</SPAN></SPAN></SPAN><SPAN STYLE="background: #ff0000">)</SPAN>.
Em termos de kernel hacking, esta é uma receita certa para
rastreamentos de pilha.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Para
contornar este problema, uma noção clássica de SO veio para a
salvação: <I>Copy-on-Write</I> <SPAN STYLE="font-style: normal">(</SPAN>cópia
na escrita), ou memória <I>CoW</I><SPAN STYLE="font-style: normal">.
Ao buscar ajuda do </SPAN><I>Xen hypervisor</I><SPAN STYLE="font-style: normal">,
nós podemos remover privilégios de escrita de todas as páginas de
memória na MV pai. Quando o pai realmente tenta modificar uma
página, uma falha de página de hardware é acionado. O Xen sabe por
que isto aconteceu, e faz uma cópia da página. A MV pai é
permitido escrever na página original e continuar em execução,
enquanto o servidor de memória é avisado para usar a cópia, que é
mantida em somente leitura. Desta maneira, o estado de memória no
ponto de clonagem permanece congelado para que o clone não seja
confundido, enquanto o pai é habilitado para prosseguir com a
execução. A sobrecarga de CoW é mínima: mecanismos similares são
usados pelo Linux, por exemplo, quando novos processos são criados.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2"><A NAME="__DdeLink__648_240000871"></A>
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal">18.5.2
</SPAN><I><SPAN STYLE="font-weight: normal">Multicasting</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">com</SPAN></SPAN>
<I><SPAN STYLE="font-weight: normal">Mcdist</SPAN></I></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-weight: normal">Os
clones são tipicamente aflitos com uma síndrome existencial
conhecida como “destino determinista”(</SPAN><I><SPAN STYLE="font-weight: normal">fate
determinism</SPAN></I><SPAN STYLE="font-weight: normal">). Esperamos
os clones a serem criados para uma única finalidade: por exemplo,
para alinhar cadeias X de DNA com um segmento Y de um banco de dados.
Além disso, nós esperamos um conjunto de clones a serem criados
para que todos os irmãos façam o mesmo, talvez alinhem as mesmas
cadeias X com diferentes segmentos do banco de dados, ou alinhem
diferentes cadeias com o mesmo seguimento Y. Os clones, assim,
claramente exibem uma grande quantidade de localidade temporal em
seus acessos de memória: eles usarão o mesmo código e grandes
porções de dados comuns.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Nós
exploramos as oportunidades para a localização temporal (<I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">temporal
locality</SPAN></SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">)
através do mcdist, nosso próprio sistema de distribuição
</SPAN></SPAN><I><SPAN STYLE="font-weight: normal">multicast</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">adaptado
para o SnowFlock. Mcdist utiliza </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">multicast</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">de
IP para simultaneamente distribuir o mesmo pacote para um conjunto de
receptores. Ele tira proveito do paralelismo de </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">hardware</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">de
rede para diminuir a carga sobre o servidor de memória. Enviando uma
resposta para todos os clones na primeira requisição para um
página, os pedidos de cada clone atuam como uma pré-busca para seus
irmãos, por causa de seus padrões de acesso semelhantes de memória.</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Diferente
de outros sistemas de <I>multicast</I>, o msdist não tem de ser
confiável, não precisa entregar pacotes de forma ordenada e não
necessita entregar atomicamente uma resposta para todos os receptores
pretendidos. O <I>multicast</I> é estritamente uma otimização e a
entrega só precisa ser assegurada para o clone que explicitamente
solicita uma página. O <I>design </I><SPAN STYLE="font-style: normal">é</SPAN><I>,</I>
desta forma, elegantemente simples: o servidor simplesmente <SPAN STYLE="background: #ffff00">envia
respostas de forma </SPAN><I><SPAN STYLE="background: #ffff00">multicast</SPAN></I><SPAN STYLE="background: #ffff00">(</SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">multicasts
responses</SPAN></SPAN></SPAN><SPAN STYLE="background: #ffff00">)</SPAN>,
enquanto os clientes recebem um <I><SPAN STYLE="background: #ffffff">time-out</SPAN></I>
se eles não receberem uma resposta para uma solicitação e reenviam
a requisição. <SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">the
server simply multicasts responses, while clients time-out if they
have not received a reply for a request, and retry the request.</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffffff">Três
otimizações específicas para o SnowFlock estão incluídas no
mcdist:</SPAN></FONT></FONT></FONT></P>
<UL>
<LI><P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Detecção
de bloqueio (</SPAN></SPAN></SPAN><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Lockstep
Detection</SPAN></SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">):
quando a localização temporal acontece, muitos clones solicitam a
mesma página em uma curta sequência de tempo. O servidor mcdist
ignora todos, mas o primeiro dessas solicitação.</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">(Lockstep
Detection: When temporal locality does happen, multiple clones
request the same page in very close succession. The </SPAN></SPAN></SPAN></FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">mcdist</SPAN></SPAN></SPAN></FONT></FONT></FONT></CODE><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><SPAN STYLE="background: #ffff00"> </SPAN></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">server
ignores all but the first of such requests.)</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
<LI><P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Controle
de Fluxo: os receptores adicionam suas taxas de recebimento nas
solicitações. O servidor </SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I><SPAN STYLE="font-weight: normal">throttles</SPAN></I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">(==</SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">mechanism
by which the flow of a fluid is managed
by </SPAN></SPAN></SPAN></FONT></FONT></FONT><A HREF="http://en.wiktionary.org/wiki/constriction"><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">constriction</SPAN></SPAN></SPAN></FONT></FONT></SPAN></FONT></A><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><SPAN STYLE="background: #ffff00"> </SPAN></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">or </SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00"><A HREF="http://en.wiktionary.org/wiki/obstruction">obstruction</A>???</SPAN></SPAN></SPAN></FONT></FONT></SPAN></FONT><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">)
sua taxa de envio a uma média ponderada das taxas de recepção dos
clientes. </SPAN></SPAN></SPAN></FONT></FONT></SPAN></FONT><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">(The
server throttles its sending rate to a weighted average of the
clients' receive rate.)</SPAN></SPAN></SPAN></FONT></FONT></SPAN></FONT><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="arial, sans-serif"><SPAN STYLE="background: #ffffff">
</SPAN></FONT></SPAN></FONT><FONT COLOR="#000000"><SPAN STYLE="text-decoration: none"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Caso
contrário, os receptores serão afogados por muitas páginas
enviadas por um servidor ansioso.</SPAN></SPAN></SPAN></FONT></FONT></SPAN></FONT></P>
<LI><P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="text-decoration: none"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">Jogo
final: quando o servidor enviou a maioria das páginas, ele volta
para respostas </SPAN></SPAN></SPAN></SPAN><SPAN STYLE="text-decoration: none"><I><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">unicast</SPAN></SPAN></I></SPAN><SPAN STYLE="text-decoration: none"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffffff">.
A maioria das solicitações neste momento são tentativas, e, assim
explodindo uma página através do fio para todos os clones é
desnecessário. </SPAN></SPAN></SPAN></SPAN><SPAN STYLE="text-decoration: none"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">(</SPAN></SPAN></SPAN></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">Most
requests at this point are retries, and thus blasting a page through
the wire to all clones is unnecessary.)</SPAN></SPAN></SPAN></FONT></FONT></FONT></P>
</UL>
<P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; font-style: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.5.3
Disco Virtual</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; border: none; padding: 0cm; widows: 2; orphans: 2">
<BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal">Os
clones SnowFlock, devido à sua vida curta e destino determinista,
raramente utilizam seu disco. O disco virtual para uma MV SnowFlock
reside na partição raiz com binários, bibliotecas e arquivos de
configuração. O processamento de dados pesados é feito através de
sistemas de arquivos adequados, tais como HDFS ou PVFS. Assim, quando
os clones SnowFlock decidem ler a partir de seus discos de origem,
eles normalmente </SPAN>têm suas solicitações satisfeitas pelo
cache de página do kernel do sistema de arquivos.</FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal">Tendo
dito isto, ainda precisamos prover acesso ao disco virtual para os
clones, no caso raro que tal acesso é necessário. Nós adotamos o
caminho de menor resistência aqui, e implementamos o disco seguindo
estritamente o </SPAN><I>design</I> <SPAN STYLE="font-style: normal">de
replicação de memória.</SPAN></FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal">Primeiro,
o estado do disco é congelado no momento de clonagem. As MV pai
continua usando seu disco em um modo CoW: escritas são enviadas para
um local separado em um armazenamento de apoio, enquanto que a
visualização do disco que o clone espera continua imutável. Em
segundo lugar, o estado do disco é </SPAN><I>multicast</I> <SPAN STYLE="font-style: normal">para
todos os clones, utilizando </SPAN><I>mcdist</I><SPAN STYLE="font-style: normal">,
com os mesmos 4KB de granularidade de página, e sob as mesmas
expectativas de localidade temporal. Em terceiro lugar, o estado do
disco replicado para uma MV clone é estritamente transitório: é
armazenado em um arquivo plano escasso que é excluído uma vez que o
clone é destruído.</SPAN></FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.6.
Os componentes dos clones</FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Os
clones são “conchas vazias” quando eles são criados a partir de
um descritor de arquitetura, assim como todo mundo, eles necessitam
de muita ajuda de seus pais para crescer: as MVs criança saem e
imediatamente chamam o lar sempre que perceberem que algo que eles
precisam esta faltando, pedindo a seus pais para enviá-los isto
imediatamente.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.6.1.
Processo <I>Memtap</I></FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; font-style: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Junto
a cada clone, após da criação, o processo <I>memtap</I> é a
salvação de um clone. Ele mapeia toda a memória do clone e
preenche-o sob demanda, conforme necessário. Ele pede alguns pedaços
cruciais de ajuda do <I>hypervisor</I> Xen: permissão de acesso para
as páginas de memória dos clones é desligada, e as falhas de
<I>hardware</I> causadas pelo primeiro acesso a uma página são
encaminhados pelo <I>hypervisor</I> no processo <I>memtap</I>.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; font-style: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Em
sua encarnação mais simples, o processo <I>memtap</I> simplesmente
pergunta ao servidor de memória por páginas de falhas, mas há
situações mais complicadas também. Primeiramente, <I>helpers
memtap</I> utilizam <I>mcdist</I>. Isto significa que a qualquer
momento, qualquer página pode chegar, em virtude de ter sido
requisitada por outro clone – a beleza do <I><SPAN STYLE="font-weight: normal">prefetching</SPAN></I>
<SPAN STYLE="font-weight: normal">assíncrono. Segundo, nós
permitimos que MVs SnowFlock sejam MVs multiprocessadas. Não seria
muito divertido de qualquer forma. Isto significa que diferentes
falhas precisam ser tratadas em paralelo, talvez até para a mesma
página. Terceiro, nas últimas versões os ajudantes </SPAN><I><SPAN STYLE="font-weight: normal">memtap</SPAN></I>
<SPAN STYLE="font-weight: normal">podem explicitamente “</SPAN><I><SPAN STYLE="font-weight: normal">prefetch”</SPAN></I>
<SPAN STYLE="font-weight: normal">um lote de páginas, que pode
chegar em qualquer ordem, dada a falta de garantia do servidor
</SPAN><I><SPAN STYLE="font-weight: normal">mcdist</SPAN></I><SPAN STYLE="font-weight: normal">.
Qualquer um destes fatores pode ter levado a um pesadelo de
concorrência, e temos todos eles.</SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Todo
os centros </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>design</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>memtap</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>em
uma página tem a presença de </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>bitmap</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="background: #ffff00">(</SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">The
entire </SPAN></SPAN></SPAN></FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">memtap</SPAN></SPAN></SPAN></FONT></FONT></FONT></CODE><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><SPAN STYLE="background: #ffff00"> </SPAN></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">design
centers on a page presence bitmap.</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="background: #ffff00">)</SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>.
O </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>bitmap</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>é
criado e inicializado quando o descritor de arquitetura é processado
para criar uma MV clone. O </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>bitmap</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>é
uma matriz de bits </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffff00">(</SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">flat
bit array)</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>medido
pelo número de páginas de memória que a MV pode suportar.
Processadores Intel possuem instruções acessíveis de mutação
atômica: bit de definição</FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="background: #ffff00">(</SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">setting
a bit)</SPAN></SPAN></SPAN></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>,
ou fazer um teste e definição, pode acontecer com a garantia de
atomicidade com relação a outros processadores na mesma caixa. Isto
nos permite evitar bloqueios na maioria dos casos, e assim prover
acesso ao </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>bitmap</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>por
diferentes entidades em diferentes domínios de proteção: o
</FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>hypervisor</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Xen,
o processo </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>memtap</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>,
e o </FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><I>kernel</I></FONT></FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">
</FONT></FONT><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>convidado
clonado em si.</FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Quando
o Xen manuseia uma falha de página de </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">hardware</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">devido
a um primeiro acesso a uma página, ele usa o </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">bitmap</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">para
decidir se ele precisa alertar o </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">memtap</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.
Ele também usa o </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">bitmap</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">para
enfileirar múltiplas falhas de processadores virtuais como
dependente da mesma página ausente. Páginas de </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">buffer</SPAN></I>
<I><SPAN STYLE="font-weight: normal">memtap</SPAN></I> <SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">como
elas chegam </SPAN></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal"><SPAN STYLE="background: #ffff00">(Memtap
buffers pages as they arrive.)</SPAN></SPAN></SPAN><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.
Quando o </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">buffer</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">esta
cheio ou uma solicitação explícita de página chega, a MV é
pausada e o </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">bitmap</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">é
usado para descartar qualquer página duplicada que tenha chegado mas
já esta presente. Todas as páginas restantes que são necessárias
são então copiadas para a memória da MV, e os </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">bits</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">de
</SPAN></SPAN><I><SPAN STYLE="font-weight: normal">bitmap</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">apropriados
são definidos.</SPAN></SPAN></FONT></FONT></FONT></P>
<P STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P STYLE="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.6.2.
Clones inteligentes evitam esforços desnecessários</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Nós
acabamos de mencionar que a página </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">bitmap</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">presente
é visível para o </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">kernel</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">em
execução dentro do clone, e que nenhum bloqueio é necessário para
modificá-lo. Isto dá aos clone uma poderosa ferramente de
“iluminação”: eles podem impedir a busca de páginas por
modificar o bitmap e fingir que elas estão presentes. Isto é
extremamente útil em termos de performance, e seguro fazer quando as
páginas serão completamente sobrescritas antes de serem utilizadas.</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">É
uma situação comum quando isto acontece e buscas podem ser
evitadas. Todas as alocações de memória no </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">kernel</SPAN></I>
<SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">(usando
</SPAN></SPAN><I><SPAN STYLE="font-weight: normal">vmalloc</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">,
</SPAN></SPAN><I><SPAN STYLE="font-weight: normal">kzalloc</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">,
</SPAN></SPAN><I><SPAN STYLE="font-weight: normal">get_free_page</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">,
espaço de usuário brk e assim por diante) são, em última análise,
tratadas pelo alocador de página do </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">kernel</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">.</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Normalmente
as páginas são solicitadas por alocadores intermediários que
gerenciam pedaços mais refinados: o alocador </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">slab</SPAN></I><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">,
o alocador </SPAN></SPAN><I><SPAN STYLE="font-weight: normal">glibc
malloc</SPAN></I> <SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">para
um processo de espaço de usuário, etc. Contudo, se a alocação é
explícita ou implícita, uma implicação de chave semântica sempre
é verdadeira: ninguém se preocupa com o que a página continha,
pois seu conteúdo será arbitrariamente substituído. Por que buscar
este tipo de página então? Não há nenhuma razão para fazê-lo, e
a experiência empírica mostra que evitar buscas é tremendamente
vantajoso.</SPAN></SPAN></FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.7.
Interface de aplicação da clonagem de MV</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Até
agora, temos focado no funcionamento interno da clonagem de uma MV de
modo eficiente. Tão divertido quanto os sistemas solipsistas podem
ser, nós precisamos voltar nossa atenção para aqueles que usarão
o sistema: aplicações.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; widows: 2; orphans: 2"><BR>
</P>
<P ALIGN=JUSTIFY STYLE="margin-bottom: 0cm; font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>18.7.1
Implementação da API</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="font-style: normal; font-weight: normal; widows: 2; orphans: 2">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>A
clonagem de MV é oferecida para a aplicação através de uma API
SnowFlock simples, representada na Figura 18.1. A clonagem é
basicamente um processo de dois estágios. Você primeiro solicita
uma alocação para as instâncias clone, embora devido as políticas
do sistema que estão em vigor, esta alocação pode ser menor que a
solicitada. Segundo, você utiliza a alocação para clonar sua MV.
Um pressuposto fundamental é que sua MV se concentra em uma única
operação. A clonagem de MV é apropriada para aplicação única de
MVs tal como um servidor web ou um componente <I>render farm</I>. Se
você tem processo de cem ambientes de trabalho em que múltiplas
aplicações simultaneamente chamam a clonagem de MV, você esta indo
para o caos.</FONT></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<TABLE WIDTH=100% CELLPADDING=4 CELLSPACING=0>
<COL WIDTH=128*>
<COL WIDTH=128*>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_request_ticket(n)</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border: 1px solid #000000; padding: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Solicita
uma alocação para n clones. Retorna um bilhete descrevendo uma
alocação para m</FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">≤</FONT></FONT></CODE><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>n
clone.</FONT></FONT></FONT></CODE></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_clone(ticket)</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Clones,
utilizam a alocação de bilhete. Retorna o ID do clone, 0</FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">≤</FONT></FONT></CODE><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>ID<m.</FONT></FONT></FONT></CODE></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_checkpoint_parent()</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Prepara
uma <I>checkpoint</I> C imutável da MV pai para ser usado para
criação de clones em um momento arbitrariamente mais tarde.</FONT></FONT></FONT></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_create_clones(C,
ticket)</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Igualmente
ao sf_clone, usa o </FONT><FONT SIZE=3><I>checkpoint</I></FONT> <FONT SIZE=3>C.
Os clones irão começar a execução no momento em que o
correspondente sf_checkpoint_parent() foi invocado.</FONT></FONT></FONT></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_exit()</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Para
filhos </FONT></FONT></FONT><CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>(1≤ID<m),
encerra o filho.</FONT></FONT></FONT></CODE></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_join(ticket)</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Para
o pai (ID = 0), bloqueia até que todos os filhos em um bilhete
obtenham suas chamadas sf_exit. Neste momento, todos os filhos
serão encerrados e o bilhete descartado.</FONT></FONT></FONT></P>
</TD>
</TR>
<TR VALIGN=TOP>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm">
<CODE CLASS="western"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>sf_kill(ticket)</FONT></FONT></FONT></CODE></P>
</TD>
<TD WIDTH=50% STYLE="; border: none; padding: 0cm">
<P ALIGN=JUSTIFY STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Somente
o pai, descarta bilhetes e imediatamente mata todos os filhos
associados.</FONT></FONT></FONT></P>
</TD>
</TR>
<TR>
<TD COLSPAN=2 WIDTH=100% VALIGN=TOP STYLE="; border: none; padding: 0cm">
<P ALIGN=CENTER STYLE="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm">
<FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><FONT SIZE=3>Tabela
19.1: A API de clonagem SnowFlock</FONT></FONT></FONT></P>
</TD>
</TR>
</TABLE>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">A
API simplesmente dirige mensagens e funções para o XenStore, uma
interface de memória compartilhada de baixo rendimento utilizada
pelo Xen para controlar transações planas. Um <I>Daemon</I> local
SnowFlock (SFLD) executa no <I>hypervisor</I> e atende tais
requisições. As mensagens são desordenadas <SPAN STYLE="background: #ffff00">(unmarshalled)</SPAN>,
executadas, e as solicitações são enviadas de volta.</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">Os
programas podem controlar diretamente a clonagem de MV através da
API, que esta disponível para C, C++, Python e Java. <I>Shell
scripts</I> <SPAN STYLE="font-style: normal">que aproveitam a
execução de um programa podem utilizar, em vez disso, </SPAN><I>scripts</I>
<SPAN STYLE="font-style: normal">fornecidos de linha de comando.
Estruturas paralelas tal como MPI podem incorporar a API: programas
MPI podem então usar o SnowFlock, mesmo sem saber, e sem
modificações à sua fonte. Balanceadores de cargas reunidos na web
ou em servidores de aplicação podem utilizar a API para clonar os
servidores que gerenciam.</SPAN></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif"><SPAN STYLE="font-style: normal">SFLDs
orquestram a execução das solicitações de clonagem de MV. Eles
criam e transmitem descritores de arquitetura, criam MVs clonadas,
iniciam discos e servidores de memória, e iniciam processos de
ajudantes </SPAN><I>memtap</I><SPAN STYLE="font-style: normal">. Eles
são uma miniatura de sistema distribuído encarregados de gerenciar
as MVs em um </SPAN><I>cluster</I> <SPAN STYLE="font-style: normal">físico.</SPAN></FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">SFLDs
adiam decisões de alocação para um Daemon SnowFlock mestre
central(SFMD). SFMD simplesmente comunica com o <I>software</I>
adequado de gerenciamento de <I>cluster</I>. Nós não vimos qualquer
necessidade de reinventar a roda aqui, e as decisões adiadas na
alocação de recursos, quotas, políticas, etc, para o software
adequado, tal como Sun Grid Engine ou a plataforma EGO.</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">18.7.2.
Mutações necessárias</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><BR><BR>
</P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">Após
a clonagem, a maioria dos processos de MVs clonadas não fazem ideia
de que eles não são mais os pais, e que eles estão agora em
execução em uma cópia. Na maioria dos aspectos, isso só funciona
bem e não causa nenhum problema. Após tudo, a principal tarefa do
SO é isolar aplicações de detalhes de baixo nível, tal como a
identificação de rede. Não obstante, fazendo a transição
suavemente requer um conjunto de mecanismos para ser inserido no
lugar. O núcleo do problema esta em gerenciar a identidade das redes
de clones; para evitar conflitos e confusão, devemos introduzir
leves mutações durante o processo de clonagem. Também, devido a
estes ajustes, podem exigir acomodações de alto nível, um gancho é
inserido para permitir ao usuário configurar qualquer tarefa
necessária, tal como (re)montagem de sistemas de arquivos de rede
que dependem da identidade do clone.</FONT></FONT></P>
<P ALIGN=JUSTIFY STYLE="widows: 2; orphans: 2"><FONT COLOR="#000000"><FONT FACE="arial, sans-serif">Os
clones são criados para um mundo que na maioria das vezes não os