/
AI Flashcards
Save to my account
Sign up
AI Flashcards
Deadlock and Memory Management in OS
Study
1
Question
What is a deadlock in an operating system?
Answer
A set of processes blocked, each holding a resource and waiting for another held by another process.
2
Question
Name the four necessary conditions for deadlock.
Answer
Mutual exclusion, Hold and wait, No preemption, Circular wait
3
Question
What is the Dining Philosophers problem used to illustrate?
Answer
Resource sharing issues like deadlock, starvation, and mutual exclusion in concurrent programming
4
Question
How can deadlock be prevented?
Answer
Break one of the four conditions (e.g., prevent hold and wait)
5
Question
What does deadlock avoidance aim to do?
Answer
Keep the system in a safe state by planning resource allocations
6
Question
What is the Banker’s algorithm used for?
Answer
Safe-state checking to avoid deadlocks during resource allocation
7
Question
What is a Resource Allocation Graph (RAG)?
Answer
A graph showing which resources are held or requested by processes to detect deadlocks
8
Question
What indicates deadlock in a single-instance RAG cycle?
Answer
A cycle implies deadlock when each resource has only one instance
9
Question
What can be done if a deadlock is detected?
Answer
Terminate processes or preempt resources to recover
10
Question
What is the key difference between preemption and non-preemption?
Answer
Preemption allows taking resources away; non-preemption does not
11
Question
What is the purpose of the semaphore in the Dining Philosophers solution?
Answer
Represent each chopstick as a mutex to control access
12
Question
What is the odd-even fork-pick strategy?
Answer
Even IDs pick left then right; odd IDs pick right then left
13
Question
What is the primary goal in the Reader-Writer problem?
Answer
Allow multiple readers or a single writer with exclusive access
14
Question
Which solution gives writers priority over new readers in Reader-Writer?
Answer
Writer Preference Solution
15
Question
What does memory refer to in computing?
Answer
Storage space for data and instructions used by CPU
16
Question
Name two types of memory.
Answer
Primary (RAM, cache, ROM) and Secondary (HDD, SSD, etc.)
17
Question
What is memory fragmentation?
Answer
Inefficient memory use due to unusable free spaces or wasted blocks
18
Question
What is internal fragmentation?
Answer
Wasted space within allocated memory blocks
19
Question
What is external fragmentation?
Answer
Free memory is in non-contiguous holes, unusable for large requests
20
Question
Define contiguous memory allocation.
Answer
Each process occupies one continuous memory block
21
Question
What is fixed partitioning in memory management?
Answer
Memory divided into fixed-size partitions with one process per partition
22
Question
What is dynamic (variable) partitioning?
Answer
Partitions created to fit exact process size, reducing internal fragmentation
23
Question
What is paging in non-contiguous allocation?
Answer
Memory is divided into fixed-size pages and frames; pages map to frames
24
Question
What is a page fault?
Answer
Access to a page not currently in main memory
25
Question
Name three page replacement algorithms.
Answer
FIFO, LRU, Optimal
26
Question
What is Belady’s Anomaly?
Answer
More memory can cause more page faults under FIFO
27
Question
What is multilevel paging?
Answer
Page table divided into multiple levels to reduce memory overhead
28
Question
What is inverted paging?
Answer
One page table for the entire system with frame-level entries
29
Question
What is segmentation in memory management?
Answer
Memory divided into variable-sized segments by logical divisions
30
Question
What is thrashing?
Answer
System spends more time swapping pages than executing processes