notes14

notes14 - Lab 5 client process->(RPCShared)<-server process...

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

View Full Document Right Arrow Icon
Lab 5 client process----->(RPCShared)<-----server process Shared Memory RPCServer :: RPCServer ( fileName ) { //open file with O_RDWR | O_CREAT | O_TRUNC use MOD 0666 or 0664 //mental note to self not sure about the trunc //fd is file descriptor //fill the file of size sizeof(RPCShared) with nothing //lseek to the end , then write "" n let the OS take care of it for u //memory map (mmap) the created file //set flag to Shared //type cast the return in to RPCShared* //initialize the RPCShared //semaphores initialization, initialize empty n full //use USYNC_PROCESS //initialize the available list //set available to 0 //initialize the service to -1 //call buffers waiting for service are synchronized by the empty semaphore. //initialize the _done semaphore for each call buffer. } RPCClient :: RPCClient ( fileName ) { //open the file with Read/write //do not create new file !!! //memory map the file using mmap //exact same syntax with the one above //close the file descriptor } RPCClient :: call ( char * rpcName , RPCArgument args , RPCResult result )
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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 / 3

notes14 - Lab 5 client process->(RPCShared)<-server process...

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

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