0% found this document useful (0 votes)
280 views4 pages

User vs Kernel Level Threads

User and Kernel Level Threads discusses the key differences between user level threads and kernel level threads. User level threads are implemented by user applications and are not recognized by the operating system, making context switching faster but causing all threads to block if one performs a blocking operation. In contrast, kernel level threads are implemented by the operating system, require hardware support for context switching, but allow threads to continue running independently if one performs a blocking operation. Examples of systems using each type of threading are provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
280 views4 pages

User vs Kernel Level Threads

User and Kernel Level Threads discusses the key differences between user level threads and kernel level threads. User level threads are implemented by user applications and are not recognized by the operating system, making context switching faster but causing all threads to block if one performs a blocking operation. In contrast, kernel level threads are implemented by the operating system, require hardware support for context switching, but allow threads to continue running independently if one performs a blocking operation. Examples of systems using each type of threading are provided.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

User and Kernel Level Threads:

User Level Thread:


 User thread are implemented by users.

 User thread are implemented by users.

 OS doesn’t recognize user level threads.

 Implementation of User threads is easy.

 Context switch time is less.

 Context switch requires no hardware support.

 If one user level thread perform blocking operation then entire process
will be blocked.

 User level threads are designed as dependent threads.

Examples are

a. Java thread

b. POSIX threads

c. WIN 32 threadd

Java Threads
Threads are the fundamental model of program execution in a
Java program, and the Java language and its API provide a rich set
of features for the creation and management of threads. All Java
programs comprise at least a single thread, even a simple Java
program consisting of only a main() method runs as a single
thread in the JVM. There are two techniques for creating threads
in a Java program. One approach is to create a new class that is
derived from the Thread class and to override its run() method. An
alternative—and more commonly used— technique is to define a
class that implements the Runnable interface.

POSIX
1. Pthreads refers to the POSIX standard (IEEE 1003.1c) defining an
API for thread creation and synchronization. Numerous systems
implement the Pthreads specification, including Solaris, Linux,
Mac OS X, and Tru64 UNIX
2. In a Pthreads program, separate threads begin execution in a
specified function, this is the runner () function. When this
program begins, a single thread of control begins in main().
3. After some initialization, main() creates a second thread that
begins control in the runner () function. Both threads share the
global data sum.
4. Pthreads are also termed as POSIX thread library. This can be
implemented either at the userspace or at the kernel space.
Pthreads library is often implemented at LINUX, UNIX, Solaris,
Mac OSX. The Pthread program must always have a pthread.h
header file.
Win32
Win32 thread libraries provide native, platform provided
implementation of threads. Unlike Linux which depends on 3rd party
threading providers by POSIX threads, Win32 threads are robust and
have better support in Windows world. Needless to say, you can also
use POSIX threads in Windows as well.

Kernel Level Thread:


 kernel threads are implemented by OS.
 Kernel threads are recognized by OS.

 Implementation of Kernel thread is complicated.

 Context switch time is more.

 Hardware support is needed.

 If one kernel thread perform blocking operation then another thread can
continue execution.

 Kernel level threads are designed as independent threads.

Examples are

a. windows

b. Linux

c. Tru64 UNIX

d. Mac OS X

Windows Kernel
The devices with the Microsoft Windows operating system consist of the
windows kernel. This kernel is called the Windows NT kernel. It is capable of
working with both uniprocessor and symmetrical multiprocessor-based
computers, and therefore, referred to as hybrid kernel as well. Windows
architecture consists of windows kernel, hardware abstraction layer (HAL),
drivers and other supporting services. These services operate in the kernel
mode.

The windows system can operate in two modes: the user mode and kernel
mode. The programs running in the user mode has limited access to system
resources. However, the programs running in the kernel model has no
restrictions to access system memory, hardware, and resources. The user
mode is capable of sending IO requests to the relevant kernel mode device
drivers by using the IO manager.
Linux Kernel
The kernel in the Linux based systems is called a Linux kernel. One major
reason for the popularity of the Linux kernel is that it is free and open source.
It has contributors all over the world.

Linux systems, the user programs can interact with the kernel by the
Application Programming Interface (API). The device drivers control the
hardware as a part of kernel’s functionality. There is an interface between
the kernel and loadable kernel modules (LKMs).

Tru64 UNIX
Tru64 UNIX is a discontinued 64-bit UNIX operating system for the Alpha
instruction set architecture (ISA), currently owned by Hewlett-Packard (HP).
Previously, Tru64 UNIX was a product of Compaq, and before that, Digital
Equipment Corporation (DEC), where it was known as Digital UNIX (originally
DEC OSF/1 AXP). As its original name suggests, Tru64 UNIX is based on the
OSF/1 operating system. DEC's previous UNIX product was known as Ultrix
and was based on BSD. Tru64 UNIX required the SRM boot firmware found
on Alpha-based computer systems.

Mac OS X
Mac OS X (with X representing Roman numeral ten) is an operating system
for Apple’s Macintosh computers. In addition to many distinct end user
functionalities, it supports multiple development technologies including
UNIX, Java, the proprietary Cocoa and Carbon runtime environments, and a
host of open source, Web, scripting, and database applications. Released in
2001, Mac OS X replaced its predecessor, “Classic” Mac OS version 9,
effectively introducing a new nomenclature. The following timeline of
updates used the same “Mac OS X” prefix.

You might also like