Question: 4. Synchronization: warmup This problem is based on the following code (which is similar to Problem 4 of Homework 2): int i = 0; /*

4. Synchronization: warmup This problem is based on the following code (which is similar to Problem 4 of Homework 2): int i = 0; /* ADD SOME THINGS HERE */ void foo(void *) { printf("I am foo!!! "); /* ADD SOME CODE HERE */ } void boo(void *) { /* ADD SOME CODE HERE */ printf("I am boo!!! "); } int main(int argc, char** argy) { create_thread(foo); create_thread(boo); // wait for threads to finish // before exiting join_thread(foo); join_thread(boo); exit(); } Modify the code above to ensure that I am foo!!! prints before I am boo!!!. Use mutexes and condition variables
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
