cpu scheduling
play

CPU Scheduling Dishes take varying amounts of time to prepare - PowerPoint PPT Presentation

The Problem You are the cook at the State Street Diner Customers enter and place orders 24 hours a day CPU Scheduling Dishes take varying amounts of time to prepare (Chapters 7-11) What are your goals? Minimize average latency Minimize maximum


  1. The Problem You are the cook at the State Street Diner Customers enter and place orders 24 hours a day CPU Scheduling Dishes take varying amounts of time to prepare (Chapters 7-11) What are your goals? Minimize average latency Minimize maximum latency Maximize throughput Which strategy achieves your goal? Kernel Operation Context matters! (conceptual, simplified) What if instead you are: Initialize devices Initialize “first process” the owner of an expensive container ship, and while (TRUE) { have cargo across the world while device interrupts pending the head nurse managing the waiting room of an - handle device interrupts emergency room U while system calls pending P C g n i l u a student who has to do homework in various d - handle system calls e h c S classes, hang out with other students and if run queue is non-empty (occasionally) sleep - select a runnable process and switch to it otherwise - wait for device interrupt }

  2. Schedulers in the OS Scheduling processes OS keeps PCBs on different queues CPU scheduler selects next process to run from the ready queue Ready processes are on ready queue - OS chooses one to dispatch Disk scheduler selects next read/write Processes waiting for I/O are on appropriate operation device queue Network scheduler selects next packet to Processes waiting on a condition are on an appropriate condition variable queue send or process OS regulates PCB migration during life cycle Page Replacement scheduler selects page to of corresponding process evict Why scheduling is Terminology and Metrics challenging Processes are not created equal! Job/Task CPU-bound process: long CPU bursts A user request: e.g., mouse click, web request, mp3 encoding, compilation, scientific applications shell command… Turnaround time CPU bursts I/O-bound process: short CPU bursts Time elapsed between a job’ s arrival and its index a file system, browse small web pages completion Throughput Problem Number of tasks completed per unit of time don’ t know jobs type before running it jobs behavior can change over time

  3. <latexit sha1_base64="KQIXI7fiHXS7KP9Hg8yMQEzo+Pk=">AB3nicdVC7SgNBFL0bXzG+opY2g0GwWnZVfFQGLbSM4pAEsLsZDYZMvtg5q4QltQ2ipVi6ef4C5b+gl/gJNEiPg5cOJxzLnP+IkUGh3nzcpNTc/MzuXnCwuLS8srxdW1ax2ninGPxTJWNZ9qLkXEPRQoeS1RnIa+5FW/dzr0qzd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mJQDpCw7KoxSWjWvQMIVRycyGiHSIJ1eZLcqY6tov7e04Ro9/ku7q7ax/ZzgUulE5gjCxswhbsgAMHUIJzKIMLFHy4hyd4toh1Zz1Yj+NoxvraWYcJWC+f5miNiQ=</latexit> <latexit sha1_base64="IS5ByZzDkO7KOYDQygDe+H0erk=">AB3nicdVDLSgMxFL1TX7W+qi7dBIvgaphR8bErunFZxbGFtpRMmlDM5MhuSOUoWs3ivFT/IX/BvTh4v6OBA4nHPCveGqRQGPe/TKSwsLi2vFdLa+sbm1vl7Z17ozLNeMCUVLoRUsOlSHiAiVvpJrTOJS8Hg6uxn79gWsjVHKHw5S3Y9pLRCQYRSvdtvJOueK73gTkf1KBGWqd8kerq1gW8wSZpMY0fS/Fdk41Cib5qNTKDE8pG9Aezyf7jciBlbokUtq+BMlEncvR2JhHNpkTLFvfnpj8S+vmWF03s5FkmbIEzYdFGWSoCLjsqQrNGcoh5ZQpoXdkLA+1ZShPUnJVvfc49MT/9gjv8l39eDIvXD9G69SvZzdoAh7sA+H4MZVOEahAgwie4BXeHOo8Os/OyzRacGZ/dmEOzvsXFm+JEw=</latexit> The Perfect Scheduler Time of arrival Execution time: sum of “green” intervals Total waiting time Initial waiting time Response time Is envy-free Guarantees fairness Meets deadlines Maximizes resource utilization (“work conserving”) Maximizes throughput Minimizes response and turnaround time Time on the ready queue but not running Time between job’ Time between job’ no job wants to switch its schedule with another think watching a video, operating car brakes, etc sum of “red” intervals below { Alas, no such scheduler exists… More Metrics s arrival and first time job runs s arrival and first response produced Turnaround time Job completed equal to the initial depends on job: we’ll assume it Response time waiting time Preemptive Non-preemptive incurs some context switching overhead all of the above, plus timer and other interrupts job runs until its actions cause it to yield CPU Predictability Overhead Starvation Fairness requests Low variance in response time for repeated Time wasted switching between jobs Lack of progress by some job Equitable division of resources job terminates job explicitly yields job blocks on an event (e.g., I/O or P(sem)) Other Concerns Scheduler Run? When Does the

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend