Exam 2 Flashcards

1
Q

Name the two causes of disk I/O delays and explain.

A

seek time - the amount of time it takes for the read/write head to move to the correct track on the disk

rotational latency - the amount of time for the disk to rotate so that the sector in the track is under the read/write head and able to get information

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

Name the four necessary and sufficient conditions for deadlock to occur

A

mutual exclusion
hold and wait
circular wait
no preemption

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

Explain mutual exclusion

A

each resource is available or allocated to exactly one process; resources are not shared

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

Explain hold and wait

A

a process is holding resources can request and wait for an additional resources

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

Explain circular wait

A

a circular chain of processes where each process is waiting on a resource that is held by the next process in the chain

ex. dining philosopher’s problem - every philosopher was holding their left fork and waiting for the left fork

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

Explain no preemption

A

resources allocated to a process may not be forcibly taken away

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

Explain deadlock

A

the state of indefinite waiting that processes may reach when competing for system resources or attempting to communicate

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

Name the four ways to prevent deadlock…

A

attack mutual exclusion
attack hold and wait
attack circular wait
attack no preemption

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

Explain the ‘attack mutual exclusion’ deadlock prevention method…

A

avoid assigning resources unless necessary

limit the number of processes that are allowed to request resources

ex. daemons for devices

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

Explain the ‘attack hold and wait’ deadlock prevention method…

A

disallow processes to hold resources while waiting for additional resources

all resources must be allocated to the process before it can start - must have full set!; if the process needs an additional resource, the process must temporarily release all resources

breaks the wait part!

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

Explain the problems associated with the ‘attack hold and wait’ deadlock prevention method…

A

process may not know what it needs when it starts

resources tied up longer than necessary and underutilized

delayed if lots of resources are needed - starvation

break the hold part - process requires a new resource and must release all resources to acquire new resources - another process may grab what the process needs allowing both to complete - would just have to wait

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

Explain the ‘attack circular wait’ deadlock prevention method…

A

allow processes to have only one resource at a time

globally order all processes into categories by number - when numbering processes, think of the normal way things are processed

a process can only request from a higher numbered category in the resource chain

a process can release resources in a higher numbered category to request lower numbered category resources - higher numbered category resources may be requested again

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

When globally ordering all processes, why should output devices have a high numbered category?

A

output devices are needed at the end of a process; for example, it doesn’t make sense to give up everything to print!

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

Give an example of globally ordering all processes into categories…

A

if you have requested and been granted a resource in category 2, you can no longer request from category 1, 4 can’t request 1, 2, 3; must be held further down resource chain than I am;

if a process needs a resource from category 2, the process will release resources in category 3 to get to resources in category 2 - can always request again!

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

preemptible

A

can be interrupted; can be taken away from a process without a problem (without fail)

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

non-preemptible

A

can’t be interrupted; cause process to fail, cause erroneous result, cause extra work; considered a deadlock; ex. print job taken away

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

Describe how deadlock can be detected…

A

deadlock detection involves maintaining information of the current resource-allocation state and invoking an algorithm that uses the information of the resource-allocation state to detect deadlock

each resource type has one instance - construct a resource graph and search for a cycle - cycle indicates deadlock; resource-allocation graph algorithm

each resource type has multiple instances - use the detection algorithm over the array structures; when the algorithm completes, any unmarked processes are deadlocked

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

What does a process to a resource indicate?

A

process is requesting one instance of the resource type; request

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

What does a resource to a process indicate?

A

one instance of a resource type has been allocated to the process; acquired

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

How often should the deadlock detection algorithm be invoked (2)…

A

invoked every time a process requests a resource that cannot be immediately allocated - os can identify the specific process that caused deadlock along with the processes that are in deadlock; tons of overhead

invoked periodically; deadlock reduces the CPU utilization and system throughput - CPU utilization drops below a certain percentage the algorithm is invoked - ~40%

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

Describe the Banker’s Algorithm…

A

answer

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

Describe the Detection Algorithm…

A

answer

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

Name the 4 ways deadlock can be recovered from…

A

preemption
rollback
killing processes
avoidance

24
Q

Explain the ‘preemption’ deadlock recovery method…

A

resource is taken away from a process and the process is suspended; when the process that gets the preempted resource completes, the resource is returned to the original process

only works for some scenarios

25
Q

Describe an example of the ‘preemption’ deadlock recovery method…

A

process locked part of a database, could unlock and allow another process access, when process finishes, can re-lock

if the process was in the middle of something, the process could fail causing both processes to fail, ex. disk burning

26
Q

Explain the ‘rollback’ deadlock recovery method…

A

OS periodically creates checkpoints for each process; a process in deadlock is rolled back to a defined checkpoint - usually when a process requests resources

this process looks at priority - rollback process with low priority first; low runtime - hasn’t accomplished a large amount of work relative to other processes

will have to do rework, but the system won’t crash

27
Q

What is a checkpoint and how is it used?

A

data structure that stores the state of a process, resource states, and time stamp and is stored in a file that is used to restart a process in a previous state before deadlock occurred

only thing saved at checkpoints are things that have changed

28
Q

Explain the ‘killing processes’ deadlock recovery method…

A

process in deadlock or process that is holding needed resources is killed

kill low priority process with short runtimes

29
Q

Give an example of a good process to kill…

A

compilation of a development system

30
Q

Explain the ‘avoidance’ deadlock recovery method…

A

decide whether or not to allocate a request

suspend if process can’t have resource at current time

wake up process when resource is available

31
Q

Name the file attributes…

A
permissions
creator
owner
timestamp
size
location
type
32
Q

Describe the file attribute, ‘permissions’…

A

who can access the file and what can they do with the access they have

read, write, execute

owner, group, world

33
Q

Describe the file attribute, ‘creator’…

A

who created the file

34
Q

Describe the file attribute, ‘owner’…

A

who owns the file

35
Q

Describe the file attribute, ‘timestamp’,,,

A

may have one or all of the following:

when was the file created

when was the file last modified - will always have this!

when was the file last accessed

36
Q

Describe the file attribute, ‘size’…

A

how much data is stored in the file

37
Q

Describe the file attribute, ‘location’…

A

where is the file stored in the computer system

which disk is in on

38
Q

What are file attributes?

A

maintains the file and controls file access as to how it can and should be used; may be on some systems and not others

39
Q

Name the 4 ways to implement files…

A

contiguous allocation
linked list allocation
linked list allocation with table
i-nodes

40
Q

Describe the method of implementing files via contiguous allocation…

A

files are located in a contiguous series of blocks on a disk - the last block will usually be wasted because blocks are rarely even numbered

need to know the size and starting address of the file to implement

causes disk fragmentation

files that increase in size must move to a larger space

41
Q

Describe the method of implementing files via linked list allocation…

A

random access is slow

directory stores the address of the first block

first item of each block contains the address of the next block - only works for a file in sequential order

blocks don’t have all the data, but do have a pointer to the next piece

42
Q

Describe the method of implementing files via linked list allocation with a table…

A

table in memory with the same number of blocks on disk - entry for every block whether free or used!

random access is faster because chain is in memory and not on disk

first block is stored at location X on disk; location X in table stores the memory location of second block on disk

43
Q

Describe the method of implementing files via i-nodes…

A

contains file attributes and list of block addresses

pointers to blocks in a file

memory should be proportional to file size

fixed size - if file is bigger, the last block will be a pointer to the next block

~ 1/2 of the last block will always be empty

44
Q

Name the 5 issues in disk space management…

A
block size
caching
free blocks
fragmented disks
disk quotas
45
Q

Describe the ‘block size’ issue of disk space management…

A

too small and will span multiple blocks

too large and the last block on the disk will have wasted space

46
Q

Describe the ‘caching’ issue of disk space management…

A

needs to maintain file integrity

blocks modified in cache must be written out to disk

47
Q

Describe the ‘free blocks’ issue of disk space management…

A

list of available blocks

bitmap kept - one bit per block and 1 represents a free block

48
Q

Describe the ‘fragmented disks’ issue of disk space management…

A

file blocks are spread out which reduces performance

easier to store information

do not defragment a solid state!!!

49
Q

Describe the ‘disk quotas’ issue of disk space management…

A

limits how much data can be stored

quota table keeps track of hard limits, soft limits, and current usage

if hard limit is hit, the system manager will have to unlock account - must delete stuff!

50
Q

Describe race conditions…

A

two or more tasks race to the shared resource simultaneously

process that writes to the resource last will succeed

51
Q

Describe critical sections…

A

code in a process that accesses and uses a shared resource; every process that needs to access a shared resource has its own critical section

used to prevent race conditions

ex. car driving on road A and car driving on road B, the critical section is the intersection of roads A and B

52
Q

Conditions for critical section solution…

A

only one process can be executing its critical section at a time (mutual exclusion)

no process outside a critical section can block another process

no process should have to wait indefinitely to enter its critical section

53
Q

Describe the purpose of device controllers…

A

they directly control devices for main CPU

all device controllers are able to operate the devices at the same time the main CPU is carrying out some task

purpose is to provide part of the interface between devices and processes, or function as a bridge between device and OS

54
Q

Describe the purpose of device driver software…

A

computer program that operates or control a device that is attached to the computer

provides a software interface to hardware device, enabling other OS and computer programs to access hardware functions without knowledge of hardware being used

translates commands specific to make and model of device being used

55
Q

Describe what a file system does…

A

provides users the ability to put data into files and to find and use files that have been previously created

FMS doesn’t have knowledge about how the data in the file is organized

store files in nonvolatile memory

user can access files with filename in a given directory

deal with how the file is structured, names of files, who has access, how are things used and protected, how are things saved, how do we keep track of space available when a new file has to be created