Inter Process Communication

Topics: Inter-process communication, Process, Internet socket Pages: 33 (6040 words) Published: June 6, 2010
Baghdad University
Collage of Science
Computer Science Department

InterProcess Communication


A modern Multiprogramming Operating Systems like Linux supports the creation and concurrent execution of multiple processes or threads. Some will act independently of others, but most will need to cooperate with each other. There are several reasons for providing an environment that allows process cooperation[1]: • Information sharing. Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information. • Computation speedup. If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others. Notice that such a speedup can be achieved only if the computer has multiple processing elements (such as CPUs or I/O channels). • Modularity. We may want to construct the system in a modular fashion, dividing the system functions into separate processes or threads. • Convenience. Even an individual user may work on many tasks at the same time. For instance, a user may be editing, printing, and compiling in parallel.

Cooperation between processes/threads includes making sure that processes/threads do not interfere with each other, i.e. they must synchronize their access to shared resources. And includes passing information between processes/threads, i.e. provide communication mechanism. Process cooperation can be achieved by interprocess communication mechanisms.

2.InterProcess Communication
InterProcess Communication, which in short is known as IPC, deals mainly with the techniques and mechanisms that facilitate communications between processes, these communications preferably in a well-structured way not using interrupts, because interrupts decrease system performance[2]. IPC was introduced in a development UNIX variant called "Columbus Unix" and later adopted by AT&T's System III. It is now commonly found in most UNIX systems, including GNU/Linux. IPC denotes a set of system calls that allows a User Mode process to[3]: 1. Synchronize itself with other processes by means of pipes and semaphores. 2. Send messages to other processes or receive messages from them. 3. Share a memory area with other processes.

Some of the basic mechanisms that Linux systems has to offer are: 2.1. Shared Memory
Amongst all the IPC mechanisms, the most useful is the shared memory segment. Shared memory allows two or more processes within the same system to access some common data structures by placing them in a shared memory segment(see figure 1). This is by far the fastest form of IPC, because there is no intermediation (i.e. a pipe, a message queue, etc). Instead, information is mapped directly from a memory segment, and into the addressing space of the calling process. A segment can be created by one process, and subsequently written to and read from by any number of processes[3,4]. [pic]

Figure 1:Shared Memory Mechanism

The shmget() function is invoked to get the IPC Identifier of a shared memory segment, optionally creating it if it does not already exist. Then, shmat() function is invoked to "attach" a shared memory segment to a process, it then receives as its parameter the identifier of the IPC shared memory resource and tries to add a shared memory region to the address space of the calling process. The calling process can require a specific starting linear address for the memory region. The function shmat() however, leaves the process's page tables unchanged. Another function, shmdt() is invoked to "detach" a shared memory segment specified by its IPC Identifier, that is, to remove the corresponding memory region from the process's address space(see table 1). Detaching a shared memory segment using shmdt() function does not delete the shared memory segment, It just...

References: ……………………………………………………….. 24
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about Interprocess Communication
  • Essay on Process of Communication
  • Communication Process Essay
  • Communication Process Essay
  • Introduction to Organizational Communication Essay
  • Essay about The Nature of Oral Communication
  • Process Management in Linux Essay
  • Essay on Communication Process

Become a StudyMode Member

Sign Up - It's Free