SlideShare a Scribd company logo
Prepared By:- Dhruvi Chapaneriya (150420116008)
Palak Dixit (150420116013)
Sonali Hiranandani (150420116021)
Maitry Jariwala (150420116027)
Branch:- B.E. INFORMATION TECHNOLOGY
Semester:- 04 (2nd YEAR)
Guided By:- Prof. Hiren Vavaiya
Topic:Threads
THREADS• CONCEPT OF MULTITHREADS
• BENEFITS OF THREADS
• TYPES OF THREADS
Slide name Slide no.
Definition of Threads 4
Diagram of Single and Multithreads 5
Concepts of Multithreads 6
Benefits of Threads 7
Types of Multithreading Models 8
One-To-One 9
Many-To-One 10
Many-To-Many 11
INDEX
Note: Click on the slide name to directly land on to particular slide
DEFINITION OF THREADS
• A thread is a basic unit of CPU utilization, consisting of a program counter, a
stack, and a set of registers, ( and a thread ID. )
• Traditional ( heavyweight ) processes have a single thread of control - There is
one program counter, and one sequence of instructions that can be carried out
at any given time.
• Threads are very useful in modern programming whenever a process has
multiple tasks to perform independently of the others.
• This is particularly true when one of the tasks may block, and it is desired to
allow the other tasks to proceed without blocking.
Single and Multithreaded Processes
CONCEPTS OF MULTITHREADS
• There are two types of threads exists
• User level thread
• Are supported above the kernel
• Managed without kernel support
• These are the threads that application programmers would put into their programs.
• Kernel Thread
• Supported directly by OS
• All modern OSes support kernel level threads, allowing the kernel to perform multiple
simultaneous tasks and/or to service multiple kernel system calls simultaneously.
• Windows XP, Linux, Mac OS, Solaris, True64 Unix – support kernel thread
• Furthermore, There must exist a relationship between user threads and kernel threads.
BENEFITS OF THREADS
• There are four major categories of benefits to multi-threading:
I. Responsiveness - One thread may provide rapid response while other threads are
blocked or slowed down doing intensive calculations.
II. Resource sharing - By default threads share common code, data, and other resources,
which allows multiple tasks to be performed simultaneously in a single address
space.
III.Economy - Creating and managing threads ( and context switches between them ) is
much faster than performing the same tasks for processes.
IV.Scalability, i.e. Utilization of multiprocessor architectures - A single threaded process
can only run on one CPU, no matter how many may be available, whereas the
execution of a multi-threaded application may be split amongst available processors.
TYPES OF MULTITHREADING MODELS
• One-to-One
• Many-to-One
• Many-to-Many
ONE-TO-ONE
• The one-to-one model creates a separate
kernel thread to handle each user thread.
• One-to-one model overcomes the problems
listed above involving blocking system calls
and the splitting of processes across multiple
CPUs.
• However the overhead of managing the one-
to-one model is more significant, involving
more overhead and slowing down the system.
• Most implementations of this model place a
limit on how many threads can be created.
• Linux and Windows from 95 to XP
implement the one-to-one model for threads. Figure - One-to-one model
MANY-TO-ONE
• In the many-to-one model, many user-level threads
are all mapped onto a single kernel thread.
• Thread management is handled by the thread
library in user space, which is very efficient.
• However, if a blocking system call is made, then
the entire process blocks, even if the other user
threads would otherwise be able to continue.
• Because a single kernel thread can operate only on
a single CPU, the many-to-one model does not
allow individual processes to be split across
multiple CPUs.
• Green threads for Solaris and GNU Portable
Threads implement the many-to-one model in the
past, but few systems continue to do so today. Figure - Many-to-one model
MANY-TO-MANY
• The many-to-many model multiplexes any number of user
threads onto an equal or smaller number of kernel threads,
combining the best features of the one-to-one and many-to-
one models.
• Users have no restrictions on the number of threads created.
• Blocking kernel system calls do not block the entire process.
• Processes can be split across multiple processors.
• Individual processes may be allocated variable numbers of
kernel threads, depending on the number of CPUs present
and other factors.
• One popular variation of the many-to-many model is the
two-tier model, which allows either many-to-many or one-
to-one operation.
• IRIX, HP-UX, and Tru64 UNIX use the two-tier model, as
did Solaris prior to Solaris 9.
Figure - Many-to-many model
Operating system: threads(mulithreading,benefits of threads, types of thread)
Ad

More Related Content

What's hot (20)

Unix memory management
Unix memory managementUnix memory management
Unix memory management
Tech_MX
 
Mutual exclusion and sync
Mutual exclusion and syncMutual exclusion and sync
Mutual exclusion and sync
Dr. C.V. Suresh Babu
 
Operating System: Deadlock
Operating System: DeadlockOperating System: Deadlock
Operating System: Deadlock
InteX Research Lab
 
Deadlock
DeadlockDeadlock
Deadlock
Daffodil international University
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
Pritom Saha Akash
 
Database security and security in networks
Database security and security in networksDatabase security and security in networks
Database security and security in networks
G Prachi
 
Dining Philosopher's Problem
Dining Philosopher's ProblemDining Philosopher's Problem
Dining Philosopher's Problem
Yash Mittal
 
Firewall Design and Implementation
Firewall Design and ImplementationFirewall Design and Implementation
Firewall Design and Implementation
ajeet singh
 
Linux security
Linux securityLinux security
Linux security
trilokchandra prakash
 
Data base security & integrity
Data base security &  integrityData base security &  integrity
Data base security & integrity
Pooja Dixit
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
Vajira Thambawita
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
sgpraju
 
DTrace Topics: Introduction
DTrace Topics: IntroductionDTrace Topics: Introduction
DTrace Topics: Introduction
Brendan Gregg
 
Architecture of operating system
Architecture of operating systemArchitecture of operating system
Architecture of operating system
Supriya Kumari
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
Sonali Chauhan
 
Reader/writer problem
Reader/writer problemReader/writer problem
Reader/writer problem
RinkuMonani
 
3.2 partitioning methods
3.2 partitioning methods3.2 partitioning methods
3.2 partitioning methods
Krish_ver2
 
CS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMSCS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMS
Kathirvel Ayyaswamy
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
SanthiNivas
 
Scheduling in Cloud Computing
Scheduling in Cloud ComputingScheduling in Cloud Computing
Scheduling in Cloud Computing
Hitesh Mohapatra
 
Unix memory management
Unix memory managementUnix memory management
Unix memory management
Tech_MX
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
Pritom Saha Akash
 
Database security and security in networks
Database security and security in networksDatabase security and security in networks
Database security and security in networks
G Prachi
 
Dining Philosopher's Problem
Dining Philosopher's ProblemDining Philosopher's Problem
Dining Philosopher's Problem
Yash Mittal
 
Firewall Design and Implementation
Firewall Design and ImplementationFirewall Design and Implementation
Firewall Design and Implementation
ajeet singh
 
Data base security & integrity
Data base security &  integrityData base security &  integrity
Data base security & integrity
Pooja Dixit
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
Vajira Thambawita
 
OS Process and Thread Concepts
OS Process and Thread ConceptsOS Process and Thread Concepts
OS Process and Thread Concepts
sgpraju
 
DTrace Topics: Introduction
DTrace Topics: IntroductionDTrace Topics: Introduction
DTrace Topics: Introduction
Brendan Gregg
 
Architecture of operating system
Architecture of operating systemArchitecture of operating system
Architecture of operating system
Supriya Kumari
 
Operating System-Threads-Galvin
Operating System-Threads-GalvinOperating System-Threads-Galvin
Operating System-Threads-Galvin
Sonali Chauhan
 
Reader/writer problem
Reader/writer problemReader/writer problem
Reader/writer problem
RinkuMonani
 
3.2 partitioning methods
3.2 partitioning methods3.2 partitioning methods
3.2 partitioning methods
Krish_ver2
 
Deadlock in Operating System
Deadlock in Operating SystemDeadlock in Operating System
Deadlock in Operating System
SanthiNivas
 
Scheduling in Cloud Computing
Scheduling in Cloud ComputingScheduling in Cloud Computing
Scheduling in Cloud Computing
Hitesh Mohapatra
 

Similar to Operating system: threads(mulithreading,benefits of threads, types of thread) (20)

Ch04 threads
Ch04 threadsCh04 threads
Ch04 threads
Nazir Ahmed
 
Lecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptxLecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptx
Amanuelmergia
 
15 threads
15 threads15 threads
15 threads
myrajendra
 
Threads.ppt
Threads.pptThreads.ppt
Threads.ppt
amadayshwan
 
W-9.pptx
W-9.pptxW-9.pptx
W-9.pptx
alianwarr
 
Os Threads
Os ThreadsOs Threads
Os Threads
Salman Memon
 
Multithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdfMultithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdf
Harika Pudugosula
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
Kumbirai Junior Muzavazi
 
Lecture 3- Threads.pdf
Lecture 3- Threads.pdfLecture 3- Threads.pdf
Lecture 3- Threads.pdf
Amanuelmergia
 
Ch4 threads
Ch4   threadsCh4   threads
Ch4 threads
Welly Dian Astika
 
Chapter04-OS.pptx........................
Chapter04-OS.pptx........................Chapter04-OS.pptx........................
Chapter04-OS.pptx........................
fakharsaleemraza
 
Treads
TreadsTreads
Treads
nayanashetty7
 
Multithreaded Programming in oprating system
Multithreaded Programming in oprating  systemMultithreaded Programming in oprating  system
Multithreaded Programming in oprating system
YOGENDRAMS
 
Threads lecture slides for operating systems
Threads lecture slides for operating systemsThreads lecture slides for operating systems
Threads lecture slides for operating systems
amirtarek401
 
Operating system 21 multithreading models
Operating system 21 multithreading modelsOperating system 21 multithreading models
Operating system 21 multithreading models
Vaibhav Khanna
 
1. What important part of the process switch operation is not shown .pdf
1. What important part of the process switch operation is not shown .pdf1. What important part of the process switch operation is not shown .pdf
1. What important part of the process switch operation is not shown .pdf
fathimaoptical
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.ppt
shreesha16
 
Multi threading models(operating systems)
Multi threading models(operating systems)Multi threading models(operating systems)
Multi threading models(operating systems)
jakeer3764
 
thread os.pptx
thread os.pptxthread os.pptx
thread os.pptx
SANJUSANJEEVTOPPO
 
Pthread
PthreadPthread
Pthread
Gopi Saiteja
 
Lecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptxLecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptx
Amanuelmergia
 
Multithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdfMultithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdf
Harika Pudugosula
 
Lecture 3- Threads.pdf
Lecture 3- Threads.pdfLecture 3- Threads.pdf
Lecture 3- Threads.pdf
Amanuelmergia
 
Chapter04-OS.pptx........................
Chapter04-OS.pptx........................Chapter04-OS.pptx........................
Chapter04-OS.pptx........................
fakharsaleemraza
 
Multithreaded Programming in oprating system
Multithreaded Programming in oprating  systemMultithreaded Programming in oprating  system
Multithreaded Programming in oprating system
YOGENDRAMS
 
Threads lecture slides for operating systems
Threads lecture slides for operating systemsThreads lecture slides for operating systems
Threads lecture slides for operating systems
amirtarek401
 
Operating system 21 multithreading models
Operating system 21 multithreading modelsOperating system 21 multithreading models
Operating system 21 multithreading models
Vaibhav Khanna
 
1. What important part of the process switch operation is not shown .pdf
1. What important part of the process switch operation is not shown .pdf1. What important part of the process switch operation is not shown .pdf
1. What important part of the process switch operation is not shown .pdf
fathimaoptical
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.ppt
shreesha16
 
Multi threading models(operating systems)
Multi threading models(operating systems)Multi threading models(operating systems)
Multi threading models(operating systems)
jakeer3764
 
Ad

Recently uploaded (20)

Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjjseninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
AjijahamadKhaji
 
Working with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to ImplementationWorking with USDOT UTCs: From Conception to Implementation
Working with USDOT UTCs: From Conception to Implementation
Alabama Transportation Assistance Program
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Journal of Soft Computing in Civil Engineering
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
acid base ppt and their specific application in food
acid base ppt and their specific application in foodacid base ppt and their specific application in food
acid base ppt and their specific application in food
Fatehatun Noor
 
Evonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdfEvonik Overview Visiomer Specialty Methacrylates.pdf
Evonik Overview Visiomer Specialty Methacrylates.pdf
szhang13
 
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjjseninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
seninarppt.pptx1bhjiikjhggghjykoirgjuyhhhjj
AjijahamadKhaji
 
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdfML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
ML_Unit_V_RDC_ASSOCIATION AND DIMENSIONALITY REDUCTION.pdf
rameshwarchintamani
 
2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt2.3 Genetically Modified Organisms (1).ppt
2.3 Genetically Modified Organisms (1).ppt
rakshaiya16
 
introduction technology technology tec.pptx
introduction technology technology tec.pptxintroduction technology technology tec.pptx
introduction technology technology tec.pptx
Iftikhar70
 
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink DisplayHow to Build a Desktop Weather Station Using ESP32 and E-ink Display
How to Build a Desktop Weather Station Using ESP32 and E-ink Display
CircuitDigest
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
Autodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User InterfaceAutodesk Fusion 2025 Tutorial: User Interface
Autodesk Fusion 2025 Tutorial: User Interface
Atif Razi
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Uses of drones in civil construction.pdf
Uses of drones in civil construction.pdfUses of drones in civil construction.pdf
Uses of drones in civil construction.pdf
surajsen1729
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Applications of Centroid in Structural Engineering
Applications of Centroid in Structural EngineeringApplications of Centroid in Structural Engineering
Applications of Centroid in Structural Engineering
suvrojyotihalder2006
 
Ad

Operating system: threads(mulithreading,benefits of threads, types of thread)

  • 1. Prepared By:- Dhruvi Chapaneriya (150420116008) Palak Dixit (150420116013) Sonali Hiranandani (150420116021) Maitry Jariwala (150420116027) Branch:- B.E. INFORMATION TECHNOLOGY Semester:- 04 (2nd YEAR) Guided By:- Prof. Hiren Vavaiya Topic:Threads
  • 2. THREADS• CONCEPT OF MULTITHREADS • BENEFITS OF THREADS • TYPES OF THREADS
  • 3. Slide name Slide no. Definition of Threads 4 Diagram of Single and Multithreads 5 Concepts of Multithreads 6 Benefits of Threads 7 Types of Multithreading Models 8 One-To-One 9 Many-To-One 10 Many-To-Many 11 INDEX Note: Click on the slide name to directly land on to particular slide
  • 4. DEFINITION OF THREADS • A thread is a basic unit of CPU utilization, consisting of a program counter, a stack, and a set of registers, ( and a thread ID. ) • Traditional ( heavyweight ) processes have a single thread of control - There is one program counter, and one sequence of instructions that can be carried out at any given time. • Threads are very useful in modern programming whenever a process has multiple tasks to perform independently of the others. • This is particularly true when one of the tasks may block, and it is desired to allow the other tasks to proceed without blocking.
  • 6. CONCEPTS OF MULTITHREADS • There are two types of threads exists • User level thread • Are supported above the kernel • Managed without kernel support • These are the threads that application programmers would put into their programs. • Kernel Thread • Supported directly by OS • All modern OSes support kernel level threads, allowing the kernel to perform multiple simultaneous tasks and/or to service multiple kernel system calls simultaneously. • Windows XP, Linux, Mac OS, Solaris, True64 Unix – support kernel thread • Furthermore, There must exist a relationship between user threads and kernel threads.
  • 7. BENEFITS OF THREADS • There are four major categories of benefits to multi-threading: I. Responsiveness - One thread may provide rapid response while other threads are blocked or slowed down doing intensive calculations. II. Resource sharing - By default threads share common code, data, and other resources, which allows multiple tasks to be performed simultaneously in a single address space. III.Economy - Creating and managing threads ( and context switches between them ) is much faster than performing the same tasks for processes. IV.Scalability, i.e. Utilization of multiprocessor architectures - A single threaded process can only run on one CPU, no matter how many may be available, whereas the execution of a multi-threaded application may be split amongst available processors.
  • 8. TYPES OF MULTITHREADING MODELS • One-to-One • Many-to-One • Many-to-Many
  • 9. ONE-TO-ONE • The one-to-one model creates a separate kernel thread to handle each user thread. • One-to-one model overcomes the problems listed above involving blocking system calls and the splitting of processes across multiple CPUs. • However the overhead of managing the one- to-one model is more significant, involving more overhead and slowing down the system. • Most implementations of this model place a limit on how many threads can be created. • Linux and Windows from 95 to XP implement the one-to-one model for threads. Figure - One-to-one model
  • 10. MANY-TO-ONE • In the many-to-one model, many user-level threads are all mapped onto a single kernel thread. • Thread management is handled by the thread library in user space, which is very efficient. • However, if a blocking system call is made, then the entire process blocks, even if the other user threads would otherwise be able to continue. • Because a single kernel thread can operate only on a single CPU, the many-to-one model does not allow individual processes to be split across multiple CPUs. • Green threads for Solaris and GNU Portable Threads implement the many-to-one model in the past, but few systems continue to do so today. Figure - Many-to-one model
  • 11. MANY-TO-MANY • The many-to-many model multiplexes any number of user threads onto an equal or smaller number of kernel threads, combining the best features of the one-to-one and many-to- one models. • Users have no restrictions on the number of threads created. • Blocking kernel system calls do not block the entire process. • Processes can be split across multiple processors. • Individual processes may be allocated variable numbers of kernel threads, depending on the number of CPUs present and other factors. • One popular variation of the many-to-many model is the two-tier model, which allows either many-to-many or one- to-one operation. • IRIX, HP-UX, and Tru64 UNIX use the two-tier model, as did Solaris prior to Solaris 9. Figure - Many-to-many model
  翻译: