🙃Hey there, I am working on system programming for the last weeks, and I'm trying to grasp some major concepts.
I am writing C in Linux OS.
P1 process code:
P2 process code:
P3 process code:
I have achieved to use P and V semaphores to print PIZZA once with the code below:
What if I want to use the same 3 semaphores to print :
(forever).
Thanks in advance. ✌
I am writing C in Linux OS.
P1 process code:
Code
while(true){
print(P)
print(I)
}P2 process code:
Code
while(true){
print(Z)
}P3 process code:
Code
while(true){
print(A)
}I have achieved to use P and V semaphores to print PIZZA once with the code below:
Code
var Σ12, Σ13, Σ23: semaphores;
Σ12:= Σ13:= Σ23:= 0;
cobegin
begin Δ1; V(Σ12); V(Σ13); end;
begin P(Σ12); Δ2; V(Σ23);end;
begin P(Σ13);P(Σ23); Δ3;end;
coendWhat if I want to use the same 3 semaphores to print :
Code
PIZZAPIZZAPIZZAPIZZA.......Thanks in advance. ✌

