Professional Documents
Culture Documents
Advantages of Thread:
➢ Responsiveness-Multithreading is an interactive application may allow a
program to continue running even if a part of it is blocked or is performing a
lengthy operation, thereby increasing responsiveness.
➢ Resource sharing-By default, threads share the memory and the resources of
the process to which they belong. The benefit of sharing code and data is that it
allows an application to have several different threads of activity within the
same address space.
➢ Economy-Allocating memory and resources for process creation is a costly
affairs as threads share the resources of the process to which they belong. It is
more economical to create context switch threads.
➢ Utilization of MP architectures-The benefit of multithreading can be greatly
increased in a multiprocessor architecture where threads may be running in
parallel on different processors.
Types of Thread:
➢ User Level Thread-All the work of thread management is done by the
application and kernel is not aware of the existence of threads. The thread
library contains code for creating and destroying threads for passing message
and data between threads.
➢ Advantages-
➢ Thread switching does not require kernel mode privileges
➢ It can run on any operating system
➢ Scheduling can be application specific
➢ It is faster to create and manage
➢ Disadvantages-
➢ In a typical OS, most system calls are blocking
➢ Multithreaded application cannot take advantage of multiprocessing
Types of Thread:
➢ Kernel Level Thread-Thread management done by the kernel. There is no
thread management code in the application area. Kernel threads are supported
directly by the OS. e.g., Windows XP/2000, Solaris, Linux,Tru64 UNIX, Mac
OS X
➢ Advantages-
➢ Kernel can simultaneously schedule multiple threads from the same process on
multiple processes
➢ If one thread in a process is blocked then the kernel can schedule another thread
of the same process
➢ Kernel routine themselves multithreaded.
➢ Disadvantages-
➢ Kernel thread are generally slower to create and mange
➢ Transfer of control from one thread to another thread within the same process
requires a mode switch to the kernel.
➢ Process ➢ Thread
➢ Heavy weight process ➢ Light weight process
➢ Process switching needs interface
with OS ➢ Thread switching does not need to call
➢ In multiple process implementation, a OS and cause an interrupt to the
each process executes the same code kernel
but has its own memory and file
resources ➢ All threads can share same set of open
➢ If one server process is blocked then files, child processes.
no other server process can execute ➢ While one server thread is blocked
until the first process unblocked.
and waiting, second thread in the same
➢ In multiple process, each process
operates independently task could run.
➢ One thread can read, write or even
completely wipe out another thread
stack.
Instructor: Prof M K Singh, Department of Mathematics and Computing, IIT(ISM) Dhanbad
Operating Systems
Course Code: MCC510
Multithreading Models:
➢ Many to Many Model- In this model, many user level threads
multiplexes to the kernel thread of smaller or equal numbers. The
number of kernel threads may be specific to either a particular
application or a particular machine.
➢ In this model, developers can create as many user thread as necessary
and the corresponding kernel threads can run in parallel on a
multiprocessor.
➢ Examples-Solaris prior to version 9, Windows NT/2000 with the thread
fiber package