1 / 22

Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism

Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism. THOMAS E. ANDERSON, BRIAN N. BERSHAD, EDWARD D. , LAZOWSKA, and HENRY M. LEVY University of Washington Presenter: Neena Maldikar. What is User Thread and Kernel Thread.

reia
Download Presentation

Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism

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. Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism THOMAS E. ANDERSON, BRIAN N. BERSHAD, EDWARD D. , LAZOWSKA, and HENRY M. LEVY University of Washington Presenter: Neena Maldikar CS533 - Concepts of Operating Systems

  2. What is User Thread and Kernel Thread CS533 - Concepts of Operating Systems Source: http://siber.cankaya.edu.tr/OperatingSystems/week5/node5.html

  3. Kernel Threads Cons: • Too heavyweight • Performance is affected by • System calls needed to perform thread operations • Security checking required for every thread operation in order to protect kernel from malicious programs. • Generic: because used by all the applications causing overhead Pros: • Directly scheduled by kernel, hence no system integration issues CS533 - Concepts of Operating Systems

  4. User Threads Pros: • Lightweight since at the user level, each application needs only the minimal amount of context saved with it, • Excellent performance because • Thread management requires no kernel intervention • No threat of corrupting Operating System • Different applications can have different thread libraries. Hence, the functionality can be specific to the application. Cons: • Do not have same level of integration with system services as is available with kernel threads. • Can exhibit incorrect behavior in case of multiprogramming, I/O or pagefaults. CS533 - Concepts of Operating Systems

  5. Dilemma “employ user-level threads, which have good performance and correct behavior provided the application is uni-programmed and does no I/O, or employ kernel threads, which have worse performance but are not as restricted.” CS533 - Concepts of Operating Systems

  6. Goal Describe a kernel interface and a user-level thread package that together combine the functionality of kernel threads with the performance and flexibility of user-level threads. CS533 - Concepts of Operating Systems

  7. Why Kernel threads are the wrong abstraction for supporting user-level thread management? • Kernel threads block, resume, and are preempted without notification to the user level. • If user level thread blocks on I/O, kernel thread blocks and an application can run out of kernel threads • Kernel threads are not scheduled with respect to the user-level thread state. • E.g. consider that only one job is running in the system and it is using all the processors. If a new job comes in, operating system decides which threads to preempt. It can preempt a thread holding lock. CS533 - Concepts of Operating Systems

  8. Effective Kernel support for user-level threads • The kernel allocates virtual processors to address spaces • Each address space’s user-level thread system controls which threads to run on its allocated processors. • The kernel notifies the user-level thread system whenever it changes the number of processors assigned to it or when a user-level thread blocks/ wakes up in the kernel. • The user-level thread system notifies the kernel when the application needs more or fewer processors. CS533 - Concepts of Operating Systems

  9. What is Scheduler Activation? Scheduler Activation: • It is a scheme for communication between the kernel and the user-level thread system. • It is an invocation of the user level thread scheduler by the kernel – also known as ‘upcall’. • It is executed on a control flow created by kernel. • It brings along its own CPU either new or the one application was using before (in case of interrupt/ pagefault/ exception). • In the later case, it provides space in the kernel for saving the processor context of the activation's current user-level thread. (This is same as OS interrupt) • This space is provided with two stacks – one mapped into the kernel and the other one into the application address space CS533 - Concepts of Operating Systems

  10. How does it work User program User-Level Runtime system User-Level thread mgmnt system 4 runs 5 creates 6 more Operating System 7 creates Operating System Kernel 3 Upcall Upcall Upcall 1 creates Scheduler Activation Scheduler Activation Scheduler Activation 2 Assigns Processors CS533 - Concepts of Operating Systems

  11. Scheduler Activation Upcall Points CS533 - Concepts of Operating Systems

  12. How blocking requests are handled CS533 - Concepts of Operating Systems

  13. Scheduler activation System Calls An apparent drawback – Applications may not be honest! Solution: Multi-level feedback. The processor allocator can favor the processes the address spaces that use fewer processors and penalize the ones that use more. CS533 - Concepts of Operating Systems

  14. Critical Sections Problem • What if user-level thread is in critical section when it is blocked or preempted? • Poor performance • Deadlock • How to address this problem? • Prevention Avoid through the use of scheduling and locking protocols between kernel and user level. • Recovery An upcall informs the user-level thread system about preemption and the thread system checks if thread was executing in a critical section. If so, it is allowed to continue till by user level context switch. CS533 - Concepts of Operating Systems

  15. Implementation • The design was implemented by modifying Topaz (Operating System) and FastThreads (user-level thread package). • Performance Enhancements: • To avoid overhead of lock acquisition and release, critical section of the each thread is copied and it is executed if the thread is in critical section when the preemption happens. • Recyclescheduler activation CS533 - Concepts of Operating Systems

  16. Performance • Thread performance: There is no improvement over user-level thread package running on kernel threads • Upcall performance: Signal-wait time was found to be 2.4 msec – a factor of five worse than Topaz threads. CS533 - Concepts of Operating Systems

  17. Performance • Application performance Speedup of N-Body application versus number of processors, 100% of memory available. Execution time of N-Body application versus amount of available memory, 6 processors. CS533 - Concepts of Operating Systems

  18. Performance • Multiprogramming performance CS533 - Concepts of Operating Systems

  19. Conclusion • User-level threads are essential for high-performance. • However, kernel threads or processes, as provided in many operating systems, are poor abstraction on which to support user-level threads. • Scheduler activation design can be used to combine the performance of user-level threads and functionality of kernel threads. CS533 - Concepts of Operating Systems

  20. Other Implementations • Taos • Mach and the Mach-inspired Digital Unix • It was implemented in the NetBSD kernel by Nathan Williamsbut has been abandoned in favor of 1:1 threading.  • FreeBSD had a similar threading implementation calledKernel Scheduled Entities which is also being retired in favor of 1:1 threading. • Scheduler activations were also implemented as a patch for the Linux kernel by Vincent Danjean: Linux Activations, the user-level part being done in the Marcel thread library CS533 - Concepts of Operating Systems Source: http://en.wikipedia.org/wiki/Scheduler_activations http://web.mit.edu/nathanw/www/usenix/freenix-sa/freenix-sa.html

  21. CS533 - Concepts of Operating Systems

  22. Thank you! CS533 - Concepts of Operating Systems

More Related