THREAD TYPES &
MULTITHREADING
KERNEL LEVEL THREADS
The implementation of kernel level threads enable the kernel itself to perform thread management.
Moreover, there is only an API to the kernel thread section.
• Advantages:
• The kernel can simultaneously
schedule multiple threads from the
same process on multiple processors.
• If one thread in a process is blocked,
the kernel can schedule another
thread from the same process.
o The kernel routines themselves can
be multithreaded.
COMBINED USER-LEVEL AND KERNEL-
LEVEL APPROACH
Implementing User/Kernel Level Approach tends to
bring in the best of both Approach, creating a thread
Library for Multithreading and assigning the threads
within the API from the User level, however it also
runs multiples threads within different processors.
• Thread Creation is in the User Level
• Thread Mapping is in the Kernel Level
MULTITHREADING
WHAT IS
MULTITHREADING?
The ability of an operating system (OS) to support
multiple, concurrent paths of execution within a
single process.
• Multithreading may also be limited by an
application to utilize the parallel resources
available to the application
• Object-Oriented Multithreaded processes is an
efficient way of implementing a server
application
CHARACTERISTICS OF MULTITHREADING
The memory overhead in multithreading is small. It only requires an extra stack, register space, and space
for thread-local data.
The central processing unit (CPU) overhead is small since it uses application programming interface (API)
calls.
The communication within the process and with other processes are faster.
The crash resilience in implementing multithreading is low. Any bug can crash the entire application
The memory usage is monitored via a system allocator, which may incur some CPU contention from multiple
threads, and fragmentation before the memory is reused.
EXAMPLES OF MULTITHREADED
APPLICATIONS
An application that creates thumbnails of photos from a collection of
images
A web browser that displays images or texts while retrieving data from
the network
A word processor that displays texts and responds to keystrokes or
mouse clicks while performing spelling and grammar check
BENEFITS OF MULTITHREADED
PROGRAMMING
Responsiveness: Incorporating the multithreading concept in an
interactive application allows a program to continue running even if
some part of it is blocked or performing a lengthy operation. Thus,
increasing the responsiveness of the application to the user.
Resource Sharing: Generally, threads share the memory and
resources of the process to which they belong. This allows
applications to have several different threads of activities within the
same address space.
Economical: Allocating memory and resources for process creation is
inefficient, but thread creation consumes less time and memory,
making it economical.
Scalability: The benefit of multithreading is greater when dealing
with multiprocessor architecture, where threads can run in parallel
on different processing cores.
THANK YOU