Assignment problem Sloving – timelynursingwriters.com

Programming – timelynursingwriters.com

Assignment problem Sloving – timelynursingwriters.com

Assignment-2

problem solving

Q 3.2: Assume at time 5, no system resources are being usedexcept for the processor and memory. Now consider the following events:

At time 5: P1 executes a command to read from disk unit 3.

At time 15: P5’s time slice expires.

At time 18: P7 executes a command to write to disk unit 3.

At time 20: P3 executes a command to read from disk unit 2.

At time 24: P5 executes a command to write to disk unit 3.

At time 28: P5 is swapped out.

At time 33: An interrupt occurs from disk unit 2: P3’s read is

complete.

At time 36: An interrupt occurs from disk unit 3: P1’s read is

complete.

At time 38: P8 terminates.

At time 40: An interrupt occurs from disk unit 3: P5’s write is

complete.

At time 44: P5 is swapped back in.

At time 48: An interrupt occurs from disk unit 3: P7’s write is

complete.

For each time 22, 37, and 47, identify which state each process is

in. If a process is blocked, further identify the event on which it is

blocked.

Q 3.4: For the seven-state process model of Figure 3.9b , draw aqueuing diagram similar to that of Figure 3.8b .

Q.4.4. Consider an environment in which there is a one-to-one

mapping between user-level threads and kernel-level threads that

allows one or more threads within a process to issue blocking

system calls while other threads continue to run. Explain why this

model can make multithreaded programs run faster than their

single-threaded counterparts on a uniprocessor computer.

Q4.5. If a process exits and there are still threads of that process running, will they continue to run?

Q6.5) Given the following state for the Banker’s Algorithm. 6 processes P0 through P5 4 resource types: A (15 instances); B (6 instances) C (9 instances); D (10 instances) Snapshot at time T0:

Available

A

B

C

D

6

3

5

4

Current allocation

Maximum demand

Process

A

B

C

D

A

B

C

D

P0

2

0

2

1

9

5

5

5

P1

0

1

1

1

2

2

3

3

P2

4

1

0

2

7

5

4

4

P3

1

0

0

1

3

3

3

2

P4

1

1

0

0

5

2

2

1

P5

1

0

1

1

4

4

4

4

a. Verify that the Available array has been calculated correctly.

b. Calculate the Need matrix.

c. Show that the current state is safe, that is, show a safe sequence of processes. In addition, to the sequence show how the Available (working array) changes as each process terminates.

d. Given the request (3,2,3,3) from Process P5. Should this request be granted? Why or why not?

Q 6.11 )6Consider a system with a total of 150 units of memory, allocated to three processes as shown:

Process

Max

Hold

1

70

45

2

60

40

3

60

15

Apply the banker’s algorithm to determine whether it would be safe to grant each of the following requests. If yes, indicate a sequence of terminations that could be guaranteed possible. If no, show the reduction of the resulting allocation table.

a. A fourth process arrives, with a maximum memory need of 60 and an initial need of 25 units. b. A fourth process arrives, with a maximum memory need of 60 and an initial need of 35 units.

Q 6.15. Consider a system consisting of four processes and a single resource. The current state of the claim and allocation matrices are: C =3 2 9 7A =1 1 3 2

What is the minimum number of units of the resource needed to be available for this state to be safe?

ORDER NOW