8. Semaphore is a tool of process synchronization. Critical
region is a high-level language construct for process
synchronization. Transform the 'wait' and 'signal' operation on a
semaphore 'S' into equivalent critical regions without busy
waiting. (20 pts.)

9. Consider the following snapshot of a system answer the
following questions using the banker's algorithm

( show your work, 20 pts.)

Process

Allocation

Max

Available

A B C D

A B C D

A B C D

P1

0 0 1 2

0 0 1 2

1 5 2 0

P2

1 3 5 4

2 3 5 6

P3

0 6 3 2

0 6 5 2

P4

1 0 0 0

1 7 5 0

P5

0 0 1 4

0 6 5 6

(a) Is the system in a safe state?

(b) If a request from process P4 arrives for (0, 4, 2, 0) can
the request be granted immediately?

10. Mutual exclusion can be provided by using Lock and
Unlock functions as follows