Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Processes in a system share three common semaphores, namely, S1, S2, and S3 . At

ID: 3903764 • Letter: P

Question

Processes in a system share three common semaphores, namely, S1, S2, and S3. At a certain instance, the values of the semaphores are:

Process P1 is waiting on S1, no process is waiting on S2, and processes P4 and P5 are waiting on S3 as shown below:

Now a process leaves a critical section and executes an UP on S3. Process P4 then enters the critical section. What will be the values of S1, S2 and S3 when P4 is executing the critical section?

Fig.A Samaphore Tabla Sleeping Semaphore Value Processes 91 P1 83

Explanation / Answer

The table looks like below when process P4 is exceuting the critical section:

Semaphore                   Value           Sleeping Processes

Once S3 will be up then the value field becomes 1. Because in binary semaphore value of resource should be either 0 or 1. When it performs up operation the value becomes 1 and when it performs down operation the value of semaphore becomes 0.

But when P4 enters into critical section the semaphore value become 0 to maintain mutual exclution. Only one process can enter into critical section at time. So once p4 enters into critical section it performs down operation on S3. So value of S3 becomes 0 Which actually avoids inconsistancy.

So Final scenario:

P1 and P5 processes are still waiting for resources. Values for S1,S2 & S3 are 0,3 & 0 respectively.

S1 0 P1 S2 3 None S3 0 P5
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote