Preview

Skema Jawapan Operating System

Good Essays
Open Document
Open Document
935 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Skema Jawapan Operating System
Answer Scheme for Test 2 Operating System 1. a) What is synchronization? (1m) - Synchronization is an act of ensuring that independent processes/threads begin to execute a designated block of code at the same time b) How does a race condition happen? (2m) - Incorrect timing in accessing same shared resource c) Explain TWO possible solutions of handling critical section?(2m) - Disabling interrupt prevents processes/threads to be in the critical section at the same logical time - Software solution : locking mechanism, semaphore, monitor d) Draw the graph reduction (with your explanation) when there is no deadlock.(4m) - R1 and R3 are reusable resource graph (RRG) whereas R1 is a consumable resource graph(CRG) Order of reduction: i) Assign R1 to p1, p1 executes and terminates. One unit of R2 and 2 units of R3 are available.

P1

P2

R3
P3

R2
P4

R1

ii) Assign a unit of R3 to P3 and another unit of R3 to P2.

P1

P2

R3
P3

R2
P4

R1

Good luck for your final examination!! –Zima167-

iii) P3 terminates and can produce more units of R2. Since P3 is the producer of R2, unit of R2 is infinity.

P1

P2

R3
P3

R2
P4

R1

iv) Now, a unit of R2 is assign to P2 and P4, so that both can terminate. Notice that two units of R2 are missing, this is because P2 and P3 consumes the resources.

P1

P2

R3
P3

R2
P4

R1

v) Lastly, all processes had received the resources needed, the graph is reducible. Thus, no deadlock.

P1

P2

R3
P3

R2
P4

R1

e) Describe TWO ways of preventing deadlock. (2m) - Preempt resource use numbering in circular wait Hold & wait (get all resources at once or release all resource before requesting) f) What is the difference between deadlock and starvation.(2m) - Endless vs indefinite waiting Good luck for your final examination!! –Zima167-

2. a) What is the difference (in terms of address) between relocatable object module and absolute program? (1m) - Relocatable object module

You May Also Find These Documents Helpful