A thread is a flow of control within a process. A multithreaded process contains several different flows of control within the same address space. The benefits of multithreading include increased responsiveness to the user, resource sharing within the process, economy, and the ability to take advantage of multiprocessor architectures. User-level threads are threads that are visible to the programmer and are unknown to the kernel.
The operating-system kernel supports and manages kernel-level threads. In general, user-level threads are faster to create and manage than are kernel threads, as no intervention from the kernel is required. Three different types of models relate user and kernel threads:
The many-to-one model maps many user threads to a single kernel thread. The one-to-one model maps each user thread to a corresponding kernel thread. The many-to-many model multiplexes many user threads to a smaller or equal number of kernel threads.
|These Topics Are Also In Your Syllabus|
|1||Linux-Input & output||link|
|You May Find Something Very Interesting Here.||link|
|3||Naming and Transparency||link|
|4||Stateful Versus Stateless Service||link|
|5||Computer Security Classifications||link|
Most modern operating systems provide kernel support for threads; among these are Windows 98, NT, 2000, and XP, as well as Solaris and Linux. Thread libraries provide the application programmer with an API for creating and managing threads. Three primary thread libraries are in common use: POSIX Pthreads, Win32 threads for Windows systems, and Java threads.
Multithreaded programs introduce many challenges for the programmer, including the semantics of the f ork() and exec() system calls. Other issues include thread cancellation, signal handling, and thread-specific data.