Lecture 7 cpu scheduling

1,087 views
958 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,087
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
17
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lecture 7 cpu scheduling

  1. 1. CPU SCHEDULINGT S PRADEEP KUMAR
  2. 2. CPU Burst and IO Burst
  3. 3. CPU Burst and IO Burst• Burst time is an assumption of how long a process requires the CPU between I/O waits.• It can not be predicted exactly, before a process starts.• It means the amount of time a process uses the CPU for a single time. (A process can use the CPU several times before complete the job)
  4. 4. CPU Scheduler• Short term scheduler is used• Scheduler selects the processes from the ready list and allocates the CPU to that process.• Ready queue may be • FIFO • Priority queue • Tree • Unordered list • Or any list
  5. 5. Scheduling Decisions1. When a process switches from the running state to the waiting state2. When a process switches from the running state to the ready state3. When a process switches from the waiting state to the ready state4. When a process terminates1 and 4 uses Non Preemptive Scheduling2 and 3 uses Preemptive Scheduling
  6. 6. Non preemptive Scheduling• Windows 3.1 uses non preemptive scheduling• once the CPU has been allocated to a process, the process keeps the CPU until it releases the CPU either by terminating or by switching to the waiting state.• No special hardware (ex. timer)is needed for non preemption.
  7. 7. Preemptive Scheduling• All the OS these days uses preemptive scheduling• The hardware and the kernel has to be redesigned for preemptive scheduling• Under preemption, • A task which is running under a CPU may be going to a ready state, if another high priority task running under a CPU • Upon completion, then the task will resume based on the priorities of the other tasks in the ready queue. • System calls are generated using Processes • Kernel important data can be affected if preemption happens in between, so kernel has to be designed for accepting these changes. • The kernel will not preempt a process while the kernel data structures are in an inconsistent state
  8. 8. Dispatcher• The dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler. • Switching context • Switching to user mode • Jumping to the proper location in the user program to restart that program• The dispatcher should be fast enough as it is invoked during every context switch.• The time it takes for the dispatcher to stop one process and start another running is known as the dispatch latency
  9. 9. Scheduling criteria• CPU Utilisation • Range from 0 to 100 • Upto 40% for lightly loaded system, 90% for heavily loaded• Throughput • Number of processes/hour• Turnaround time • How long it takes to execute a process • The interval from the time of submission of a process to the time of completion is the turnaround time • Te_cpu_io+Tmem+Tready_queue• Waiting time • Time for a process to wait in the ready queue• Response Time • the time from the submission of a request until the first response is produced
  10. 10. Scheduling criteria• Maximize • throughput and • CPU utilisation• Minimize • Turnaround, • Waiting time • Response time.

×