0% found this document useful (0 votes)
10 views12 pages

Operating System

A thread is a lightweight process that allows for parallel execution within a program, improving application performance. There are various types of threads, including user-level and kernel-level threads, and three multithreading models: one-to-one, many-to-one, and many-to-many, each with its own advantages and disadvantages. While threads offer benefits like resource sharing and efficient communication, they also have drawbacks such as security concerns and potential blocking of parent threads affecting child threads.

Uploaded by

bhosleharshada14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views12 pages

Operating System

A thread is a lightweight process that allows for parallel execution within a program, improving application performance. There are various types of threads, including user-level and kernel-level threads, and three multithreading models: one-to-one, many-to-one, and many-to-many, each with its own advantages and disadvantages. While threads offer benefits like resource sharing and efficient communication, they also have drawbacks such as security concerns and potential blocking of parent threads affecting child threads.

Uploaded by

bhosleharshada14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

THREADS

Harshada Bhosale
ROLL NO: TI2121
THREAD
A thread is a flow of execution through the process code, with its own program counter, system
register and stacks. A thread is also called as a light weight process. Thread provides a way to
improve application performance through parallelism.
Each thread belongs to exactly one process and no thread can exists outside the process.
Difference between process and thread:
S.N Process Thread

1. Process is heavy weight or resource Thread is light weight and lesser


intensive resources than a process.
2. An executing instance of program is The thread is subset of process
called process
3. Run in separate in memory spaces Run in shared memory spaces

4. It does not share single handling It shares single handling

5. Process are independent Thread are dependent


Types of threads :
1. User level threads ( ULT )
User level threads implements in user level libraries, so thread switching does
not need to call operating system and to cause the interrupt to the kelrnel.
In fact the kernel knows nothing about the user level thread and manages
them as if the were single threades process.
2. Kernel level threads ( KLT ) :
In this method, kernel knows about and manages the thread. No
runtime system is need in this case. Operating system kernel provides
system call to create and manage thread.
Multithreaded Model :
There are three common ways to establish the relationship between
user level threads and kernel level threads each resulting in a specific
multithreading model.
The three multithreading models are Many-to-one, One-to-one and
Many-to-many explained in this section.
1. One to one model :
In one-to-one thread model, one-to-one relationship between a
user-level thread to a kernel-level thread.
Example, OS/2, Windows NT and windows 2000 use one-t- one
relationship model.
User Thread
Kernel Thread
Advantages :
i. This model provides more concurrency than the many to one model.
ii. It supports multiple threads to execute in parallel on
microprocessors.

Disadvantages :
i. Each user thread, the kernel thread is required.
ii. Creating a kernel thread is overhead.
iii. It reduces the performance of system.
2. Many to one thread :
The many-to-one model maps many user level threads to one kernel
thread. Thread management is done in user space, so it is efficient,
but the entire process will block if a thread makes a blocking system
call.
Advantages :
i. One kernel thread controls multiple user threads.
ii. It is efficient because thread management is done by thread library.
iii. Used in language systems, portable libraries.

Disadvantages :
i. The disadvantage is entire process will block if a thread makes blocking
system call.
ii. Multiple threads are not able to run in parallel since only one thread can
be accessed by kernel at a time.
3. Many to many thread :
In this model, many user level threads multiplex 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.
Solaris 2, IRIX, HP-UX and Tru64 UNIX support many to many thread
model.
Advantages :
i. Many threads can be created as per user’s requirement.
ii. Provides the best accuracy on concurrency.
iii. When a thread performs a blocking system call, the kernel can
schedule another thread for execution.
iv. Multiple kernel or equal to user threads can be created.

Disadvantages:
i. Multiple threads of kernel are an overhead for OS.
ii. Low performance.
iii. True concurrency cannot be achieved.
Benefit of threads :
1. Resourse sharing
2. Responsivness
3. Proper utilization and multiprocessor artchitecture
4. Economical
5. Efficient communication
6. Computational speed up

Advantages of Thread :
1. Thread minimizes context switching time.
2. Use of threads provides concurrency within process.
3. Efficient communication.
4. It is more economical to create and context switch thread
5. Utilization of multiprocessor architecture to a greater scale and efficiency.
Disadvantages of Threads :
1. Blocking of parent thread will stop all the child thread.
2. Security.

You might also like