Final Exam Review - All Chapters and Tutorials, Focused on 6-9 Flashcards

1
Q

How do resources work in a model?

A

There are resource types (R1, R2, …, Rm), which can be CPU cycles, memory space, etc., and each resource type Ri has Wi instances (System with 2 CPUs, resource type CPU has 2 instances)

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

May a deadlock involve the same resource types or different resource types? True/False?

A

True

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

What 4 conditions must be held simultaneously for deadlock to occur?

A

Mutual exclusion, hold and wait, no preemption, circular wait

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

Can a deadlock occur with mutex locks?

A

Yes, if the order of acquiring the mutex locks create a deadlock scenario Ex: thread_one first acquires mutex_one then mutex_two, thread_two first acquires mutex_two then mutex_one. If they both get their first mutex lock at the same time, deadlock occurs.

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

How are the vertices (V) partitioned in a resource-allocation graph?

A

P = {P1, P2, …, Pn} (set consisting of all processes) and R = {R1, R2, …, Rn} (set consisting of all resource types)

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

What edges (E) exist in a resource-allocation graph?

A

Request edges (directed edge from Pi -> Rj) and assignment edges (directed edge from Rj -> Pi)

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

What are claim edges?

A

Noted by dashed lines, point from a process to a resource that it may want to request in the future

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

What is a cycle in a resource-allocation graph?

A

A closed walk with no repetitions of vertices (except the ending vertex) and edges.

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

What if there’s a cycle in a resource-allocation graph?

A

If there’s one resource instance, then there’s a deadlock; If there’s multiple resource instances, then there’s the possibility of a deadlock

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

What if there’s no cycle in a resource-allocation graph?

A

There’s no deadlock

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

How do you ensure deadlock prevention?

A

Make sure that at least one of the 4 deadlock conditions are not held

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

What’s a method that can break the “hold and wait” condition?

A

Each process requests and is allocated all its resources before execution

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

How do you ensure deadlock avoidance?

A

By requiring that the system has some additional priori information available, as well as requiring each process to declare the maximum number of resources of each type that it may need

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

How do you know if the system is in a safe state?

A

If there exists a sequence <P1, P2, …, Pn> of all processes such that each process can be satisfied by the currently available resources, including recently released resources from other processes beforehand

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

What is the importance of a safe state?

A

All safe states are deadlock free, but not all unsafe states lead to deadlocks (Avoidance means ensuring the system is never in an unsafe state)

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

What is needed for the Banker’s algorithm?

A

n (# of processes), m (# of resource categories), Available[m], Max[n][m], Allocation[n][m], Need[n][m] (note: Need[i][j] = Max[i][j] - Allocation[i][j] for all i, j), Work (Initially equals Available, then if Need <= Work, Work = Work + Allocation

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

How do you perform deadlock detection?

A

For a single instance of each resource type, a deadlock exists in the system if and only if the wait-for graph contains a cycle (Nodes are processes Pi -> Pj if Pi is waiting for P); For several instances, then use the banker’s algorithm to see if it finishes (use only involved processes which does not have any resources allocated)

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

How do you recover from a deadlock?

A

Choose a blocked process, preempt it (releasing its resources), run the detection algorithm, and iterate it until the state is not a deadlock state

19
Q

What are the different types of addresses/address spaces?

A

Logical (AKA virtual, generated by CPU) and physical (seen by memory unit)

20
Q

What are the purpose of base and limit registers?

A

They define the logical address space

21
Q

How does address protection work?

A

If a memory access is attempted outside the valid range, a fatal error is generated

22
Q

What stages does address binding have?

A

Compile time, load time, execution time

23
Q

What kind of addresses do the stages of address binding use?

A

Compile time (absolute addresses, like 74014 – 75002), load time (R - R+100, where R will be decided until load time), and execution time (Binding delayed until run time if the process can be moved during its execution from one memory segment to another)

24
Q

What maps logical memory to physical memory?

A

The memory-management unit (MMU)

25
Q

What are the different kinds of linking?

A

Static (library modules get fully included) and dynamic (stubs are used, small pieces of code, to minimize data included)

26
Q

Why does swapping occur?

A

If there is not enough memory available for all running processes, then some processes that aren’t currently using the CPU may have their memory swapped out to the backing store

27
Q

Why is it important to swap processes out of memory only when there are no pending I/O operations?

A

Pending I/O operations could write into the wrong process’s memory space

28
Q

What is internal fragmentation?

A

Total memory space exists to satisfy a request but is not contiguous

29
Q

What is external fragmentation?

A

Allocated memory may be slightly larger than requested memory, this size difference is memory internal to a partition, but not being used

30
Q

What are the solutions to fragmentation?

A

Compaction (squeeze all processes together), segmentation, and paging (Divide physical memory into a number of equal sized blocks called frames, and to divide a program’s logical memory space into blocks of the same size called pages.)

31
Q

How does segmentation work?

A

Use segment table to map segment-offset addresses to physical addresses

32
Q

How does paging work?

A

Divide physical memory into a number of equal sized blocks called frames, and to divide a program’s logical memory space into blocks of the same size called pages. Avoids external fragmentation

33
Q

What is a page table used for?

A

A page table is used to look up what frame a particular page is stored in at the moment.

34
Q

What’s the relation between frames and pages?

A

Pages are stored in frames

35
Q

What is the Translation Look-aside Buffer (TLB)?

A

A special small fast lookup hardware cache, maps logical addresses to physical addresses

36
Q

What is the idea behind demand paging?

A

When a process is swapped in, not all pages are swapped in at once, only the necessary ones are

37
Q

How is the page fault rate measured?

A

0 <= p <= 1, 0 being no page faults, 1 being every page reference is a fault

38
Q

How is effective access time measured?

A

EAT = (1 – p) x memory access + p x (page fault overhead)

39
Q

What does Copy-on-Write do?

A

It allows both parent and child processes to initially share the same pages in memory, and only allows modified pages to be copied

40
Q

What does page replacement do?

A

It prevents over-allocation of memory

41
Q

What is the purpose of using a modify/dirty bit?

A

indicates whether or not the page has been changed since it was last loaded in from disk, reduces page transfer overhead

42
Q

What is the purpose of a reference string?

A

Evaluate algorithm by running it on a particular string of memory references (reference string) and computing the number of page faults on that string

43
Q

Explain Belady’s Anomaly

A

For some page replacement algorithms, adding more frames can cause more page faults!

44
Q

What are the frame allocation methods?

A

Maximum (total frames in the system) and minimum (each process needs a minimum number of frames to guarantee successful running)