Presentation is loading. Please wait.

Presentation is loading. Please wait.

INTER-PROCESS COMMUNICATION

Similar presentations


Presentation on theme: "INTER-PROCESS COMMUNICATION"— Presentation transcript:

1 INTER-PROCESS COMMUNICATION
JAKKIDI TEJA SRI

2 Contents Introduction Signals Pipe FIFO Semaphore Shared Memory
Conclusion

3 Introduction Inter Process Communication (IPC) is a process in which data is transferred between the processes. Applications can use IPC, categorized as clients and servers, where the client requests data and the server responds to client requests.   On modern systems, IPCs form the web that bind together each process within a large scale software architecture.

4 Different types of ipc:
Signals PIPE FIFO Semaphore Shared Memory

5 Signals . Signals are one of the oldest form of IPC mechanisms which are used to signal asynchronous events to one or more processes. Signals are also used by shells to signal job control commands to their child processes Linux is POSIX compatible and so the process can specify which signals are blocked when a particular signal handling routine is called.

6 Signal Handling mechanism

7 SAMPLE PROGRAM USING SIGALRM

8 PIPE Pipes can be setup and used only between processes that share parent- child relationship. A pipe has two ends associated with a pair of file descriptors - making it a one-to-one messaging or communication mechanism. One end of the pipe is the read-end which is associated with a file- descriptor that can only be read, and the other end is the write-end which is associated with a file descriptor that can only be written.

9 SAMPLE PROGRAM OF PIPE:

10 FIFO These are also called as named pipes. Unlike a regular pipe, a named pipe can be used by processes that do not have to share a common process and the message sent to the named pipe can be read by any authorized process that knows the name of the named pipe. When processes are exchanging data via the FIFO, the kernel passes all data internally without writing it to the filesystem.

11 SAMPLE PROGRAM

12 Semaphores Semaphores are used to coordinate access to a resource by different processes at same time to avoid conflicts or dead locks. Semaphores can be thought of as simple counters that indicate the status of a resource. This counter is a protected variable and cannot be accessed by the user directly. Semaphores locks or unlocks critical section data common to different processes for avoiding deadlocks

13 SAMPLE PROGRAM

14 SHARED MEMORY Shared memory is a common block of memory that is mapped into the address space of 2 or more processes. Information that a process writes to a location in shared memory can be read by other process using shared memory. You can use shared memory to allow any process to dynamically define a new block of memory that is independent of the address space created foe the process before it begin to execute.

15 SAMPLE PROGRAM

16 CONCLUSION IPC is a set of programming interfaces that allow a programmer to coordinate activities among different program processes that can run concurrently in an operating system. This allows a program to handle many user requests at the same time. Since even a single user request may result in multiple processes running in the operating system on the user's behalf, the processes need to communicate with each other. The IPC interfaces make this possible.

17 THANK YOU


Download ppt "INTER-PROCESS COMMUNICATION"

Similar presentations


Ads by Google