Rss Feed
SUBSTANIAL INFORMATION ABOUT THREADS OF OS

WINDOWS NT’s Threads


Processes in NT can consist of one or more threads.

[] Primary thread - When a process is created, one thread is generated along with it.

This object is then scheduled on a system wide basis by the kernel to execute on a processor.
After the primary thread has started, it can create other threads that share its address space and system resources but have independent contexts, which include execution stacks and thread specific data. A thread can execute any part of a process' code, including a part currently being executed by another thread.

It is through threads, provided in the Win32 application programmer interface (API), that Windows NT allows programmers to exploit the benefits of concurrency and parallelism.

[ ] Fiber - is NT’s smallest user-level object of execution. It executes in the context of a thread and is unknown to the operating system kernel. A thread can consist of one or more fibers as determined by the application programmer. ˝Some literature ˝[1,11] assume that there is a one-to-one mapping of userlevel objects to kernel-level objects, this is inaccurate. Windows NT does ˝provide the means for many-to-many ˝scheduling. However, NT's design is poorly documented and the application programmer is responsible for the control of fibers such as allocating memory, scheduling them on threads and preemption.

Solaris’s LWPs and Threads
[ ] light weight process (LWP) - Solaris’s smallest kernel-level object of execution.

A Solaris process consists of one or more light weight processes. Like NT’s thread, each LWP shares its address space and system resources with LWPs of the same process and has its own context. However, unlike NT, Solaris allows programmers to exploit parallelism through a user-level object that is built on light weight processes.

In Solaris, a thread is the smallest user-level object of execution. Like Windows NT's fiber, they
are not executable alone.

[ ] Solaris thread
* execute in the context of a light weight process.
* implemented and controlled by a system library.
The library controls the mapping and scheduling of threads onto LWPs automatically.
[ ] mapping - determined by the library or the application programmer. Since the threads execute in the context of a light weight process, the operating system kernel is unaware of their existence.

Solaris's thread library defines two types of threads according to scheduling.

[ ] bound thread is one that permanently executes in the context of a light weight process in which no other threads can execute. Consequently, the bound thread is scheduled by the operating system kernel on a system wide basis.
[ ] unbound thread is one that can execute in the context of any LWP of the same process. Solaris uses the thread library for the scheduling of these unbound threads. The library works by creating a pool of light weight processes for any requesting process. The initial size of the pool is one. The size can be automatically adjusted by the library or can be defined by the application programmer through a programmatic interface. It ˝is the library’s task to increase or decrease the pool size to meet the requirements of an application. Consequently, the pool size determines the concurrency level (CL) of the process. The threads of a process are scheduled on a LWP in the pool, by using a priority based, first-in first-out (FIFO) algorithm. The priority is the primary algorithm and FIFO is the secondary algorithm (within the same priority). In addition, a
thread with a lower priority may be preempted from a LWP by higher priority thread or by a library call.

0 comments: