Lec05_notes - CMPSCI 377 Operating Systems Fall 2008...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CMPSCI 377 Operating Systems Fall 2008 Lecture 5: Feb 2 Lecturer: Prashant Shenoy TA: Vimal Mathew & Tim Wood 5.1 Interprocess Communication Inter-Process Communication (IPC) is a set of techniques for the exchange of data among two or more threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC techniques are divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). The method of IPC used may vary based on the bandwidth and latency of communication between the threads, and the type of data being communicated. 5.1.1 Producer and Consumer The producer and consumer problem is one where two processes must coordinate to exchange data. In this system, a producer process is periodically creating new data elements and consumer process is waiting for these data items to be created and is using them for some other task. In order for this system to function, the producer and consumer require a communication process to allow them to coordinate when the producer has created a new item so that the consumer can successfully read the data. Such a system can be built using either message passing or a shared memory approach. 5.1.2 Message Passing Message passing is a form of communication used in interprocess communication. Communication is made by the sending of messages to recipients. Each process should be able to name the other processes. The producer typically uses send() system call to send messages, and the consumer uses receive() system call to receive messages. These system calls can be either synchronous or asynchronous, and could either be between processes running on a single machine, or could be done over the network to coordinate machines in a distributed system. This allows the producer to transfer data to the consumer as it is created. 5.1.3 Shared Memory Shared Memory is an OS provided abstraction which allows a memory region to be simultaneously accessed by multiple programs with an intent to provide communication among them. One process will create an area in RAM which other processes can access (this is typically done using system calls mmap , shmget etc). Normally the OS prevents processes from accessing the memory of another process, but the Shared Memory features in the OS can allow data to be shared. Since both processes can access the shared memory area like regular working memory, this is a very fast way of communication (as opposed to other mechanisms of IPC). On the other hand, it is less powerful, as for example the communicating processes must be running on the same machine (whereas other IPC methods can use a computer network), and care must be taken to avoid issues if processes sharing memory are running simultaneously and may try to edit the shared buffer at the same time....
View Full Document

This note was uploaded on 09/30/2010 for the course CS 377 taught by Professor Corner during the Fall '08 term at UMass (Amherst).

Page1 / 4

Lec05_notes - CMPSCI 377 Operating Systems Fall 2008...

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