Interprocess Communication Flashcards

1
Q

What’s the point of interprocess communication?

A

Processes often need to talk to other processes

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

What are the three key things interprocess communication needs to think about?

A

1) how processes can communicate with other processes
2) making sure processes don’t get in each other’s ways
3) proper sequencing and making sure dependencies are respected

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

Define race condition

A

Where two or more processes are reading or writing some shared data and the final result depends on who runs when

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

What does mutual exclusion allow:

A

that if one process is using a share dvariable or file, another process will not be able to use this fle.

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

Define critical section

A

the part of the program where the shared memory is accessed

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

What are the four conditions to create ensure that processes cooperate correctly?

A

1) No two processes may be inside their critical section
2) No assumptions can be made about speed or number of CPUs
3) No processes running outside critical section may block other processes
4) No process should have to wait forever to enter its critical section

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

What is busy waiting?

A

a technique in which a process repeatedly checks to see if a condition is true

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

what happens when you disable all interrupts?

A

you have a process disable interrupts when it enters its critical section. this means no clock interrupts can occur.

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

once a process has disabled all interrupts what can it do confidently?

A

access and update shared memory

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

give two reasons why is disabling interrupts unattractive?

A

1) if they never turned interrupts back on again, then the CPU would never get a look in
2) if the system has multiple processors, the other processors will not know that the process on another CPU has disabled interrupts. They will keep going as normal.

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

what is the spooler example?

A

when process wants to print a file, it tells the spooler directory
printer daemon checks if there are files to print
spooler has in and out variables
consider a spooler with an empty slot (7) and two files that want to print
item a reads a variable for next space to be 7
process switch immediately happens
item b reads same variable and also sets to 7. it continues and puts an item in 7 and sets next to 8
process switch
item a returns. it then puts a file in 7 and sets next space to 8
== item b has been overwritten

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

what are lock variables?

A

a software solution
process setting a lock variable to 1.
process enters the critical section

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

why are lock variables janky?

A

same idea as spooler directory
if one process reads lock as 0 and gets ready to make it 1, then process switches to something else and then THAT process also sets something to 1, then you’ll find yourself in the critical section for two process. NOPE.

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

define busy waiting

A

continuously testing a variable until some value appears

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

why should busy waiting be avoided?

A

wastes CPU time

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

what is a lock that uses busy waiting called?

A

spin lock

17
Q

why is strict alternation not a good idea?

A

because you can’t assume the speed of a program. it is only sound if they are balanced.

18
Q

what kind of violation can happen with strict alternation?

A

a process wanting to enter its critical section is not allowed to enter its critical section.

19
Q

What does Peterson’s solution combine?

A

taking turns and lock variables

it uses the idea of ‘interested’ in code blocks

20
Q

define the priority inversion problem

A

where a low priority process and a low priority process are flipped. The means the low priority process is running and the high priority process is waiting

21
Q

what is the producer-consumer problem?

A

two processes
producer / consumer
producer generates data and puts on buffer
consumer takes items off buffer

22
Q

where does trouble arise for producer-consumer problem?

A

When the buffer is full and the producer then needs to sleep.
If the buffer is empty and the consumer wants to take something from it.

23
Q

what is the problem with the producer-consumer problem?

A

consumer sees the buffer is empty
then the scheduler interrupts
producer sees the buffer is empty.
producer generates an item for the buffer.
producer sees count is 0 and wakes consumer.
but consumer is not asleep.
consumer keeps reading count, sees 0, actually goes to sleep.

24
Q

define atomic operation

A

a process that is indivisible. guaranteed to be isolated from other operations that may be happening at the same time