#18 Bakery's algorithm | Solving Critical Section Problem | Bakery Algorithm in Process
HTML-код
- Опубликовано: 7 ноя 2024
- Bakery's algorithm example,
Bakery's algorithm pdf,
Lamport bakery's algorithm,
bakery algorithm example,
bakery algorithm in os,
bakery algorithm in os pdf,
bakery algorithm in c,
bakery algorithm code,
#algorithm #bakery #problem
A thumbs up for your clear English.
Thx
It really was short and clear to grab the concept. Hats off for you man.
Good
The braces in the code are incorrectly placed. The actual code is:
lock(i): // Here process i is trying to acquire the lock
choosing[i] = true
token[i] = 1 + MAX(token[0], token[1], ..., token[n-1]) // Here n = number of parallel processes trying to execute the critical section
choosing[i] = false
for(p = 0; p < n; p++):
while(choosing[p]);
while(token[p] != 0 && (token[p], p) < (token[i], i));
done
unlock(i): // Here process i is trying to release the lock
token[i] = 0;
done
@@pratikkumarbulani8903 thanks
Should it be - while ( choosing[j] ); 👈
It is confusing without the locks - I think the locks are the key
Can you send me the link of PPT which is used in these videos