Week 3 and 4 Flashcards
What is “Test And Set - Bounded Wait”?
- 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 `
Def: Semaphore
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
Def: mutex
a program object that is created so that multiple program threads can take turns sharing the same resource, such as access to a file
What is the critical region?
a high level language construct that implements a critical section
Def: Monitors
High level synchronization construct - allows safe sharing of an abstract data type
- prioritized waiting
When a process executes x.signal() and another process is waiting on condition X, what happens?
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
What are the two meanings of wait and signal? (semaphores vs monitor condition)
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
What are Java synchronized methods vs java synchronized blocks?
methods - similar to monitors
blocks - similar to critical regions
What is the goal of scheduling?
Maximum CPU utilization (gives CPU to another process while other is waiting I/O)
When does the CPU select processes from ready queue and allocates to CPU?
- Processes goes to wait state (I/O, event wait, etc.) (nonpreemptive)
- Process is interrupted
- Process goes from wait to ready
- Process terminates (nonpreemptive)
What is the Dispatcher?
The part of the scheduler responsible for performing the context switch and resuming the process
What is Dispatch Latency?
Time for dispatcher to run
What are the 5 Scheduling criteria?
- CPU utilization (keep CPU as busy as possible)
- Throughput (# of jobs done per time unit)
- Turnaround Time (Time of submission to Time of completion)
- Waiting Time (amount of time in ready queue)
- Response time (submit time to time of first output request)
What is the convoy effect?
All I/O jobs end up behind CPU jobs which hog the CPU
What is non-preemptive scheduling?
When a task runs until it stops (voluntarily or it finishes)