Deadlocks Flashcards

1
Q

What is a deadlock?

A

Situation where two or more processes are waiting for the other to finish, and thus neither ever does. Deadlock may happen because two or more processes are using/sharing the same resources

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

What is deadlock detection?

A

Algorithms which are used to detect of a possible Deadlock situation before it occurs

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

What are the four coffman conditions?

A

Mutual Exclusion
Only one process can use the resource at any given instant of time
Hold and Wait (resource holding)
A process is currently holding at least one resource and requesting additional resources which are being held by other processes
No Pre-emption
A resource can be released only voluntarily by the process holding it
Circular Wait
P1 must be waiting for a resource which is being held by P2, which in turn P2 is waiting for the first process to release the resource

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

What is deadlock resolution?

A

Ways to resolve deadlock. There are 3 possible ways: By killing one or more processes, by killing all deadlocked processes or by rolling back all the processes to the state before deadlock

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

What are threads?

A

Entity within a process that is used to schedule when each part of the program code should be executed on CPU

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

What is the advantage of threads?

A

: More responsive (a program may continue running even if part of it getting blocked or performing a lengthy operation), resource sharing (several threads share the same resources), may run in parallel on different processors, and it is cheaper and faster to create a thread than a process

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

What is the difference between a thread and a process?

A

Threads define how and when part of the code inside a process should be executed. It shares all of the process resources.
Processes are used to allocate different resources. Every process may not share all of the process resources. It is cheaper and faster to create a thread than a process

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

What constitutes a thread in memory?

A

Consists of ThreadID, Program Counter, Register Sets, Stack and Thread state. All threads share address space, global variables (program code, files, child processes, accounting information), and signal handlers

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