142_04.pdf - Operating System Design CMPE142 Presentation 4 Agenda ● Review ● Scheduling Algorithms Scheduling Basics ● Recall the process state

# 142_04.pdf - Operating System Design CMPE142 Presentation 4...

• 40

This preview shows page 1 - 12 out of 40 pages.

Operating System Design CMPE142 Presentation 4

Subscribe to view the full document.

Agenda Review Scheduling Algorithms
Scheduling Basics Recall the process state transition diagram from a few weeks back ...

Subscribe to view the full document.

Process State Transition Running Running Ready Ready Blocked Blocked Descheduled Scheduled I/O: done I/O: initiate
Scheduling Basics When there is more than one process ready to run, which does the operating system choose? The choice of job (process/thread) is left up to the scheduler , a piece of code written by the OS developer

Subscribe to view the full document.

Scheduling Basics There are likely many jobs that would like to run right now The choice made (which job to run next) determines the overall quality of the scheduling algorithm Referred to in the text as a scheduling metric
Simple Scheduling Let’s assume we have a few jobs (processes), and that all the jobs have the following characteristics Each job runs for the same amount of time All jobs arrive at the same time All jobs use only CPU (no I/O) We know ahead of time how long each job will run for

Subscribe to view the full document.

Simple Scheduling - FIFO JOB Arrival time Run time A 0.0001s 10s B 0.0002s 10s C 0.0003s 10s Note – jobs can’t arrive “at the exact same time”, so we bias them slightly so that A arrives just before B which arrives just before C
Simple Scheduling - FIFO Time Event 0.0001 A arrives 0.0002 B arrives 0.0003 C arrives 0 Run A 10 Complete A 10 Run B 20 Complete B 20 Run C 30 Complete C

Subscribe to view the full document.

Simple Scheduling - FIFO The turnaround time of a job is the time it takes between job arrival and job completion Turnaround(A) = 10s – 0 = 10s Turnaround(B) = 20s – 0 = 20s Turnaround(C) = 30s – 0 = 30s Turnaround(Avg) = (10+20+30) / 3 = 20s
Simple Scheduling Can we do better if we remove some assumptions?

Subscribe to view the full document.

• SIMONSHIM

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes