Shared memory, pipes, and FIFOs (named pipes) are methods for interprocess communication (IPC). Shared memory allows processes to access the same memory region, so a change by one process is visible to others. Pipes allow unidirectional communication between processes by writing data to one end and reading from the other. FIFOs are named pipes that allow any process to open a pipe. The document provides examples of using shared memory, pipes, and FIFOs for IPC and assigns programming tasks to implement these IPC methods.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
26 views9 pages
4.1 Interprocess Communication
Shared memory, pipes, and FIFOs (named pipes) are methods for interprocess communication (IPC). Shared memory allows processes to access the same memory region, so a change by one process is visible to others. Pipes allow unidirectional communication between processes by writing data to one end and reading from the other. FIFOs are named pipes that allow any process to open a pipe. The document provides examples of using shared memory, pipes, and FIFOs for IPC and assigns programming tasks to implement these IPC methods.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9
Interprocess Communication
Shared Memory, Pipes and FIFO
Topics • Shared Memory • Pipes • FIFO (Named Pipes) Shared Memory • Simplest & Fastest method for IPC • Shared memory allows two or more processes to access the same memory. • When one process changes the memory, all the other processes see the modification. • Access to this shared memory is as fast as accessing a process’s non-shared memory • and it does not require a system call or entry to the kernel. • It also avoids copying data unnecessarily. • Because the kernel does not synchronize accesses to shared memory, you must provide your own synchronization Programing Assignment Shared Memory
• Write three programs to use shared memory.
• Write – One application to generate data and show results. – One to sum and print result – One to multiply and print data. Pipes • A pipe is a communication device (serial) that permits unidirectional communication. • Data written to the “write end” of the pipe is read back from the “read end.” • used to communicate between two threads in a single process or between parent and child processes. Pipes • A pipe’s data capacity is limited. • If the writer process writes faster than the reader process consumes the data, and if the pipe cannot store more data, the writer process blocks until more capacity becomes available. • If the reader tries to read but no data is available, it blocks until data becomes available. • Thus, the pipe automatically synchronizes the two processes. Programing Assignment Pipes – Implement programming examples given in reading handout. – Implement Circular Token Passing mechanism using Pipes among threads or parent/child process chain. FIFO ( Names Pipes ) • A first-in, first-out (FIFO) file is a pipe that has a name in the file system. • Any process can open or close the FIFO. • The processes on either end of the pipe need not be related to each other. • FIFOs are also called named pipes. Programing Assignment Named Pipes – Implement programming examples given in reading handout. – Implement Circular Token Passing mechanism using Pipes among 4 to 5 independent Processes.