Question: # Three Processors is s synchorinzed using two semaphores, S 1 nad S 2 , as shown below. # Process A: Process B: Process C:

# Three Processors is s synchorinzed using two semaphores, S1 nad S2, as shown below.
# Process A: Process B: Process C:
# semWait(S2) semwWait(S1) semSignal(S2)
# semWait(S2) semWait(S2) x=x*5
# x=3*x+4 x=x-5 semSignal(S2)
# semSignal(S1) semSignal(S1)
# semSignal(S2) semSignal(S2)
# Both semaphores (S1 and S2) are initialized to zero and they are used only in the sections of the code shown below. If the variable x is defined as an integer shared variable,
# initialized to 1, and is not assigned a value in any other sections of the code except thoses shown above, what will be its value when all processes have finished? Also find the values for S1, S2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!