You are on page 1of 4

Chapter 3 problems

Problem 1 :

+ Chorme browser

+ Virtual private server (VPS)

+ Operating system (Android, linux,…)

+ TIPC

+ DCOP

Problem 2 :

+ Chatting apps that need to sync on multiple devices (Messenger, Zalo)

+ Data storing apps that need to sync on multiple devices (Google Drive, One
Drive)

+ Managing accounts, in-game progress in online videogames (Steam)

+ Managing playlists, favourites and preferences in subscription services (Spotify,


netflix)

+ Managing searching history of browsers (Chorme, Microsoft Edge)

Problem 3 :
Problem 4 :

int n // number of processes

int nDone = 0 // number of done processes

Lock lock = new Lock() // update nDone

Semaphore barrier = new Semaphore(0) // to open or close barrier

lock.lock(); // lock nDone

nDone = nDone + 1; // count finished process

if (nDone == n) open.up(); // if all process is finish, let all through

lock.unlock(); // unlock nDone

barrier.down(); // proceed when possible

barrier.up(); // let the next one go


Problem 5 :

Devide the bridge into 2 parts, consider each part as a shared resource.

The problem becomes The dining philosophers with 2 philosophers

semaphore bridge[2] //number of bridges

do {

wait( bridge[i] )

wait( bridge[ (i+1) % 2] )

PASSING THE BRIDGE

signal( bridge[i] );

signal( bridge[ (i+1) % 2] )

WAITING FOR THE OTHER GOAT

} while(true);
Problem 6 :

Devide the crossroad into 4 corners, each corner is a shared resource.

Solving process is similar to Problem 5

semaphore corner[4] //number of corner

do {

wait( corner[i] )

wait( corner[ (i+1) % 4] )

VEHICLES PASSING THE CROSSROAD

signal( corner[i] );

signal( corner[ (i+1) % 3] )

WAITING FOR OTHERS VEHICLES TO PASS

} while(true);

You might also like