including some slides modified from raymond namyst u
play

Including some slides modified - PowerPoint PPT Presentation

Including some slides modified from Raymond Namyst, U. Bordeaux An understanding of hybrid approaches to thread


  1. ��������������������� Including some slides modified from Raymond Namyst, U. Bordeaux

  2. ����������������� • An understanding of hybrid approaches to thread implementation • A high-level understanding of scheduler activations, and how they overcome the limitations of user-level and kernel-level threads.

  3. • Thomas Anderson, Brian Bershad, Edward Lazowska, and Henry Levy. Scheduler Activations: Effective Kernel Support for the User-Level management of Parallelism. ACM Trans. on Computer Systems 10(1), February 1992, pp. 53-79.

  4. ������������������ User Mode Scheduler Scheduler Scheduler Process A Process B Process C Scheduler Kernel Mode

  5. ������������������ � Fast thread management (creation, deletion, switching, synchronisation…) � Blocking blocks all threads in a process – Syscalls – Page faults � No thread-level parallelism on multiprocessor

  6. �������������������� User Mode Process A Process B Process C Scheduler Kernel Mode

  7. �������������������� � Slow thread management (creation, deletion, switching, synchronisation…) • System calls � Blocking blocks only the appropriate thread in a process � Thread-level parallelism on multiprocessor

  8. ����������� User-level Kernel-level threads threads

  9. ��������������������� User Mode Scheduler Scheduler Scheduler Process A Process B Process C Scheduler Kernel Mode

  10. ��������������������� � Can get real thread parallelism on multiprocessor � Blocking still a problem!!!

  11. ��������������������� • First proposed by [Anderson et al. 91] • Idea: Both schedulers co-operate • User scheduler uses system calls • Kernel scheduler uses upcalls! • Two important concepts – Upcalls • Notify the user-level of kernel scheduling events – Activations • A new structure to support upcalls and execution – approximately a kernel thread • As many running activations as (allocated) processors • Kernel controls activation creation and destruction

  12. ��������������������� CPU time wasted • Instead of syscall User Space I/O request interrupt Kernel Space Hardware • …rather use the following scheme: CPU used User Space upcall upcall Kernel Space Hardware

  13. � �������������������� ��������� • New (processor #) – Allocated a new virtual CPU – Can schedule a user-level thread • Preempted (activation # and its machine state) – Deallocated a virtual CPU – Can schedule one less thread • Blocked (activation #) – Notifies thread has blocked – Can schedule another user-level thread • Unblocked (activation # and its machine state) – Notifies a thread has become runnable – Must decided to continue current or unblocked thread

  14. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 User scheduler

  15. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 new A A

  16. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 new B A B

  17. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 A B

  18. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 Preempt A+B A B Preempt

  19. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 B

  20. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 A B Blocking syscall

  21. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 New C + blocked B A B C

  22. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 A B C I/O completion

  23. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 Unblocked B + preempt C A B C

  24. !��"���� ����� �� • Blocking syscall scenario on 2 processors Process 1 2 3 4 A B C

  25. ��������������������� • Thread management at user-level – Fast • Real thread parallelism via activations – Number of activations (virtual CPUs) can equal CPUs • Blocking (syscall or page fault) creates new activation – User-level scheduler can pick new runnable thread. • Fewer stacks in kernel – Blocked activations + number of virtual CPUs

  26. �����������

  27. ����������� #��� ���������$

  28. ������������ #%&��'����$

  29. ��� ���� • Adopters – BSD “Kernel Scheduled Entities” • Reverted back to kernel threads – Variants in Research OSs: K42, Barrelfish – Digital UNIX – Solaris – Mach – Windows 7 64-bit User Mode Scheduling • Linux -> kernel threads

Recommend


More recommend