SlideShare a Scribd company logo
1 of 17
THREADS
(OPERATING SYSTEM)
Presented By :Prakhar Maurya
B.Sc. IT (3rd Semester)
@PRAKHAR
What is Thread ?
A thread is a flow of execution through the
process code, with its own program counter,
system registers and stack. A thread is also
called a light weight process. Threads provide a
way to improve application performance
through parallelism.
Each thread belongs to exactly one process
and no thread can exist outside a process.
@PRAKHAR
Single threaded Process and Multi-threaded Process
@PRAKHAR
Difference between Process and Threads :
S.N. Process Threads
1
. Process is heavy weight or
resource intensive.
Thread is light weight taking lesser
resources than a process.
2. Process switching needs
interaction with operating system.
Thread switching does not need to
interact with operating system.
3. In multiple processing
environments each process
executes the same code but has its
own memory and file resources.
All threads can share same set of
open files, child processes.
4. If one process is blocked then no
other process can execute until the
first process is unblocked.
While one thread is blocked and
waiting, second thread in the same
task can run.
5. Multiple processes without using
threads use more resources.
Multiple threaded processes use
fewer resources.
6. In multiple processes each process
operates independently of the
others.
One thread can read, write or
change another thread's data.
@PRAKHAR
Advantages of Threads :
• Thread minimizes context switching time.
• Use of threads provides concurrency within a process.
• Efficient communication.
• Economy- It is more economical to create and context switch
threads.
• Utilization of multiprocessor architectures to a greater scale and
efficiency.
@PRAKHAR
Disadvantages of Threads :
• Blocking of parent threads will stop all child thread.
• Security.
@PRAKHAR
Types of Threads :
Threads are implemented in following two
ways :
• User Level Threads (ULT)
• Kernel Level Threads (KLT)
@PRAKHAR
User Level Threads (ULT) :
User level thread implement in user level
libraries, so thread switching does not need
to call operating system and to cause
interrupt to the kernel.
In fact, the kernel knows nothing about
user level threads and manages them as if
they were single-threaded process.
@PRAKHAR
Advantages of ULT :
• User level threads does not require modification to operating
system.
• Easy to represent and manage.
• User level thread can run on any operating system.
• User level threads are fast and efficient.
Disadvantages of ULT :
• There is a lack of coordination between threads and operating
system kernel.
• ULT require non-blocking system call (i.e. Multithreaded kernel)
@PRAKHAR
Kernel Level Threads (KLT) :
In this method, the kernel knows about
and manages the threads. No runtime
system is needed in this case. Operating
system kernel provides system call to
create and manage threads.
@PRAKHAR
Advantages of KLT :
• Kernel can simultaneously schedule multiple threads from the
same process on multiple processes.
• If one thread in a process is blocked the kernel can schedule
another thread of the same process.
• Kernel routines themselves can multithreaded.
Disadvantages of KLT :
• Kernel thread are generally slower to create and manage than the
user threads.
• Kernel requires Thread Control Block (TCB) for each thread in the
pool, hence complexity increases.
@PRAKHAR
Difference between ULT and KLT :
S.N. User Level Thread Kernel Level Thread
1
. User level thread are faster to
create and manage.
Kernel level thread are slower to
create and manage.
2. Implementation is by a thread
library at the user level.
Operating system supports
creation of kernel level threads.
3. ULT is generic and can run on any
operating system.
KLT is specific to the operating
system.
4. Multi-Threaded can not take
advantages of multiprocessing.
Kernel routines themselves can be
multithreaded.
@PRAKHAR
Multi-Threading Models :
Some operating system provides a combined user
level thread and kernel level thread facility. Solaris
is a good example of this combined approch.
Multi-Threading models are three types.
• Many-to-One Model
• One-to-One Model
• Many-to-Many Model
@PRAKHAR
Many-to-One Model :
Implementation of the many-to-one
model (many user level thread to
one kernel level thread) allow the
application to create any number of
threads that can execute
concurrently. In this implementation,
all threads activity is restricted to
user space.
Additionally only one thread can
access the kernel at a time, so only
one schedulable entity is known to
the os.
@PRAKHAR
One-to-One Model :
The one-to-one model (one user
level thread to one kernel level
thread) is among the earliest
implementations of true
multithreading.In this
implementation, each ULT created
by the application is known to the
kernel,and all threads ca access the
kernel at the same time.
@PRAKHAR
Many-to-Many Model :
The many-to-many model (many
user level thread to many kernel
level thread) avoids many of the
limitations of the one-to-one model,
while extending multithreading
capabilities even further. The many-
to-many model also called two-level
model, minimize programing effort
while reducing the cost and weight
of each thread.
@PRAKHAR
“ THANK YOU !
@PRAKHAR

More Related Content

Similar to thread os.pptx

OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
bleh23
 

Similar to thread os.pptx (20)

OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
 
THREADS of Operating System by Noman Zahid
THREADS of Operating System by Noman Zahid THREADS of Operating System by Noman Zahid
THREADS of Operating System by Noman Zahid
 
Thread
ThreadThread
Thread
 
Thread
ThreadThread
Thread
 
Threading.pptx
Threading.pptxThreading.pptx
Threading.pptx
 
Concept of thread, multi thread, tcb
Concept of thread, multi thread, tcbConcept of thread, multi thread, tcb
Concept of thread, multi thread, tcb
 
Threads
ThreadsThreads
Threads
 
Thread (Operating System)
Thread  (Operating System)Thread  (Operating System)
Thread (Operating System)
 
Threads
ThreadsThreads
Threads
 
1 Multithreading basics.pptx
1 Multithreading basics.pptx1 Multithreading basics.pptx
1 Multithreading basics.pptx
 
Wiki 2
Wiki 2Wiki 2
Wiki 2
 
process and thread.pptx
process and thread.pptxprocess and thread.pptx
process and thread.pptx
 
Operating system 20 threads
Operating system 20 threadsOperating system 20 threads
Operating system 20 threads
 
Multithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdfMultithreaded Programming Part- II.pdf
Multithreaded Programming Part- II.pdf
 
Lecutur24 25
Lecutur24 25Lecutur24 25
Lecutur24 25
 
Lecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptxLecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptx
 
Threads.ppt
Threads.pptThreads.ppt
Threads.ppt
 
4.Process.ppt
4.Process.ppt4.Process.ppt
4.Process.ppt
 
Java Thread & Multithreading
Java Thread & MultithreadingJava Thread & Multithreading
Java Thread & Multithreading
 
Os Threads
Os ThreadsOs Threads
Os Threads
 

More from SANJUSANJEEVTOPPO

C language.pptx
C language.pptxC language.pptx
C language.pptx
SANJUSANJEEVTOPPO
 
binary tree.pptx
binary tree.pptxbinary tree.pptx
binary tree.pptx
SANJUSANJEEVTOPPO
 

More from SANJUSANJEEVTOPPO (9)

masterpages 1.pptx
masterpages 1.pptxmasterpages 1.pptx
masterpages 1.pptx
 
ppt2.pptx
ppt2.pptxppt2.pptx
ppt2.pptx
 
template c++.pptx
template c++.pptxtemplate c++.pptx
template c++.pptx
 
ppt1.pptx
ppt1.pptxppt1.pptx
ppt1.pptx
 
Entrepreneurship CS.pptx
Entrepreneurship CS.pptxEntrepreneurship CS.pptx
Entrepreneurship CS.pptx
 
sampling RM.pptx
sampling RM.pptxsampling RM.pptx
sampling RM.pptx
 
C language.pptx
C language.pptxC language.pptx
C language.pptx
 
binary tree.pptx
binary tree.pptxbinary tree.pptx
binary tree.pptx
 
stack ppt.pptx
stack ppt.pptxstack ppt.pptx
stack ppt.pptx
 

Recently uploaded

Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 

Recently uploaded (20)

NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 

thread os.pptx

  • 1. THREADS (OPERATING SYSTEM) Presented By :Prakhar Maurya B.Sc. IT (3rd Semester) @PRAKHAR
  • 2. What is Thread ? A thread is a flow of execution through the process code, with its own program counter, system registers and stack. A thread is also called a light weight process. Threads provide a way to improve application performance through parallelism. Each thread belongs to exactly one process and no thread can exist outside a process. @PRAKHAR
  • 3. Single threaded Process and Multi-threaded Process @PRAKHAR
  • 4. Difference between Process and Threads : S.N. Process Threads 1 . Process is heavy weight or resource intensive. Thread is light weight taking lesser resources than a process. 2. Process switching needs interaction with operating system. Thread switching does not need to interact with operating system. 3. In multiple processing environments each process executes the same code but has its own memory and file resources. All threads can share same set of open files, child processes. 4. If one process is blocked then no other process can execute until the first process is unblocked. While one thread is blocked and waiting, second thread in the same task can run. 5. Multiple processes without using threads use more resources. Multiple threaded processes use fewer resources. 6. In multiple processes each process operates independently of the others. One thread can read, write or change another thread's data. @PRAKHAR
  • 5. Advantages of Threads : • Thread minimizes context switching time. • Use of threads provides concurrency within a process. • Efficient communication. • Economy- It is more economical to create and context switch threads. • Utilization of multiprocessor architectures to a greater scale and efficiency. @PRAKHAR
  • 6. Disadvantages of Threads : • Blocking of parent threads will stop all child thread. • Security. @PRAKHAR
  • 7. Types of Threads : Threads are implemented in following two ways : • User Level Threads (ULT) • Kernel Level Threads (KLT) @PRAKHAR
  • 8. User Level Threads (ULT) : User level thread implement in user level libraries, so thread switching does not need to call operating system and to cause interrupt to the kernel. In fact, the kernel knows nothing about user level threads and manages them as if they were single-threaded process. @PRAKHAR
  • 9. Advantages of ULT : • User level threads does not require modification to operating system. • Easy to represent and manage. • User level thread can run on any operating system. • User level threads are fast and efficient. Disadvantages of ULT : • There is a lack of coordination between threads and operating system kernel. • ULT require non-blocking system call (i.e. Multithreaded kernel) @PRAKHAR
  • 10. Kernel Level Threads (KLT) : In this method, the kernel knows about and manages the threads. No runtime system is needed in this case. Operating system kernel provides system call to create and manage threads. @PRAKHAR
  • 11. Advantages of KLT : • Kernel can simultaneously schedule multiple threads from the same process on multiple processes. • If one thread in a process is blocked the kernel can schedule another thread of the same process. • Kernel routines themselves can multithreaded. Disadvantages of KLT : • Kernel thread are generally slower to create and manage than the user threads. • Kernel requires Thread Control Block (TCB) for each thread in the pool, hence complexity increases. @PRAKHAR
  • 12. Difference between ULT and KLT : S.N. User Level Thread Kernel Level Thread 1 . User level thread are faster to create and manage. Kernel level thread are slower to create and manage. 2. Implementation is by a thread library at the user level. Operating system supports creation of kernel level threads. 3. ULT is generic and can run on any operating system. KLT is specific to the operating system. 4. Multi-Threaded can not take advantages of multiprocessing. Kernel routines themselves can be multithreaded. @PRAKHAR
  • 13. Multi-Threading Models : Some operating system provides a combined user level thread and kernel level thread facility. Solaris is a good example of this combined approch. Multi-Threading models are three types. • Many-to-One Model • One-to-One Model • Many-to-Many Model @PRAKHAR
  • 14. Many-to-One Model : Implementation of the many-to-one model (many user level thread to one kernel level thread) allow the application to create any number of threads that can execute concurrently. In this implementation, all threads activity is restricted to user space. Additionally only one thread can access the kernel at a time, so only one schedulable entity is known to the os. @PRAKHAR
  • 15. One-to-One Model : The one-to-one model (one user level thread to one kernel level thread) is among the earliest implementations of true multithreading.In this implementation, each ULT created by the application is known to the kernel,and all threads ca access the kernel at the same time. @PRAKHAR
  • 16. Many-to-Many Model : The many-to-many model (many user level thread to many kernel level thread) avoids many of the limitations of the one-to-one model, while extending multithreading capabilities even further. The many- to-many model also called two-level model, minimize programing effort while reducing the cost and weight of each thread. @PRAKHAR
  • 17. “ THANK YOU ! @PRAKHAR