OS Flashcards

(8 cards)

1
Q

Define concurrency in the context of process/thread synchronization.
What is mutual exclusion in operating systems?

A

Concurrency: Multiple processes/threads simultaneously
Mutex: prevents multiple processes from entering in critical state at the same time
Utilized using sempahores and locks
Characteristics:
1 One process in CS at a time
2 Other processes wait
3 Used to prevent deadlocks and race condition

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

Conditions for deadlock. Break down the strategies used for deadlock prevention into their core principles.

A

1 Mutual Exclusion (shareable resources or multiple instances of one resource)
2 Hold and wait (requests all required resources before execution)
3 No pre-emption (allow pre-emption)
4 Circular Wait (ordering of resource types - allow according to enum number)

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

What is the Ostrich Algorithm in the context of deadlock?
List the necessary conditions for a deadlock to occur.

A

The Ostrich Algorithm is a non-preventive approach to handling deadlocks.
Used When: Deadlocks are extremely rare and the cost of prevention, detection, or recovery outweighs the impact of the deadlock itself.

Typical Use Case: UNIX or Windows, where deadlocks may occur very infrequently, and system reboot or manual intervention can resolve them.

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

Critical section problem prevention

A

Mutual Exc
Progress (no forcing each other)
Bounded Wait (No indefinite time)

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

H/W | S/W mutex

A

H/W
Adv: Faster execution, low overhead, reliability
Disadv: limited protability, h/w dependence

S/W
Adv: portability, felxibility, easy to implement
Disadv: higher overhead, more prone to error

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

Semaphore | Monitor

A

1 controls access to shared resources | high-level synch method for shared resources
2 low-level synch primitive | high-level synch primitive
3 complex to implement | easy due to encapsulation
4 manual resource management | automatic resource management
5 does not provide mutex inherently | provides through lock mech
6 can implemented in both h/w, s/w | implemented using lock and combination values
7 uses explicit signal and wait | uses implicit signal through condition variables

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

mutex | semaphore

A

1 allow only one process to access | allow access to shared resources
2 only one process can lock | counting lock multiple processes can
3 owned by process that locks it | no ownership
4 binary | can have counting value
5 protects critical section | manage shared resources
6 operations: lock and unlock | operations: signal and wait
7 can lead to starvation | less prone to starvation due to fifo
8 simple to implement | complex to implement

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