Process Synchronization and Deadlock Flashcards

1
Q

What is a race condition?

A

occurs when two or more processes or threads are trying to access shared resources (e.g., memory, files, variables) simultaneously, and the final outcome depends on the order in which they execute.

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

What is process synchronisation?

A

refers to the techniques and mechanisms used to ensure that multiple processes or threads can work together harmoniously without causing conflicts, data corruption, or unpredictable behavior.

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

T/F Cooperating process can affect or be affected by the execution of another process

A

True

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

What is starvation?

A

A situation in which a runnable process is overlooked indefinitely by the scheduler; although it is able to proceed it is never chosen.

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

What is the critical section?

A

a section of code where a process or thread accesses shared resources or variables that could lead to race conditions or conflicts if not synchronized properly.
In a critical section, only one process or thread is allowed to execute at a time to prevent data corruption or unpredictable behavior.

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

What is mutual exclusion?

A

The property that ensures that only one process or thread at a time can access and execute a specific critical section of code.

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

What is bounded waiting?

A

It guarantees that there is a limit on the amount of time a process or thread must wait to access a shared resource while other processes or threads are using it.

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

What is progression?

A

It says that if no process is using the resource no process should be able to hold on to it.

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

List some locking mechanisms used in process synchronising

A

test-and-set, WAIT and SIGNAL, semaphores and monitors.

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

Describe the Test and Set method

A

a processor atomically reads the current state of a lock and sets it to a “locked” state in a single operation, enabling exclusive access to a critical section.

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

What are semaphores?

A

They are a type of variable that can be used to manage the execution of multiple processes or threads.
Can be thought of as a counter that helps in coordinating access to critical sections of code.

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

What is deadlock?

A

A situation where two or more processes or threads are unable to proceed because each is waiting for the other to release a resource, resulting in a cyclic waiting condition.

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

What are the four conditions of Deadlock?

A
  1. Mutual exclusion: at least one resource must be held in a non sharable mode.
  2. Hold and Wait: Processes must hold at least one resource and wait for additional resources that are currently held by other processes
  3. No preemption- we cannot forcefully take a resource from a process.
  4. Circular Wait: There exists a circular chain of processes, each waiting for a resource that’s held by the next process in the chain.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is deadlock prevention?

A

Deadlock Prevention aims to prevent at least one of the necessary conditions for deadlock from occurring by enforcing restrictions on resource allocation or process behavior, potentially sacrificing system efficiency.

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

What is deadlock avoidance?

A

Involves dynamically analyzing the system state to ensure safe resource allocation, allowing processes to request resources based on a prediction of future needs.

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

Name four ways to deal with deadlock

A
  1. Just ignore the problem. Maybe if you ignore it, it will ignore you.
  2. Prevention, by structurally negating one of the four conditions.
  3. Dynamic avoidance by careful resource allocation.
  4. Detection and recovery. Let them occur, detect them, and take action.