Question
1. Consider three processes, P, Q and R with the following code: P: ps1; ps2; ps3; ps4; Q: qs1; qs2; qs3; qs4; R: rs1; rs2;
1. Consider three processes, P, Q and R with the following code:
P: ps1; ps2; ps3; ps4; Q: qs1; qs2; qs3; qs4; R: rs1; rs2; rs3; rs4;
These processes have the following synchronization constraint: a) rs1 must be the first statement to execute b) process R should be the last process to exit c) ps3 must execute after qs2 d) qs3 must execute after ps4 and rs3 e) rs4 must execute after either ps4 or qs4 (or both) have executed
Using semaphores, provide updated codes for P, Q and R that satisfy these constraints.
Can someone please explain why this is the answer?
Problems: [40 Points] 1. Solution: Process P Process Q Process R wait(&s1 ps1> wait(&s1) s1 = 0 s2=0 s3 =-1 S4 0 S5--1 rs1> signal(&s1) signal(&s1 Srs2> ps2> wait(&s2)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started