Tcss 422: Operating Systems

Tcss 422: Operating Systems

TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology TCSS 422: OPERATING SYSTEMS Introduction to CPU Scheduling, Multi-Level Feedback Queue, Proportional Share Scheduling Wes J. Lloyd School of Engineering and Technology University of Washington - Tacoma TCSS422: Operating Systems [Winter 2019] January 23, 2019 School of Engineering and Technology, University of Washington - Tacoma FEEDBACK FROM 1/16 I am unclear about the Ch. 6 material What is limited direct execution? CPU modes: what is user mode? CPU modes: what is kernel mode? Three kinds of traps “switch” processing to kernel mode . System call (calls for I/O, kernel API calls, context switch) . Exception (error in code) . Interrupt: Maskable vs. Unmaskable What is Cooperative multi-tasking? What is Preemptive multi-tasking? What is a context switch? CPU scheduling: what is a time quantum (slice)? TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.2 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.1 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology FEEDBACK - 2 What criteria is used to decide whether a context switch is appropriate following the end of a job’s time slice? . After time quantum timer interrupt always fires, OS regains control (context switch) to evaluate next scheduling task Causes of context switches: . System call – process in user mode context switches to kernel mode to perform a kernel (API) call. Example: I/O . Multi-tasking – process uses full time quantum (10 ms default), timer interrupt fires, OS scheduler regains control of CPU to evaluate next task . Exception – CPU exception running current task (e.g. memory access fault) TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.3 School of Engineering and Technology, University of Washington - Tacoma FEEDBACK - 3 Explain the difference between unmaskable (interrupt) and maskable (interrupt): Define unmaskable Define maskable What happens if a non-maskable interrupt lock in interrupted by a higher priority (interrupt) ? . Only maskable interrupts can be interrupted . Non maskable interrupt handles are not pre-emptible TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.4 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.2 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology FEEDBACK – 4 What is “preemptibility” again? . OS: ability to be interrupted and replaced by a higher priority task What does “no preemption” mean for the Shortest Job First (SJF) CPU scheduler? Why is there no overhead / context switching for the FIFO scheduler? . Does the FIFO scheduler context switch? . Revisit example TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.5 School of Engineering and Technology, University of Washington - Tacoma FEEDBACK - 5 Where is the C tutorial? Link: http://faculty.washington.edu/wlloyd/courses/tcss422/a ssignments/TCSS422_w2019_C_Tutorial.pdf TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.6 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.3 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology OBJECTIVES Active Reading Quiz 1 (Tuesday) Assignment 0 / Linux Tutorial C Tutorial Assignment 1 – Soon… CPU Scheduling: Chapter 7 – Scheduling Introduction Chapter 8 – Multi-level Feedback Queue (MLFQ) Chapter 9 – Proportional Share Scheduler Linux Completely Fair Scheduler (CFS) TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.7 School of Engineering and Technology, University of Washington - Tacoma CHAPTER 7- SCHEDULING: INTRODUCTION TCSS422: Operating Systems [Winter 2019] January 23, 2019 School of Engineering and Technology, University of Washington - Tacoma L5.8 Slides by Wes J. Lloyd L5.4 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology SCHEDULING METRICS Metrics: A standard measure to quantify to what degree a system possesses some property. Metrics provide repeatable techniques to quantify and compare systems. Measurements are the numbers derived from the application of metrics Scheduling Metric #1: Turnaround time The time at which the job completes minus the time at which the job arrived in the system 푻풕풖풓풏풂풓풐풖풏풅 = 푻풄풐풎풑풍풆풕풊풐풏 − 푻풂풓풓풊풗풂풍 How is turnaround time different than execution time? TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.9 School of Engineering and Technology, University of Washington - Tacoma SCHEDULING METRICS - 2 Scheduling Metric #2: Fairness . Jain’s fairness index . Quantifies if jobs receive a fair share of system resources n processes xi is time share of each process worst case = 1/n best case = 1 Consider n=3, worst case = .333, best case=1 With n=3 and x1=.2, x2=.7, x3=.1, fairness=.62 With n=3 and x1=.33, x2=.33, x3=.33, fairness=1 TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.10 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.5 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology SCHEDULERS FIFO: first in, first out . Very simple, easy to implement Consider . 3 x 10sec jobs, arrival: A B C, duration 10 sec each ퟏퟎ + ퟐퟎ + ퟑퟎ 푨풗풆풓풂품풆 풕풖풓풏풂풓풐풖풏풅 풕풊풎풆 = = ퟐퟎ 풔풆풄 ퟑ TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.11 School of Engineering and Technology, University of Washington - Tacoma SJF: SHORTEST JOB FIRST Given that we know execution times in advance: . Run in order of duration, shortest to longest . Non preemptive scheduler . This is not realistic . Arrival: A B C, duration a=100 sec, b/c=10sec ퟏퟎ + ퟐퟎ + ퟏퟐퟎ 푨풗풆풓풂품풆 풕풖풓풏풂풓풐풖풏풅 풕풊풎풆 = = ퟓퟎ 풔풆풄 ퟑ TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.12 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.6 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology SJF: WITH RANDOM ARRIVAL If jobs arrive at any time: duration a=100s, b/c=10s A @ t=0sec, B @ t=10sec, C @ t=10sec ퟏퟎퟎ + ퟏퟏퟎ − ퟏퟎ +(ퟏퟐퟎ − ퟏퟎ) 푨풗풆풓풂품풆 풕풖풓풏풂풓풐풖풏풅 풕풊풎풆 = = ퟏퟎퟑ. ퟑퟑ 풔풆풄 ퟑ TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.13 School of Engineering and Technology, University of Washington - Tacoma STCF - 2 Consider: duration a=100sec, b/c=10sec . Alen=100 Aarrival=0 . Blen=10, Barrival=10, Clen=10, Carrival=10 (ퟏퟐퟎ − ퟎ)+ ퟐퟎ − ퟏퟎ +(ퟑퟎ − ퟏퟎ) 푨풗풆풓풂품풆 풕풖풓풏풂풓풐풖풏풅 풕풊풎풆 = = ퟓퟎ 풔풆풄 ퟑ TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.14 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.7 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology SCHEDULING METRICS - 3 Scheduling Metric #3: Response Time Time from when job arrives until it starts execution 푻풓풆풔풑풐풏풔풆 = 푻풇풊풓풔풕풓풖풏 − 푻풂풓풓풊풗풂풍 STCF, SJF, FIFO . can perform poorly with respect to response time What scheduling algorithm(s) can help minimize response time? TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.15 School of Engineering and Technology, University of Washington - Tacoma RR: ROUND ROBIN Run each job awhile, then switch to another distributing the CPU evenly (fairly) Scheduling Quantum is called a time slice Time slice mustRR is befair, but performs poorly on metrics a multiple of the such as turnaround time timer interrupt period. Scheduling Quantum = 5 seconds TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.16 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.8 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology RR EXAMPLE ABC arrive at time=0, each run for 5 seconds OVERHEAD not considered ퟎ + ퟓ + ퟏퟎ 푻 = = ퟓ풔풆풄 풂풗풆풓풂품풆 풓풆풔풑풐풏풔풆 ퟑ ퟎ + ퟏ + ퟐ 푻 = = ퟏ풔풆풄 풂풗풆풓풂품풆 풓풆풔풑풐풏풔풆 ퟑ TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.17 School of Engineering and Technology, University of Washington - Tacoma ROUND ROBIN: TRADEOFFS Short Time Slice Long Time Slice Fast Response Time Slow Response Time High overhead from Low overhead from context switching context switching Time slice impact: .Turnaround time (for earlier example): ts(1,2,3,4,5)=14,14,13,14,10 .Fairness: round robin is always fair, J=1 TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.18 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.9 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology SCHEDULING WITH I/O STCF scheduler . A: CPU=50ms, I/O=40ms, 10ms intervals . B: CPU=50ms, I/O=0ms . Consider A as 10ms subjobs (CPU, then I/O) Without considering I/O: CPU utilization= 100/140=71% TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.19 School of Engineering and Technology, University of Washington - Tacoma SCHEDULING WITH I/O - 2 When a job initiates an I/O request . A is blocked, waits for I/O to compute, frees CPU . STCF scheduler assigns B to CPU When I/O completes raise interrupt . Unblock A, STCF goes back to executing A: (10ms sub-job) Cpu utilization = 100/100=100% TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.20 School of Engineering and Technology, University of Washington - Tacoma Slides by Wes J. Lloyd L5.10 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology TCSS422: Operating Systems [Winter 2019] January 23, 2019 School of Engineering and Technology, University of Washington - Tacoma L5.21 CHAPTER 8 – MULTI-LEVEL FEEDBACK QUEUE (MLFQ) SCHEDULER TCSS422: Operating Systems [Winter 2019] January 23, 2019 School of Engineering and Technology, University of Washington - Tacoma L5.22 Slides by Wes J. Lloyd L5.11 TCSS 422 A – Winter 2019 1/22/2019 School of Engineering and Technology MULTI-LEVEL FEEDBACK QUEUE Objectives: .Improve turnaround time: Run shorter jobs first .Minimize response time: Important for interactive jobs (UI) Achieve without a priori knowledge of job length TCSS422: Operating Systems [Winter 2019] January 23, 2019 L5.23 School of Engineering and Technology, University of Washington - Tacoma MLFQ - 2 Round-Robin within a Queue Multiple job queues Adjust job priority based on observed behavior Interactive Jobs .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    36 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us