Including some slides modified - - PowerPoint PPT Presentation

including some slides modified from raymond namyst u
SMART_READER_LITE
LIVE PREVIEW

Including some slides modified - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1
  • Including some slides modified from Raymond Namyst, U. Bordeaux
slide-2
SLIDE 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.

slide-3
SLIDE 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.

slide-4
SLIDE 4
  • Scheduler

Scheduler Scheduler Scheduler

Kernel Mode User Mode

Process A Process B Process C

slide-5
SLIDE 5
  • Fast thread management (creation, deletion,

switching, synchronisation…) Blocking blocks all threads in a process

– Syscalls – Page faults

No thread-level parallelism on multiprocessor

slide-6
SLIDE 6
  • Scheduler

Kernel Mode User Mode

Process A Process B Process C

slide-7
SLIDE 7
  • Slow thread management (creation, deletion,

switching, synchronisation…)

  • System calls

Blocking blocks only the appropriate thread in a process Thread-level parallelism on multiprocessor

slide-8
SLIDE 8
  • User-level

threads Kernel-level threads

slide-9
SLIDE 9
  • Scheduler

Scheduler Scheduler Scheduler

Kernel Mode User Mode

Process A Process B Process C

slide-10
SLIDE 10
  • Can get real thread parallelism on

multiprocessor Blocking still a problem!!!

slide-11
SLIDE 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
slide-12
SLIDE 12
slide-13
SLIDE 13
slide-14
SLIDE 14
slide-15
SLIDE 15
  • Instead of

Kernel Space User Space Hardware syscall

  • …rather use the following scheme:

Kernel Space User Space Hardware I/O request interrupt upcall upcall

CPU time wasted CPU used

slide-16
SLIDE 16
  • 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

slide-17
SLIDE 17

!"

  • Blocking syscall scenario on 2 processors

Process User scheduler 1 2 3 4

slide-18
SLIDE 18

!"

  • Blocking syscall scenario on 2 processors

Process

new A

1 2 3 4 A

slide-19
SLIDE 19

!"

  • Blocking syscall scenario on 2 processors

Process

new B

1 2 3 4 A B

slide-20
SLIDE 20

!"

  • Blocking syscall scenario on 2 processors

Process 1 2 3 4 A B

slide-21
SLIDE 21

!"

  • Blocking syscall scenario on 2 processors

Process

Preempt

Preempt A+B

1 2 3 4 A B

slide-22
SLIDE 22

!"

  • Blocking syscall scenario on 2 processors

Process 1 2 3 4 B

slide-23
SLIDE 23

!"

  • Blocking syscall scenario on 2 processors

Process

Blocking syscall

1 2 3 4 A B

slide-24
SLIDE 24

!"

  • Blocking syscall scenario on 2 processors

Process

New C + blocked B

1 2 3 4 A B C

slide-25
SLIDE 25

!"

  • Blocking syscall scenario on 2 processors

Process

I/O completion

1 2 3 4 A B C

slide-26
SLIDE 26

!"

  • Blocking syscall scenario on 2 processors

Process

Unblocked B + preempt C

1 2 3 4 A B C

slide-27
SLIDE 27

!"

  • Blocking syscall scenario on 2 processors

Process 1 2 3 4 A B C

slide-28
SLIDE 28
  • 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

slide-29
SLIDE 29
slide-30
SLIDE 30
  • # $
slide-31
SLIDE 31
  • #%&'$
slide-32
SLIDE 32
  • 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
slide-33
SLIDE 33