OS unit 3 and 4 Flashcards

(11 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

What is memory management in an operating system?

A

Memory management in an operating system (OS) refers to the process of controlling and coordinating computer memory, assigning portions called blocks to various running programs to optimize overall system performance.
Allocation, Deallocation
Tracking
Protectio
Paging and Segmentation

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

Fixed partitioning | Dynamic partitioning (adv disadv)

A

Dynamic -
adv: efficient, better utilization, flexible allocation
disadv: external frag, complex management, compaction overhead

Fixed-
adv: simplicity, fast allocation, low overhead
disadv: internal frag, limited flexibility, static nature

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

Buddy system

A

It is a memory allocation technique used in operating systems to manage memory efficiently and reduce fragmentation.
- Total memory is treated as a single block of size 2^U
- A minimum block size 2^L
adv: reduce fragmentation, fast merging, efficient splitting
disadv: complexity, internal frag

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

Why is relocation in memory management necessary?

A

1 Multiprogramming: Multiple processes to coexist in memory.
2 Dynamic memory allocation: Programs can be moved during execution.
3 Efficient memory use: OS can relocate processes to compact free space.
Types:
Static (compile time), Dynamic (run time)

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