Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner,

Similar presentations


Presentation on theme: "Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner,"— Presentation transcript:

1 Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner, A. Shivalingiah, M. Smith, D. Stein, J. Voll, M. Weeks, D. Williams – SunSoft, Inc. SUNAN Hayri Tolga ÇUBUKCUOGLU Aralık 2009

2 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 2 Kernel Architecture Overview Data Structures Kernel Thread Scheduling Synchronization Interrupts as Threads Implementing Interrupts as Threads Summary Contents

3 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 3 Kernel Architecture Overview A kernel thread is the fundamental entity that is scheduled and dispatched onto one of the CPUs ofthe system. A kernel thread is very lightweight, having only a small data structure and a stack. Kernel threads are fully preemptible. A major feature of the new kernel is its support of multiple kernel- supported threads of control, called lightweight processes (LWPs). LWPs in any user process, sharing the address space of the process and other resources, such as open files.

4 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 4 Kernel Architecture Overview - 2 Kernel thread fundamental entity scheduled and dispatched Includes kernel data structure and stack Fully preemptable User thread Fast context switch w/o entering kernel Allows large number of threads LWP Light weight process (LWP) Each LWP mapped one-to-one to a kernel thread Some kernel threads not assigned an LWP LWP CPU LWP CPU Process 1Process 2Process 3

5 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 5 Data Structures Per process data List of kernel threads associated with process Pointer to process address space User credentials List of signal handlers Per LWP data structure (swapable) User-level registers System call arguments Signal handling masks Resource usage information Profiling pointers Pointer to kernel thread and process structure Process User Virtual Memory Address Space LWP Thread Data (kernel) stack LWP data LWP Thread Data (kernel) stack LWP data … Thread data (not swapped) Kernel registers Scheduling class Dispatch queue links Pointers to stack, lwp, process, cpu structures CPU structure Pointer to currently executing thread, idle thread, Current dispatching and interrupt handler information

6 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 6 Kernel Thread Scheduling The scheduling classes currently supported are system, timesharing, and real-time (fixed-priority). The dispatcher chooses the thread with the greatest global priority to run on the CPU. Kernel is fully preemtible. Ex. –Thread A (high priority), B (low priority) –B releases lock that A is waiting (sleeping) on –B gives up CPU to allow A to run Ex 2. –Thread A high priority, Thread B low priority on CPU1 –Thread B better priority on CPU2 –CPU2 is directed to preempt its current thread and choose the best thread to run.

7 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 7 Synchronization Standard abstractions are supported: mutexes,condition variables, semaphores, readers/writer locks. The default blocking policy for mutexes, called adaptive (type MUTEX_DEFAULT), spins while the owner of the lock (recorded when the lock is acquired) remains running on a processor. When owner sleeps, caller sleeps. Spin Mutex Support

8 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 8 Interrupts as Threads For mutexes, the spin primitives must hold interrupt priority high enough while the lock is held to prevent any interrupt handlers that may also use the synchronization object from interrupting while the object is locked, causing deadlock. The interrupt level must be raised before the lock is acquired and then lowered after the lock is released. This is expensive, and makes interrupt coding inconvenient. SunOS solution… –Interrupt handlers are implemented as asynchronously created high priority threads. –Use standard synchronization primitives to control access to critical sections; interrupt handlers can sleep if necessary.

9 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 9 Implementing Interrupts as Threads For efficiency there are preallocated, partially initialized interrupt threads. Initially (after interrupt occurs), interrupt threads are not separate from interrupted thread, which is pinned, and cannot move to another CPU. If the interrupt thread blocks, then it becomes a full- fledged thread, separate from interrupted thread, and can be descheduled. CPU structure keeps track of interrupt level of blocked interrupt thread, so lower level interrupts are ignored.

10 GYTE - Bilgisayar Mühendisliği Bölümü BIL 521 Dönem Projesi 10 Summary SunOS 5.0 is a multithreaded and symmetric multiprocessor version of the SVR4 kernel. The primary features are: Fully preemptible, real-time kernel High degree of concurrency on symmetric multiprocessors Support for user threads Interrupts handled as independent threads Adaptive mutual-exclusion locks


Download ppt "Bilgisayar Mühendisliği Bölümü GYTE - Bilgisayar Mühendisliği Bölümü Multithreading the SunOS Kernel J. R. Eykholt, S. R. Kleiman, S. Barton, R. Faulkner,"

Similar presentations


Ads by Google