Question: 1- Write program in C language using Pthreads API to simulate the following IPC problem. Refer to Section 5.9.4 for specific instructions on mutex locks

1- Write program in C language using Pthreads API to simulate the following IPC problem. Refer to Section 5.9.4 for specific instructions on mutex locks and semaphores.

2- If there are multiple files in your submission, you need to provide a makefile.

3- Your program should output/display the design of the project, with specific answers to the following questions.

a. How many threads/processes are there?

b. What does each thread simulate?

c. Will each thread be blocked at some time of simulation? If yes, explain the circumstances.

d. When will a blocked thread be waked up, and by whom?

e. How many semaphores are there in your project, what is the purpose for having each?

4- Make sure to use mutex locks or semaphores to synchronize the threads.

5- Display messages to the screen to show the state of the system. A good way to validate your program running correctly is to perform some simple output messages to show the state of the system. You can experiment with these messages, but in general you want to demonstrate what each thread is doing. You can use an integer number to identify each thread.

6- If your program needs any arguments in command line, you need prompt proper message for the arguments and also validate the input.

7- You may consider how to terminate your program. There are many options. For example, terminate after a given number of students obtaining help. You need to explain this in output messages.

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!