Question: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | /* This code has a problem. It has a critical section that needs to be protected. */ /* compile with gcc problem_job.c -o problem_job */ #include |
1-Theres a problem with the code in problem_job.c . What is it?
2- Change the code in problem_job.c so that the problem is fixed by using a mutex lock. (Use calls to functions such as pthread_mutex_init, pthread_mutex_lock, pthread_mutex_unlock, pthread_mutex_destroy.). Put your fixed program into a file called mutex_fix.c . Show me your new fixed code. Compile and run the new code to show that you have fixed the problem successfully. Add this proof to your homework solution document.
6 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
