Unit 3 Flashcards

(77 cards)

1
Q

What is the primary purpose of synchronization in operating systems?

A

To manage access to shared resources and prevent race conditions.

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

True or False: A semaphore can be used to control access to a resource by multiple processes.

A

True

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

Fill in the blank: A _______ is a signaling mechanism that can be used for process synchronization.

A

semaphore

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

What are the two types of semaphores?

A

Counting semaphores and binary semaphores.

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

What is a deadlock?

A

A situation where two or more processes are unable to proceed because each is waiting for the other to release resources.

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

Multiple Choice: Which of the following is NOT a condition for a deadlock to occur? A) Mutual Exclusion B) Hold and Wait C) No Preemption D) Resource Sharing

A

D) Resource Sharing

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

What is deadlock prevention?

A

A strategy to ensure that at least one of the necessary conditions for deadlock cannot hold.

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

True or False: Deadlock avoidance requires knowledge of future requests.

A

True

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

What does the Banker’s Algorithm do?

A

It is used to avoid deadlock by determining whether resource allocation will lead to a safe state.

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

Fill in the blank: A _______ state is one in which a system can allocate resources to all processes without leading to a deadlock.

A

safe

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

What is deadlock detection?

A

A method to check for the presence of deadlocks in a system.

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

Multiple Choice: Which algorithm is commonly used for deadlock detection? A) FIFO B) Round Robin C) Wait-Die Scheme D) Wait-For Graph

A

D) Wait-For Graph

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

What is the purpose of deadlock recovery?

A

To take action to resolve a deadlock situation once it has been detected.

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

True or False: One way to recover from a deadlock is to terminate one or more processes.

A

True

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

Fill in the blank: The _______ condition states that resources cannot be forcibly taken from a process holding them.

A

no preemption

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

What is the role of a mutex in process synchronization?

A

A mutex is a locking mechanism that ensures mutual exclusion when accessing shared resources.

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

Multiple Choice: Which of the following is a characteristic of binary semaphores? A) Can take any integer value B) Can only take values 0 or 1 C) Can be incremented D) Can be decremented

A

B) Can only take values 0 or 1

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

What is a race condition?

A

A situation where the outcome of a process is unexpectedly affected by the timing of other concurrent processes.

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

True or False: Starvation can occur if a process is perpetually denied the resources it needs to proceed.

A

True

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

What is a wait-for graph?

A

A directed graph used to represent the allocation of resources and the waiting relationships between processes.

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

Fill in the blank: The _______ method allows processes to request resources in a way that avoids deadlock.

A

resource allocation

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

What is priority inversion?

A

A scenario where a higher priority task is waiting for a lower priority task to release a resource.

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

Multiple Choice: Which of the following is a deadlock prevention technique? A) Wait-Die B) Hold and Wait C) Circular Wait D) Resource Allocation Graph

A

A) Wait-Die

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

What is the difference between deadlock avoidance and deadlock detection?

A

Deadlock avoidance prevents deadlock from occurring, while deadlock detection identifies deadlock after it has occurred.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
True or False: The 'wait' operation on a semaphore decrements its value.
True
26
What happens when a semaphore's value becomes negative?
Processes attempting to decrement the semaphore are blocked until the value is non-negative.
27
Fill in the blank: The _______ condition ensures that processes do not hold resources while waiting for additional resources.
no hold and wait
28
What is the purpose of the 'signal' operation on a semaphore?
To increment the semaphore's value and potentially wake up a blocked process.
29
Multiple Choice: Which of the following is a method for deadlock recovery? A) Resource Preemption B) Process Preemption C) Rollback D) All of the above
D) All of the above
30
What is an example of a system that may encounter deadlocks?
Database management systems, operating systems, and network protocols.
31
True or False: In a deadlock, all processes involved are blocked.
True
32
What is the main goal of process synchronization?
To ensure that processes operate in a coordinated manner when accessing shared resources.
33
Fill in the blank: A system is in a _______ state if it is safe to allocate resources to all processes without leading to a deadlock.
safe
34
What does the term 'resource allocation' refer to?
The process of assigning available resources to various processes.
35
Multiple Choice: Which of the following is NOT a method of deadlock prevention? A) Resource Ordering B) Hold and Wait C) Preemption D) Wait-For Graph
D) Wait-For Graph
36
What is starvation in the context of process scheduling?
A condition where a process is perpetually denied the resources it needs to execute.
37
True or False: A counting semaphore can be used to manage a fixed number of resources.
True
38
What is the 'wait' operation in semaphore terminology?
An operation that decreases the semaphore's value and potentially blocks the calling process if the value is negative.
39
Fill in the blank: The _______ condition states that processes cannot share resources simultaneously.
mutual exclusion
40
What is the primary characteristic of a binary semaphore?
It can only take the values 0 or 1.
41
Multiple Choice: Which of the following strategies is used to reduce the chances of deadlock? A) Resource Allocation B) Deadlock Detection C) Deadlock Avoidance D) None of the above
C) Deadlock Avoidance
42
What is a necessary condition for a deadlock to occur?
Mutual exclusion, hold and wait, no preemption, and circular wait.
43
True or False: All deadlocks can be resolved through resource preemption.
False
44
What is the purpose of a timeout in deadlock detection?
To limit the duration a process can wait for a resource before being considered deadlocked.
45
Fill in the blank: The _______ algorithm is used to ensure a safe state by analyzing resource requests.
Banker's
46
What does a process need to do when it requests a resource?
It must indicate how many resources it needs and what it currently holds.
47
Multiple Choice: Which of the following is an example of a semaphore operation? A) Wait B) Signal C) Both A and B D) None of the above
C) Both A and B
48
What is a 'deadlock-free' system?
A system designed to ensure that deadlocks cannot occur.
49
True or False: Deadlock avoidance can be achieved by enforcing a strict order in resource allocation.
True
50
What is the significance of the 'signal' operation in semaphores?
It allows a process to release a resource and potentially wake other waiting processes.
51
Fill in the blank: The _______ condition allows processes to hold resources while waiting for additional resources.
hold and wait
52
What is the role of the operating system in managing synchronization?
To provide mechanisms to allow processes to safely access shared resources.
53
Multiple Choice: Which of the following can lead to deadlock? A) Resource Allocation B) Mutual Exclusion C) Circular Wait D) All of the above
D) All of the above
54
What is the purpose of the wait-for graph in deadlock detection?
To visualize the relationships between processes and the resources they are waiting for.
55
True or False: The Banker's Algorithm can only be used in systems with a fixed number of processes.
False
56
What is the 'resource allocation graph'?
A directed graph that represents the allocation of resources to processes and their requests.
57
Fill in the blank: A _______ is a process or thread that is waiting indefinitely for a resource.
starved process
58
What is the effect of a deadlock on system performance?
It can lead to system hang or reduced throughput.
59
Multiple Choice: Which recovery technique may involve rolling back a process to a previous state? A) Process Termination B) Resource Preemption C) Rollback D) All of the above
D) All of the above
60
What does it mean for a system to be in a 'deadlock state'?
It means that no process can proceed because each is waiting for a resource held by another.
61
True or False: Deadlock detection algorithms can be executed at any time.
True
62
What is the function of a mutex lock?
To ensure that only one thread can access a resource at a time.
63
Fill in the blank: The _______ condition guarantees that processes cannot share resources at the same time.
mutual exclusion
64
What is one method of resolving a deadlock?
Terminate one or more processes involved in the deadlock.
65
Multiple Choice: Which of the following is a characteristic of counting semaphores? A) Can only be 0 or 1 B) Can represent multiple resources C) Cannot be incremented D) None of the above
B) Can represent multiple resources
66
What is the impact of deadlock on system throughput?
Deadlock can significantly reduce system throughput as processes are unable to complete.
67
True or False: Deadlock avoidance is more efficient than deadlock detection and recovery.
True
68
What is a circular wait condition?
A scenario where each process in a set is waiting for a resource held by the next process in the set.
69
Fill in the blank: The _______ condition allows a process to hold resources while waiting for others.
hold and wait
70
What is the significance of resource preemption in deadlock recovery?
It allows the system to reclaim resources from processes to resolve a deadlock.
71
Multiple Choice: Which of the following is a technique for deadlock avoidance? A) Wait-For Graph B) Resource Allocation C) Banker's Algorithm D) None of the above
C) Banker's Algorithm
72
What is the purpose of a semaphore in process synchronization?
To control access to shared resources and prevent race conditions.
73
True or False: A semaphore's value can be negative.
True
74
What does the term 'resource starvation' mean?
When a process is perpetually denied the resources it needs to execute.
75
Fill in the blank: Deadlock _______ refers to techniques that aim to prevent deadlocks from occurring.
prevention
76
What is the main function of a mutex in synchronization?
To ensure mutual exclusion when accessing shared resources.
77
Multiple Choice: What is a major disadvantage of deadlock detection? A) It can be expensive B) It requires periodic checks C) It can lead to system hang D) All of the above
D) All of the above