Please help me get started on this. I know what semaphores are but I don\'t have
ID: 3829876 • Letter: P
Question
Please help me get started on this. I know what semaphores are but I don't have any idea how to start this problem. Please explain step-by-step if possible.
"After each step, give the value of the updated semaphore and the content of the updated semaphore queue.
Couting Semaphores: S1, S3, S6
Binary Semaphores: S2, S4, S5
Smephore Queues: use Priority Scheduling algorithm where: Low Process ID means high priority
Semaphores initial values: S1 = 0, S2 = 1, S3 = 3, S4 = 0, S5 = 1, S6 = 0
1.) P1: P(S3)
2.) P2: P(S5)
3.) P3: P(S1)
4.) P5: P(S4)
5.) P2: V(S5)
6.) P1: P(S6)
7.) P2: P(S4)
8.) P6: V(S3)
9.) P4: V(S4)
10.) P4: P(S6)
11.) P1: V(S5)"
Explanation / Answer
Semaphores initial values: S1 = 0, S2 = 1, S3 = 3, S4 = 0, S5 = 1, S6 = 0
1.) P1: P(S3)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 1, S6 = 0
after 2.) P2: P(S5)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 0, S6 = 0
after 3.) P3: P(S1)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 0, S6 = 0 (p1 is waiting)
after 4.) P5: P(S4)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting)
after 5.) P2: V(S5)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 1, S6 = 0 (p1 is waiting, p5 is waiting)
after 6.) P1: P(S6)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting)
after 7.) P2: P(S4)
S1 = 0, S2 = 1, S3 = 2, S4 = 0, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting, p2 is waiting)
after 8.) P6: V(S3)
S1 = 0, S2 = 1, S3 = 3, S4 = 0, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting, p2 is waiting)
after 9.) P4: V(S4)
S1 = 0, S2 = 1, S3 = 1, S4 = 1, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting, p2 is waiting)
after 10.) P4: P(S6)
S1 = 0, S2 = 1, S3 = 1, S4 = 1, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting, p2 is waiting,p4 is waiting)
11)
S1 = 0, S2 = 1, S3 = 1, S4 = 1, S5 = 0, S6 = 0 (p1 is waiting, p5 is waiting, p2 is waiting,p4 is waiting)
after
11.) P1: V(S5)
S1 = 0, S2 = 1, S3 = 1, S4 = 1, S5 = 1, S6 = 0 (p1 is waiting, p5 is waiting, p2 is waiting,p4 is waiting)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.