Question: In a multiprocessing OS environment, processes p1 and p2 perform a certain operation on the values of saving and current as shown in below table.
In a multiprocessing OS environment, processes p1 and p2 perform a certain operation on the values of saving and current as shown in below table. Initial values Saving = 100 Current=0 P1 SS100/Line Car Carmen - 100 m2) P2 Save Savo Current Comment/ Assume if context switching permissible during execution then compute the values of saving and current for each case listed below and identify under which case(s) the race condition occurs. Also, write a program for the given logic using POSIX APIs to demonstrate how Mutex can eliminate such race condition (1). CASE-1 Execution order: Line 1,2,3,4 (1) CASE-2 Execution order: Line 1,3,4,2 (1) CASE-3 Execution order: Line 3,4, 1, 2 (1) CASE-4 Execution order: Line 3, 1, 2, 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
