IPC Flashcards

1
Q

Pipe Characteristics

A
  1. Uses a buffer in the kernel
  2. Unidirectional
  3. Byte Stream
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What happens if you try to write to a pipe more bytes than PIPE_BUF can store

A

it may be non-atomic

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

What is returned by ‘read’ when the write end is closes by all processes

A

read() returns 0

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

Why use a FIFO

A

Unrelated processes can’t use a pipe

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

FIFO vs pipe

A

A FIFO is a ‘named pipe’ similar to a UNIX domain socket

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

Message Queue vs FIFO

A

message queues can be used to send structured data i.e. a struct/union instead of a byte stream

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

File mapping vs. Anonymous mapping

A

File mapping - maps a file to a memory region, allows us to write to files w/out read/write (memory-mapped file)

Anonymous mapping - another way to allocate memory to a process

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

Shared vs. Private memory mapping

A

Shared - create a file/anonymous mapping then fork, parent/child will share the same mapping

Private - each process has a private copy

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

Private file mapping

A

Each process gets its own copy in memory of the file, but changes won’t be written to the actual file

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

Private anonymous mapping

A

More memory gets allocated to the calling process, fork() copies the memory but each process has a private copy

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

Shared file mapping

A

A file is mapped to a process as shared mapping, all changes will be propagated across all files and will be written to the actual file

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

Shared anonymous mapping

A

More memory gets allocated to the calling process, memory is shared and changes are propagated across processes

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

mmap flags for shared memory

A

MAP_SHARED | MAP_ANONYMOUS

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

Shared memory

A

allows sharing memory across unrelated processes

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