P3L3 Inter Process Communication - Intro Flashcards

1
Q

Visual Metaphor

IPC is like …

List 3 ways IPC is like ..

A

… 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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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 __________.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define Inter Process Communication (IPC)

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

List 2 broad categories of IPC

A

message-based

memory-based

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

List 3 examples of message-based IPC

A

Message-based IPC mechanisms include sockets, pipes, and message queues.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

List 2 examples of memory based IPC

A

unstructured shared memory pages

memory mapped files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

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 ______ ______.

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A request-response interaction between two processes requires a total of ______________________ and ________________________

These overheads are one of the negatives of message-based IPC.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

List one disadvantage of message-based IPC

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

List one advantage of message-based IPC

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How many processes can communicate via a pipe? Explain.

A

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 …)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The following is an example of which type of IPC?

cat /some/really/large/file | grep “needle in a haystack”

A

a pipe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

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.

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Consider using IPC to communicate between processes. Which will perform better:

  • Message-based
  • Memory-based
  • Neither - it depends
A

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.
17
Q

List and describe 3 forms of message passing

A
  1. pipes - stream of bytes pushed into the pipe from one process and read from the pipe by the other process.
  2. 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.
  3. sockets - Socket interface with send and recv operations. Processes send message buffers in and out of the kernel-level communication buffer.
18
Q

True or False?

  1. Byte streams can be piped between processes on different machines.
  2. A message queue can exist between processes on different machines.
  3. Socket-based communication can happen between processes on different machines.
A
  1. False
  2. False
  3. 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.

19
Q

In message-based IPC, CPU cycles are spent to:

  1. _________________________________________

In memory-based IPC, CPU cycles are spent to

  1. __________________________________________
  2. __________________________________________
A

In message-based IPC, CPU cycles are spent to:

  1. copy data to/from ports

In memory-based IPC, CPU cycles are spent to

  1. map physical memory into the address spaces of the processes.
  2. copy the data into the shared address space, but note that there is no user/kernel switching in this case
20
Q

True or False?

Memory-mapping for memory-based IPC is a one-time cost.

A

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.

21
Q

Describe the Local Procedure Calls (LPC) mechanism used in Windows systems in terms of message-based and memory-based IPC

A

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).