1. Write a short program in C/C++ that creates two processes that deadlock. You MUST remove the deadlocked processes from the system (kill -9) once you have completed your experiments.
2. Recall that for the Shortest Remaining Time (SRT) scheduling discipline, the priority function P= -(t-a), where (t-a) is the remaining time; the decision mode is preemptive; and the arbitration rule is chronological or random among process with the same time to completion. Now, consider a scheduling discipline called Longest Remaining Time (LRT) which has the same decision mode and arbitration rule as SRT, but with a priority function of P=(t-a). Given the set of three processes listed below, which of these two scheduling disciplines will result in less overhead due to context switching? You must explain your answer. (Hint: You may choose to draw timelines or Gantt Charts as part of your answer.)
3. Consider the following maximum-claim reusable resource system with four processes (P0, P1, P2, P3) and three resource types (R0, R1, R2). The maximum claim matrix is given by see image.
where Cij denote maximum claim of process i for resource j. The total number of units of each resource type is given by the vector (5, 8, 15). The current allocation of resources is given by the matrix see image.
where Ai,j denotes the units of resources of type j currently allocated to process i. For the state shown above:
a.determine if the current state of the system is safe.
b.determine if a request by process 1 for 1 unit of resource 1 can be safely granted.
c.determine if a request by process 2 for 4 units of resource 2 can be safely granted.
(Note: Processes and Resources start with index 0). You must show your work and justify each of your answers.