Lecture 6 Flashcards
CPU - I/O Burst Cycle
Process execution consists of a cycle of CPU execution (CPU burst) and I/O wait (I/O burst)
I/O-bound processes spend more time in ____ than ____
I/O than CPU
CPU-bound processes spend more time in ____ than ____
CPU than I/O
Scheduling Steps (big picture)
- Jobs go to secondary storage (disk)
- Job scheduler chooses some to go to memory (ready queue)
- CPU scheduler chooses a job from the queue to run on CPU
Medium-term scheduler
- May move some partially executed jobs back to disk to enhance performance
Long-term scheduler
- Selects which processes should be brought into the ready queue
- Controls the degree of multiprogramming
- Invoked infrequently (seconds or even minutes), can be slow
Long-term scheduler should maintain a good mix of ____ and ____ in in the systems
CPU-bound, I/O-bound jobs
Short-term scheduler
- Selects which process should be executed next and allocates CPU to it
- Invoked frequently (milliseconds), must be fast
CPU scheduling can be…
- Nonpreemptive
- Preemptive
Nonpreemptive scheduling
Once a process is allocated the CPU, it does not leave unless:
- It has to wait for something
- It terminates
Preemptive scheduling
OS can preempt a process from the CPU at anytime
Is preemptive or nonpreemptive more difficult to program?
Preemptive, because the consistency of data shared between processes and kernel data structures needs to be maintained
Dispatcher
Once a process has been selected to run on CPU, the dispatcher allocates the CPU to the selected process by switching context, switching to user mode, jumping to the right place in the process and starting it
Dispatch Latency
Time it takes for the dispatcher to stop one process and start another
Scheduling Criteria
- Maximize CPU Utilization
- Maximize Throughput
- Minimize Turnaround Time (time from submission to termination)
- Minimize Waiting Time in ready queue
- Minimize Response Time from when a request is submitted