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.)

  • Process 1 will take 20 cycles and enters the system at time 0.
  • Process 2 will take 15 cycles and enters the system at time 3.
  • Process 3 will take 25 cycles and enters the system at time 7.

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.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.