DOC PREVIEW
Penn CIS 380 - Message Based Communication

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

11CSE 380Computer Operating SystemsInstructor: Insup LeeUniversity of PennsylvaniaFall 2003Lecture Note 2.6: Message-Based Communication2Interprocess communicationq Shared Memoryq Message Passingß Signals23Shard MemoryProcess 1 Process 2 Process 3Shared memory4Shared Memory in Solarisq Processes can share the same segment of memory directlywhen it is mapped into the address space of each sharingprocessq Faster communicationq System calls:ßint shmget(key_t key, size_t size, int shmflg) :creates a new region of shared memory or returns anexisting oneßvoid *shmat(int shmid, const void *shmaddr, intshmflg) : attaches a shared memory region to thevirtual address space of the processßint shmdt(char *shmaddr):detaches a shared regionq Mutual exclusion must be provided by processes using theshared memory35Message Passingmessage6Design Attributesq Namingß Process id, mailboxq Bufferingß Size: zero, bounded, unboundedß Place: kernel space, user spaceq Send operationß Synchronous vs. asynchronousq Receive operationß Blocking vs. non-blocking47Interprocess CommunicationMessage PassingMany possible naming schemes. One is direct naming: send(process_id, message)receive(process_id, buffer)Exampleprocess P1: process P2: declare x integer declare y integer . . send(P2, x) receive(P1, y) . .end process end processEffect of this communication is y := x | \ local var local var of P2 of P18Buffering• A buffer, with bounded-buffer synchronization, can beassociated with each pair of communicating processes.• A “zero-capacity” buffer means processes must “handshake” inorder to communicate.q A buffer can reside in memory of receiving process or in OSaddres space.Examples:q no buffer needed P1: send(P2, x) P2: receive(P1, x) receive(P2, y) send(P1, y)q buffer needed P1: send(P2, x) P2: send(P1, x) receive(P2, y) receive(P1, y)59Mailboxesq Also known as message queues, portsq The explicit and symmetric naming of processes in directnamingq fi Limited modularity since changing the name of a processrequires changes elsewhere, i.e., in definitions of otherprocessesmboxPRP or Q callsend(mbox-id, message)R callsreceive(mbox-id, message)Q10Mailbox Issues• communication is no longer “point-to-point”; e.g., amessage received by R may be from P or Q• “fair merge” property --- do not starve Q from queuingmessages by allowing continual queuing of messagesonly from P• natural extension to multiple receivers. Possiblesemantics:• Multicast to all in the group gets the same message• The first receiver removes it• Bulletin board: each receiver


View Full Document

Penn CIS 380 - Message Based Communication

Download Message Based Communication
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Message Based Communication and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Message Based Communication 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?