Deadlock Flashcards

1
Q

Difference between deadlock prevention and deadlock avoidance

A

Deadlock prevention ensures atleast one of the conditions will never occur, whereas deadlock avoidance ensures the system will not enter a non safe state

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

Four conditions

A

Mutual exclusion
No pre-emption
Hold and wait
Circular wait

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

Mutual extension problem/solution

A

Resources are not shareable, only one process can user a resource at a time

Solution:

Share resources but some can’t be shared e.g. printer

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

No pre-emotion problem/solution

A

Only the process can release the resource

Solution: Use time quantum method - allocate time to each process to access the resources and once the time is up the resource will be released

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

Hold and wait problem/solution

A

Process is holding one resource and waiting for another

Solution: Try not to hold and wait - give processes the resources before it starts

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

Circular wait problem/solution

A

All processes are waiting for resources

Solution: Number the resources so that the process can request the resources in increasing order

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

What causes a deadlock

A

When two or more processes block each other by holding locks on resources that another process needs

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

Safe state

A

= no deadlock

The process allocated to the resource has completed successfully without problems

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

Unsafe state

A

= possibility of deadlock

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

Bankers Algorithm

A

Illustration

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

Why don’t Windows designers use deadlock avoidance and prevention

A

In modern o/s it’s almost impossible for a deadlock to occur because the os scheduler makes sure that all competing tasks gets a fair share of access to different resources

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

PCB

A

Process control block is the data structure maintained by the o/s which is indicated by the process ID. It keeps all the information needed to keep track of the process e.g.

  • process ID (unique ID)
  • process state (current state)
  • process privileges (grants access to resources)
  • pointer (points to parent process)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly