Concurrent Processes Flashcards

(8 cards)

1
Q

What are concurrent processes ?

A

Processes that can share physical or logical recourses.

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

What are the problems with concurrent processes ?

A

Race conditions: Two processes accessing/ modifying shared data simulatneously causes inconsistent or lost results.
Critical Region: Section of code where shared recources are accessed (only one process should execute this at time).

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

What is required to help prevent issues ?

A

Mutual exclusion (mutex).

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

What is the main Software-Based Mutex ?

A

Peterson’s Algorithm -
Uses flags and a turn a variable to ensure only one processes enters its critical region at a time,
Prevents race conditions but leads to busy waiting.

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

What is the main Hardware-Based Mutex ?

A

Test-and-set Instruction -
Performs test and assignement atomically (no intervention),
Solves the race condtition but still causes CPU time wastage due to busy waiting.

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

What is a Semaphore ?

A

A protected integer variable used to control access,
Binary semaphore (0 or 1)
Counting semaphore (> 0)

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

What are the two atomic operations of semaphores ?

A

wait() - decrements the semaphore; blocks if <= 0,
signal() - increments and potentially unblocks a waiting process.

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

How do we handle multiple producers and consumers ?

A

Scaling the semaphore logic to allow the multiple producers and consumers to access the buffer concurrently.

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