P3L3 Inter Process Communication - Intro Flashcards
Visual Metaphor
IPC is like …
List 3 ways IPC is like ..
… working together in the toy shop
Workers share area (tools)
- data in shared memory
Workers call eachother (explicit requests & responses)
- exchange messages
Workes need synchronization (“I will start a step, once you finish yours”)
- mutexes
Inter process communication (IPC) refers to a set of __________ that the operating system must support in order to permit multiple processes to _______ amongst each other.
This include mechanisms related to _________, __________ and __________.
Inter process communication (IPC) refers to a set of mechanisms that the operating system must support in order to permit multiple processes to interact amongst each other.
This include mechanisms related to synchronization, coordination and communication.
Define Inter Process Communication (IPC)
Inter process communication (IPC) refers to a set of mechanisms that the operating system must support in order to permit multiple processes to interact amongst each other.
This include mechanisms related to synchronization, coordination and communication.
IPC mechanisms are broadly categorized as either _______-based or _______-based.
________-based IPC mechanisms include sockets, pipes, and message queues.
________-based IPC utilizes shared memory. This may be in the form of unstructured shared physical memory _______or memory mapped _______ which can be accessed by multiple processes.
IPC mechanisms are broadly categorized as either message-based or memory-based.
Message-based IPC mechanisms include sockets, pipes, and message queues.
Memory-based IPC utilizes shared memory. This may be in the form of unstructured shared physical memory pages or memory mapped files which can be accessed by multiple processes.
List 2 broad categories of IPC
message-based
memory-based
List 3 examples of message-based IPC
Message-based IPC mechanisms include sockets, pipes, and message queues.
List 2 examples of memory based IPC
unstructured shared memory pages
memory mapped files
In messaged-based IPC, processes create _______ and then send and receive them.
The operating system is responsible for creating and maintaining the _______ that is used to send these messages.
The OS provides an ________ to the processes so that they can send ___________ via this channel. The processes send/write messages to a _____, and then recv/read messages from a _____.
The channel is responsible for passing the message from one ______ to the other.
In messaged-based IPC, processes create messages and then send and receive them.
The operating system is responsible for creating and maintaining the channel that is used to send these messages.
The OS provides an interface to the processes so that they can send messages via this channel. The processes send/write messages to a port, and then recv/read messages from a port.
The channel is responsible for passing the message from one port to the other.
When we send, the data must be copied from the _______ address space into the __________ channel. When we receive, the data must be copied from the __________ channel into the _______ address space.
Since the OS is required to establish the communication and perform each IPC operation, every send and receive call requires a _______ _____ and a ______ ______.
When we send, the data must be copied from the process address space into the communication channel. When we receive, the data must be copied from the communication channel into the process address space.
Since the OS is required to establish the communication and perform each IPC operation, every send and receive call requires a system call and a data copy.
A request-response interaction between two processes requires a total of ______________________ and ________________________
These overheads are one of the negatives of message-based IPC.
A request-response interaction between two processes requires a total of four user/kernel crossings and four data copying operations. These overheads are one of the negatives of message-based IPC.
List one disadvantage of message-based IPC
Since the OS is required to establish the communication and perform each IPC operation, every send and receive call requires a system call and a data copy. When we send, the data must be copied from the process address space into the communication channel. When we receive, the data must be copied from the communication channel into the process address space.
This means that a request-response interaction between two processes requires a total of four user/kernel crossings and four data copying operations. These overheads are one of the negatives of message-based IPC.
List one advantage of message-based IPC
One of the positives of this approach is its relative simplicity.
The OS kernel will take care of all of the operations regarding channel management and synchronization.
How many processes can communicate via a pipe? Explain.
Pipes are characterized by two endpoints, so only two processes can communicate via a pipe.
There is no notion of a message with pipes; instead, there is just a stream of bytes pushed into the pipe from one process and read from the pipe by the other process.
(even though pipes are an example of ‘message-based’ IPC …)
The following is an example of which type of IPC?
cat /some/really/large/file | grep “needle in a haystack”
a pipe
Pipes are characterized by _____ ________, so only two processes can communicate via a pipe.
There is no notion of a message with pipes; instead, there is just a ________ of ________ pushed into the pipe from one process and read from the pipe by the other process.
Messages queues understand the notion of messages that they can deliver. A sending process must submit a _________ __________ message to the channel, and then the channel can deliver this message to the receiving process.
Pipes are characterized by two endpoints, so only two processes can communicate via a pipe.
There is no notion of a message with pipes; instead, there is just a stream of bytes pushed into the pipe from one process and read from the pipe by the other process.
Messages queues understand the notion of messages that they can deliver. A sending process must submit a properly formatted message to the channel, and then the channel can deliver this message to the receiving process.
Consider using IPC to communicate between processes. Which will perform better:
- Message-based
- Memory-based
- Neither - it depends
Neither - it depends.
Both have overhead - need to choose which is least bad for your case ..
- Message-based - OS must perform multiple copies
- Memory-based - OS must map between processes address space and shared memory space.
List and describe 3 forms of message passing
- pipes - stream of bytes pushed into the pipe from one process and read from the pipe by the other process.
- message queues - A sending process sends a properly formatted message to the channel, and then the channel can deliver this message to the receiving process.
- sockets - Socket interface with send and recv operations. Processes send message buffers in and out of the kernel-level communication buffer.

True or False?
- Byte streams can be piped between processes on different machines.
- A message queue can exist between processes on different machines.
- Socket-based communication can happen between processes on different machines.
- False
- False
- True
Socket-based communication can happen between processes on different machines! If the process are on different machines, then the communication buffer is really between the process and the network device that will actually send the data.
In message-based IPC, CPU cycles are spent to:
- _________________________________________
In memory-based IPC, CPU cycles are spent to
- __________________________________________
- __________________________________________
In message-based IPC, CPU cycles are spent to:
- copy data to/from ports
In memory-based IPC, CPU cycles are spent to
- map physical memory into the address spaces of the processes.
- copy the data into the shared address space, but note that there is no user/kernel switching in this case
True or False?
Memory-mapping for memory-based IPC is a one-time cost.
True
The memory-mapping operation is costly, but it is a one time cost, and can pay off even if IPC is performed once.
In particular, when we need to move large amounts of data from one address space to another address space, the time it takes to copy - via message-based IPC - greatly exceeds the setup cost of the setup mapping performed in memory-based IPC.
Describe the Local Procedure Calls (LPC) mechanism used in Windows systems in terms of message-based and memory-based IPC
LPC uses
- memory-based IPC when data is large
- message-based IPC when data is small
The memory-mapping operation is costly, but it is a one time cost, and can pay off even if IPC is performed once……
Windows systems leverage this difference. If the data that needs to be transferred is smaller than a certain threshold, the data is copied in and out of a communication channel via a port-like interface.
Otherwise the data is mapped into the address space of the target process. This mechanism is called Local Procedure Calls (LPC).