1 / 8

CS444/CS544 Operating Systems

CS444/CS544 Operating Systems. Threads Introduction to CPU Scheduling 2/02/2006 Prof. Searleman jets@clarkson.edu. Outline. Laboratory exercise: PThreads CPU scheduling NOTE: Quiz: Thursday, 2/9, in lab (ITL) Covers material in SGG: Chapters 1 - 4

kamuzu
Télécharger la présentation

CS444/CS544 Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS444/CS544Operating Systems Threads Introduction to CPU Scheduling 2/02/2006 Prof. Searleman jets@clarkson.edu

  2. Outline • Laboratory exercise: PThreads • CPU scheduling NOTE: • Quiz: Thursday, 2/9, in lab (ITL) • Covers material in SGG: Chapters 1 - 4 • New due date for Lab#1: Tuesday, Feb. 7 • Read: Chapter 5

  3. Thread Support • Pthreads is a user-level thread library • Can use multiple kernel threads to implement it on platforms that have kernel threads • Java threads (extend Thread class) run by the Java Virtual Machine • Kernel threads • Linux has kernel threads (each has its own task_struct) – created with clone system call • Each user level thread maps to a single kernel thread (Windows 95/98/NT/2000/XP, OS/2) • Many user level threads can map onto many kernel level threads like scheduler activations (Windows NT/2000 with ThreadFiber package, Solaris 2)

  4. Scheduling Policy • We’ve talked about the context switch mechanism • How we change which process or thread is executing on the CPU • Today, we will talk about scheduling policies • How do we choose which process or thread to execute next • Unit of scheduling = process or thread

  5. Scheduler • Scheduler = the module that moves jobs from queue to queue • Scheduler typically runs when: • A process/thread blocks on a request (transitions from running to waiting) • A timer interrupt occurs • A new process/thread is created or is terminated

  6. Scheduling Algorithm • The scheduling algorithm examines the set of candidate processes/threads and chooses one to execute • Scheduling algorithms can have different goals • Maximize CPU utilization • Maximize throughput (#jobs/time) • Minimize average turnaround time ( Avg(EndTime – StartTime) ) • Minimize response time • Recall: Batch systems have which goal? Interative systems have which goal?

  7. Starvation • Starvation = process is prevented from making progress towards completion because another process has a resource that it needs • Scheduling policies should try to prevent starvation • E.g. Even low priority processes should eventually get some time on the CPU

  8. Brainstorm • What are some different ways to schedule access to a resource? • First Come First Serve • Many services humans use are like this? • Prefer Short Jobs • Express lane at the grocery store • Important Jobs First • Order you do your TODO list? Maybe round robin? • Now what about scheduling processes?

More Related