Consider a scenario in which several processes compete for access to the same resource (e.g., a file or some memory address). When a process is starved due to resource unavailability, a timer is used to stop (i.e., kill) the process after a predetermined time interval. Once the process is terminated, attempt to gain access to the desired resource. For example, a user could be prompted programmatically to check if a process is not available, and if not available, then the process could be terminated. This would simulate the same process users perform with the Task Manager on Windows or the Activity Manager on the Mac. Create a C program that implements the scenario using two processes that are created using fork(). Print the necessary process data using fprintf to show a log of activities: which processes are running, what resource they are trying to access, whether the resource is available, and whether the process is starved. After analyzing the activity log produced by your program, assess how efficient the use of a timer to solve deadlock situations was. Is the solution scalable to multiple processes and threads? What are the limitations, if any? If you identified problems with this strategy, suggest a different approach and explain why it would be better. If the timer proves to be a successful approach, just state that and no further alternatives need to be explored. Deliverables: Detailed description of the scenario explaining your approach to implementation in C. Include a flowchart that demonstrates the logic of the program. Coding results: An analysis of the program output and the suitability of the approach to deadlock resolution, using the questions in the assignment description as a guide.
Consider a scenario in which several processes compete for access to the same resource (e.g., a file or some memory address). When a process is starved due to resource unavailability, a timer is used to stop (i.e., kill) the process after a predetermined time interval. Once the process is terminated, attempt to gain access to the desired resource.
For example, a user could be prompted programmatically to check if a process is not available, and if not available, then the process could be terminated. This would simulate the same process users perform with the Task Manager on Windows or the Activity Manager on the Mac. Create a C program that implements the scenario using two processes that are created using fork(). Print the necessary process data using fprintf to show a log of activities: which processes are running, what resource they are trying to access, whether the resource is available, and whether the process is starved.
After analyzing the activity log produced by your program, assess how efficient the use of a timer to solve deadlock situations was. Is the solution scalable to multiple processes and threads? What are the limitations, if any? If you identified problems with this strategy, suggest a different approach and explain why it would be better. If the timer proves to be a successful approach, just state that and no further alternatives need to be explored.
Deliverables:
- Detailed description of the scenario explaining your approach to implementation in C.
- Include a flowchart that demonstrates the logic of the program.
- Coding results:
- An analysis of the program output and the suitability of the approach to deadlock resolution, using the questions in the assignment description as a guide.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images