You are on page 1of 3

Chapter 3 Problems

PROBLEM 1
List 5 real applications (you haved used) that use IPC

PROBLEM 2
List 5 applications / situations in real worlds that need synchornization

PROBLEM 3
List 5 applications / situations in real worlds that need synchornization

PROBLEM 4
For all the classical synchronization problems, run step by step a certain sequence of instructions among
the processes. Update the state of the used semaphores, and prove such sequence meets all the
requirements of the synchronization constraints.

PROBLEM 5: BARRIER
Barrier is a synchronization problem with the following constraints:

+ We have N processes

+ We need a point at which all the processes MUST reach in order to continue next instructions

An example in the above figure:


+ Figure a) 4 processes runining concurrently

+ Figure b) 3 processes reach the barrier, they MUST wait for process C which hasn’t reached the barrier

+ Figure c) when all the processes reach the barrier, all of them can proceed with their next instructions

Use the semaphore to solve this synchronization problem. Write the program is pseudo-code like those
in the slides Hint: used counting semaphore.

(Ví dụ trong thực tế, chuyến xe bus chở khách du lịch đi về, cần phải đảm bảo mọi người lên xe thì xe
mới khởi hành đi về được)

PROBLEM 6: TWO GOATS GOING OVER THE BRIDGE


Use semaphore to solve the famous story:

+ A narrow bridge which can allow a SINGLE goat to go over

+ Two goats want to go over the bridge.

+ Each goat is on one side of the bridge

PROBLEM 7: CROSSROAD
This is a real-word problem: crossroad is a place where two roads meet and cross each other

Suppose each road has two lanes.

Use semaphore to solve the problem

2
3

You might also like