Homework 4 Solution

$29.99 $18.99

(25pts) 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. (25) Prove the correctness or give a counter-example for each of the following statements. You must state whether the statement is true or false and…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

Rate this product
  1. (25pts) 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.

  1. (25) Prove the correctness or give a counter-example for each of the following statements. You must state whether the statement is true or false and then show your arguments.

    1. deadlock cycle

    2. cycle deadlock

    3. knot deadlock

    4. deadlock knot

  1. (25pts) 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

4

1

4

3

1

4

C =

5

6

13

1

1

6

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

0

1

4

2

0

1

A =

1

2

1

1

0

3

where Ai,j denotes the units of resources of type j currently allocated to process i. For the state shown above:

  1. determine if the current state of the system is safe.

  2. determine if a request by process 1 for 1 unit of resource 1 can be safely granted.

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

  1. (25) Consider the following set of five processes where arrival is the time the process became ready, t is the total service time, and e is the external priority. Assume that execution starts immediately at time 0 and there is no context switch overhead.

process

arrival

t

e

p0

0

80

9

p1

15

25

10

p2

15

15

9

p3

85

25

10

p4

90

10

11

For the following scheduling disciplines, draw a time diagram showing when each of the five processes executes. (In the case of a tie, assume that the process with the lower process number executes first.) Calculate the average waiting time for each of the scheduling disciplines.

  1. FIFO

  2. SJF

  1. SRT

  2. RR (quantum = 10)

  3. ML (using FIFO at each priority level)