Chapter 5 Flashcards

(27 cards)

1
Q

Lack of process synchronization can result in two extreme conditions:

A

deadlock or starvation

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

In early OS, deadlock was known as __________

A

deadly embrace

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

an extreme case of indefinite postponement

A

starvation

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

Seven cases of deadlock

A

Case 1: Deadlocks on File Requests
Case 2: Deadlocks in Databases
Case 3: Deadlocks in Dedicated Device Allocation
Case 4: Deadlocks in Multiple Device Allocation
Case 5: Deadlocks in Spooling
Case 6: Deadlocks in a Network
Case 7: Deadlocks in Disk Sharing

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

What is locking?

A

a technique used to guarantee the integrity of the data through which the user locks out all other users while working with the database

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

Locking can be done at three different levels:

A
  • the entire database can be locked for the duration of the request;
  • a subsection of the database can be locked;
  • or only the individual record can be locked until the process is completed.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

conditions for deadlock

A

Mutual exclusion
Resource holding
No preemption
Circular wait

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

In general, operating systems use one of three strategies to deal with deadlocks:

A
  • Prevent one of the four conditions from occurring (prevention).
  • Avoid the deadlock if it becomes probable (avoidance).
  • Detect the deadlock when it occurs and recover from it gracefully (detection)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The Banker’s Algorithm is based on a bank with a fixed amount of capital that operates on the following principles:

A
  • No customer will be granted a loan exceeding the bank’s total capital.
  • All customers will be given a maximum credit limit when opening an account.
  • No customer will be allowed to borrow over the limit.
  • The sum of all loans won’t exceed the bank’s total capital.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

One algorithm was proposed by Dijkstra in 1965 to regulate resource allocation to avoid deadlocks.

A

The Banker’s Algorithm

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

deadlock became more prevalent after the introduction of these systems

A

interactive systems

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

There are several recovery algorithms, but they all have one feature in common:

A

They all require at least one victim, an expendable job, which, when removed from the deadlock, will free the system.

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

Several factors must be considered to select the victim that will have the least-negative effect on the system. The most common are:

A
  • The priority of the job under consideration—high-priority jobs are usually untouched
  • CPU time used by the job—jobs close to completion are usually left alone
  • The number of other jobs that would be affected if this job were selected as the victim
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

recovery methods:

A
  1. terminate every job that’s active in the system and restart them from the beginning.
  2. terminate only the jobs involved in the deadlock and ask their users to resubmit them.
  3. identify which jobs are involved in the deadlock and terminate them one at a time
  4. use a snapshot of the job so it can continue without a restart
  5. selects a nondeadlocked job, preempts the resources it’s holding, and allocates them to a deadlocked process so it can resume execution, thus breaking the deadlock
  6. stops new jobs from entering the system, which allows the nondeadlocked jobs to run to completion so they’ll release their resources.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How can we eliminate mutual exclusion

A

May be bypassed by spooling, which allows the output from many jobs to be stored in separate temporary spool files at the same time

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

Directed graphs use these symbols:

A

Processes represented by circles and resources represented by squares

18
Q

How can we eliminate resource holding

A

By forcing each job to request, at creation time, every resource it will need to run to completion

19
Q

How to eliminate no preemption

A

By allowing the OS to deallocate resources from jobs

20
Q

How to eliminate circular wait

A

One solution was proposed by Havender, based on a numbering system.

Forces each job to request its resources in ascending order

21
Q

This scheme removes the possible of a circular wait and therefore guarantees the removal of deadlocks

A

Hierarchical ordering

22
Q

Difficulties of hierarchical ordering

A
  1. Discovering the best order for the resources so that the needs of the majority of the users are satisfied
  2. Assigning a ranking to nonphysical resources such as files where there is no basis for assigning a higher number to one over another
23
Q

What algorithm was used in avoidance

A

Banker’s Algorithm

24
Q

Steps to reduce a graph:

A
  1. Find a process that is currently using a resource and not waiting for one. This process can be removed from the graph, and the resource can be returned to the available list
  2. Find a process that’s waiting only for resource classes that aren’t fully allocated. This process isn’t contributing to deadlock since it would eventually get the resource it’s waiting for, finish its work, and return the resource to the “available list”
  3. Go back to step 1 and continue with steps 1 and 2 until all lines connecting resources to process have been removed.
25
Solution to address starvation problem
Algorithm same as aging, once starvation has been detected, the system can block new jobs until the starving jobs have been satisfied.
26
result of liberal allocation of resources
deadlock
27
result of conservative allocation of resources
starvation