G22.3250-001 Robert Grimm New York University Scheduler Activations.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Scheduler Activations: Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
Chapter 3 Process Description and Control
Chap 4 Multithreaded Programming. Thread A thread is a basic unit of CPU utilization It comprises a thread ID, a program counter, a register set and a.
CS 5204 – Operating Systems 1 Scheduler Activations.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
Computer Systems/Operating Systems - Class 8
Modified from Silberschatz, Galvin and Gagne ©2009 Lecture 7 Chapter 4: Threads (cont)
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
CS533 Concepts of Operating Systems Class 5 Integrated Task and Stack Management.
Today From threads to file systems
1 Threads, SMP, and Microkernels Chapter 4. 2 Process: Some Info. Motivation for threads! Two fundamental aspects of a “process”: Resource ownership Scheduling.
G Robert Grimm New York University Cool Pet Tricks with… …Virtual Memory.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
SCHEDULER ACTIVATIONS Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska, Henry.
Threads - Definition - Advantages using Threads - User and Kernel Threads - Multithreading Models - Java and Solaris Threads - Examples - Definition -
Scheduler Activations Effective Kernel Support for the User-Level Management of Parallelism.
Threads vs. Processes April 7, 2000 Instructor: Gary Kimura Slides courtesy of Hank Levy.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
Threads CSCI 444/544 Operating Systems Fall 2008.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
CS533 Concepts of Operating Systems Class 7 Integrated Task and Stack Management.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
1 Chapter 4 Threads Threads: Resource ownership and execution.
Scheduler Activations : Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Scheduler Activations On BSD: Sharing Thread Management Between Kernel and Application Christopher Small and Margo Seltzer Harvard University Presenter:
Scheduler Activations Jeff Chase. Threads in a Process Threads are useful at user-level – Parallelism, hide I/O latency, interactivity Option A (early.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Chapter 4 Threads, SMP, and Microkernels Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E.
Processes and Threads.
1 Process States (1) Possible process states –running –blocked –ready Transitions between states shown.
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 5: Threads Overview Multithreading Models Threading Issues Pthreads Solaris.
Processes and Threads Processes have two characteristics: – Resource ownership - process includes a virtual address space to hold the process image – Scheduling/execution.
Scheduler Activations: Effective Kernel Support for the User- Level Management of Parallelism. Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
Scheduler Activations: Effective Kernel Support for the User-level Management of Parallelism Thomas E. Anderson, Brian N. Bershad, Edward D. Lazowska,
The Performance of Microkernel-Based Systems
Scheduling Lecture 6. What is Scheduling? An O/S often has many pending tasks. –Threads, async callbacks, device input. The order may matter. –Policy,
CSE 60641: Operating Systems Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism. Thomas E. Anderson, Brian N.
Threads G.Anuradha (Reference : William Stallings)
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership: process includes a virtual address space to hold the process image (fig 3.16)
ITFN 3601 Introduction to Operating Systems Lecture 3 Processes, Threads & Scheduling Intro.
CSE 451: Operating Systems Winter 2015 Module 5 1 / 2 User-Level Threads & Scheduler Activations Mark Zbikowski 476 Allen Center.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 4: Threads.
Operating Systems: Internals and Design Principles
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Managing Processors Jeff Chase Duke University. The story so far: protected CPU mode user mode kernel mode kernel “top half” kernel “bottom half” (interrupt.
Processes and Threads MICROSOFT.  Process  Process Model  Process Creation  Process Termination  Process States  Implementation of Processes  Thread.
CS533 Concepts of Operating Systems Jonathan Walpole.
Operating System Concepts
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
Silberschatz, Galvin and Gagne ©2009Operating System Concepts – 8 th Edition Chapter 4: Threads.
Jonas Johansson Summarizing presentation of Scheduler Activations – A different approach to parallelism.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
CS 6560: Operating Systems Design
COT 5611 Operating Systems Design Principles Spring 2014
Fast Communication and User Level Parallelism
Thomas E. Anderson, Brian N. Bershad,
Threads vs. Processes Hank Levy 1.
CS510 Operating System Foundations
Outline Process Management Process manager Hardware process
CS703 – Advanced Operating Systems
Threads CSE 2431: Introduction to Operating Systems
Chapter 13: I/O Systems “The two main jobs of a computer are I/O and [CPU] processing. In many cases, the main job is I/O, and the [CPU] processing is.
Presentation transcript:

G Robert Grimm New York University Scheduler Activations

Nooks and Crannies  User/kernel protection domain changes  Use jump table (lots of system calls)  Do not require changes in page table (user/kernel bit)  Return through iret  Serialize processor execution  Flush pipeline  Commit outstanding memory writes  Linux tasts  Only unit of execution  Process tasks have address space, file descriptor table attached

Scheduler Activations

Altogether Now: The Three Questions  What is the problem?  What is new or different?  What are the contributions and limitations?

Threads  Provide a “natural” abstraction for concurrent tasks  Sequential stream of operations  Separate computation from address spaces, I/O descriptors  One element of a traditional Unix process  But also pose some non-trivial challenges  Can be hard to program (think: race conditions, deadlocks)  [Savage et al. ’97], [Engler & Ashcraft ’03]  Are hard to implement the right way  User-level vs. kernel-level (vs. processes)  Order of magnitude differences in performance

User-Level Threads  Advantages  Common operations can be implemented efficiently  Interface can be tailored to application needs  Issues  A blocking system call blocks all threads  Even select does not work for all system calls  A page fault blocks all threads  Matching threads to CPUs is hard  No knowledge about number of CPUs  No knowledge when a thread blocks

Kernel-Level Threads  Advantages  Blocking system calls and page faults handled correctly  Issues  Cost of performing thread operations  Create, exit, lock, signal, wait all require user/kernel crossings  On Pentium III, getpid: 365 cycles, procedure call: 7 cycles  Cost of generality  Kernel-threads must accommodate all “reasonable” implementation needs  Kernel-threads prevent application-specific optimizations  FIFO instead of priority scheduling for parallel applications

User-Level on Kernel-Level Threads  Many problems persist  Kernel threads do not notify user level  Kernel threads are scheduled without regard for user-level thread state  Thread priority  Critical sections, locks  Preemption can lead to priority inversion  Some problems get worse  Matching number of kernel threads with CPUs  Neither kernel nor user knows how many runnable threads  Making sure that user-level threads make progress

Enter Scheduler Activations  Let applications schedule threads  Best of user-level threads  Run same number of threads as there are CPUs  Best of kernel-level threads  Minimize number of user/kernel crossings  Make it practical

Scheduler Activations in Detail  Virtual CPUs  Execution always begins in user-level scheduler  User-level scheduler keeps activation to run thread  Threads preempted by kernel, but never resumed directly  Number of scheduler activations  One for each CPU  One for each blocked thread  Why?

Scheduler Activations in Detail (cont.)  Upcalls  New processor available  Processor has been preempted  Thread has blocked  Thread has unblocked  Downcalls  Need for more CPUs  CPU is idle  Preempt a lower priority thread  Return unused activation (in bulk)  After extracting user-level thread state

Scheduler Activations in Detail (cont.)  What is the number of user/kernel crossings?  For creating, exiting, locking, signaling, waiting?  For preemption, I/O?

An Example  I/O request (T1, T2) and completion (T3, T4)

Preemption  Where is the thread’s state?  Stack, control block at user-level  Registers at kernel-level  Returned with upcall  What about preempting threads in critical sections?  Poor performance if holding spinlock  Deadlock if holding lock for ready list  How to prevent these problems?  Detect thread in critical section  Finish critical section on next upcall  Copy of critical section returns to scheduler

Preemption (cont.)  What if thread in critical section is blocked on a page fault?  We have to take the performance hit  What if the scheduler causes a page fault?  We cannot create an infinite number of scheduler activations!  Rather, kernel detects this special case and delays activation

Evaluation

Micro-Benchmarks  What is the cost of thread operations? See above  What is the cost of making upcalls?  Cost of blocking/preemption should be the similar to kernel-threads for uniprocessors  But, reality is that implementation is five times slower  Written in Modula 2+  Compare to Topaz kernel threads written in assembly  What is the overall cost? See next slide

Application Performance Speedup with all memory available Execution time with limited memory Speedup with 2 applications

What Do You Think?