Applications of Semaphores

Applications of Semaphores - RPC- Remote Procedure Call...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Applications of Semaphores: Remote Procedure Call RPC- Remote Procedure Call Assume we have two threads: A client and a server thread. A client thread fills up some arguments and wakes up a server thread. The client waits until the results from the server are ready. The server Wait until there is a cliet request wakes up, calls the function (Addition in this case) and it stores the results. T
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Remote Procedure Call Client Server ----------------- ------------------------ while (1) { // wait for incoming calls mutex_lock(&_mutex); //Copy arguments _A = 3 _B = 2; //Wake up server sema_post(&_service_sem); sema_wait(&_done_sem); // Server wakes up. Do function
Background image of page 2
You will use this approach in Lab 5 to communicate two or more processes using semaphores in shared memory but you will allow multiple threads in the server instead of only one.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/30/2012 for the course CS 354 taught by Professor Staff during the Fall '08 term at Purdue.

Page1 / 6

Applications of Semaphores - RPC- Remote Procedure Call...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online