Consider the following algorithm for mutual exclusion for 3 processes using semaphores. /* Program Mutual Exculsion */ s

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Consider the following algorithm for mutual exclusion for 3 processes using semaphores. /* Program Mutual Exculsion */ s

Post by answerhappygod »

Consider The Following Algorithm For Mutual Exclusion For 3 Processes Using Semaphores Program Mutual Exculsion S 1
Consider The Following Algorithm For Mutual Exclusion For 3 Processes Using Semaphores Program Mutual Exculsion S 1 (349.02 KiB) Viewed 28 times
Consider the following algorithm for mutual exclusion for 3 processes using semaphores. /* Program Mutual Exculsion */ semaphore s=2; void R (int i) While (true) { P (s); * critical section *; V (S); * remainder *; } Void main () { Parbegin (R(1), R(2), R(3)); Suppose we have 3 processes R1, R2 and R3 competing for the same critical section and we are using a semaphore s as declared in the algorithm. Complete the table below that shows how the processes execute. The focus of this table is only on how s changes as the semaphore is used and the order in which the processes call P and V. It can be seen from the table that R3 calls P first followed by R1 then R2. You need to indicate the order in which V is called and the value of s after each call, indicating which processes, if any, blocked in the queue. Explain your answer and reasoning. Instruction Performed R3: P (S) R1: P(S) R2: P (S) Values of S Blocked Queue: 82
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply