Изменения

Перейти к: навигация, поиск

Распределённый алгоритм для WCP

620 байт добавлено, 02:52, 29 апреля 2018
Псевдокод
Работа $i$-го монитор-процесса описана следующим псевдокодом. Гарантируется: когда переменная $detect = true$, мы получим искомый срез.
=== Псевдокод ===
   '''var''' <font color="green"> // vector clock from the candidate state</font> candidate: array[1..n] of integer initially 0; Upon receiving the token (G, color) '''while''' (color[i] = red) '''do''' receive candidate from application process P '''if''' (candidate[i] > G [i]) '''then''' G [i] := candidate[i]; color[i] := green; '''for''' j := 1 '''to''' n, (j != i) '''do''' '''if''' (candidate[j] >= G [j]) '''then''' G [Файлj] :Proc_algo.png= candidate[j]; color[j]:= red; '''if''' (<tex>\exists j</tex>: color[j]= red) '''then''' send token to <tex>M_j</tex> ; '''else''' detect := '''true''';
64
правки

Навигация