Question: Part II: [ 5 0 % ] A ) [ 2 5 % ] Write a C program which creates 1 0 threads ( besides
Part II:
A Write a C program which creates threads besides the main thread Each thread
increments a shared counter by one times. Compile and run your program several times
at least runs are recommended Provide screenshots of the output from multiple runs. Discuss
briefly in your report why the final counter value is not consistently as expected.
B: Modify your program from Part IIA to incorporate a mutex lock for synchronizing
access to the shared counter. Ensure that each increment operation on the counter is protected by
the mutex. Capture screenshots showing that the issue identified in Part IIA is no longer
present. In your report, explain how the mutex lock solved the problem.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
