Week 3 and 4 Flashcards

1
Q

What is “Test And Set - Bounded Wait”?

A
  • pass the key approach
  • whenexiting the critical section, don’t release the lock, pass the lock to someone who is already waiting
  • pass the lock in increasing process id order (with wrap around)
  • only one process leaves critical section and gets back to entry point before a context switch, must wait for all other processes that are waiting
  • if wiating, each other process can only execute critical section once `
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Def: Semaphore

A

Prevents multiple processes entering their critical sections at the same time. - a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system. - they bracket critical sections

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

Def: mutex

A

a program object that is created so that multiple program threads can take turns sharing the same resource, such as access to a file

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

What is the critical region?

A

a high level language construct that implements a critical section

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

Def: Monitors

A

High level synchronization construct - allows safe sharing of an abstract data type
- prioritized waiting

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

When a process executes x.signal() and another process is waiting on condition X, what happens?

A

Several case

  • first process (signaller) goes to sleep until second process exits (releases lock) or waits on another condition
  • first process continues until it leaves or waits on a condition and then signalled process continues
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the two meanings of wait and signal? (semaphores vs monitor condition)

A

Semaphores (integer cariable, user visable value influences operation) - wait in a semaphore may go right through (value > 0)

Monitor Condition (Queue variable, no user visible value) - wait in a monitor always means stop

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

What are Java synchronized methods vs java synchronized blocks?

A

methods - similar to monitors

blocks - similar to critical regions

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

What is the goal of scheduling?

A

Maximum CPU utilization (gives CPU to another process while other is waiting I/O)

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

When does the CPU select processes from ready queue and allocates to CPU?

A
  1. Processes goes to wait state (I/O, event wait, etc.) (nonpreemptive)
  2. Process is interrupted
  3. Process goes from wait to ready
  4. Process terminates (nonpreemptive)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the Dispatcher?

A

The part of the scheduler responsible for performing the context switch and resuming the process

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

What is Dispatch Latency?

A

Time for dispatcher to run

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

What are the 5 Scheduling criteria?

A
  1. CPU utilization (keep CPU as busy as possible)
  2. Throughput (# of jobs done per time unit)
  3. Turnaround Time (Time of submission to Time of completion)
  4. Waiting Time (amount of time in ready queue)
  5. Response time (submit time to time of first output request)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the convoy effect?

A

All I/O jobs end up behind CPU jobs which hog the CPU

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

What is non-preemptive scheduling?

A

When a task runs until it stops (voluntarily or it finishes)

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

What is preemptive scheduling?

A

task can be forcibly suspended by CPU interrupt

17
Q

What is the one problem with SJR?

A

How do you know how long the next burst will be?

18
Q

What is priority scheduling? problem?

A

Ready queue is sorted based on priority and CPU goes to process with highest priority

prob: processes change behavior over time - how do you assign priority?

19
Q

What is quantum?

A

maximum time process gets to run

20
Q

How long should the quantum be?

A

The quantum should be 80% the time it takes a process in the CPU

21
Q

In round robin scheduling with a quanta of 1/10 second is it possible that more than 10 processes can execute a burst in a given second? why?

A

yes, just because quanta is 1/10 seconds doesn’t mean CPU has to take 1/10 of a second

22
Q

What is Deadlock?

A

Set of process’s each holding a resource that another process in the set needs

23
Q

What are the 4 conditions of deadlock?

A
  1. mutual exclusion - only limited number (usually one) process at a time can use a resource
  2. hold and wait - a process has (at least) one resource and is waiting for another
  3. no preemption - we can’t take a resource away from a process
  4. circular wait - P0 waits for a resource held by P1….
24
Q

What can we do about deadlock?

A

prevention - ensure one of the 4 conditions never happens
Avoidance - extra information before allocating an available resource
Recovery - enter deadlock state and recover
Ignore - hope it never happens, handle it manually

25
Q

How can you prevent Deadlock?

A

a. Mutual exclusion – create a spooler device (for things like printers if there shared)
b. Hold and wait – have to reserve all the resources you need at once (allocate all resources you want at the same time or give up resources before you can get more)
c. Circular wat – always request the resources in the same order
d. Pre-emption – processes have to have rollback points to a previous stage in its computation before it has those resources

26
Q

What is resource allocation state?

A

number of available and allocated resources and the a priori known maximum resources

27
Q

What is safe state?

A

System is safe if there is some order we can allocate the resources and not produce a deadlock

28
Q

What is resource preemption?

A

Take away resources from other processes - process must be rolled back

29
Q

What are the three criteria for a critical section?

A
  1. Mutual Exclusion: only one process in critical section at a time
  2. Bounded waiting: once a process is waiting, the other processes can only enter and leave a bounded number of times (no starvation)
  3. Progress: If there is no process in a critical section, and more than one process wants to enter their critical section, then the selection of a process cannot be postponed indefinitely