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)

More Related Content

What's hot

Threads
ThreadsThreads
Threads
atikkazimca
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
Prakhar Maurya
 
Thread management
Thread management Thread management
Thread management
Ayaan Adeel
 
Operating System 4
Operating System 4Operating System 4
Operating System 4tech2click
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating SystemsNitish Gulati
 
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
noman zahid
 
Multithreading models
Multithreading modelsMultithreading models
Multithreading modelsanoopkrishna2
 
Thread (Operating System)
Thread  (Operating System)Thread  (Operating System)
Thread (Operating System)
kiran Patel
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
Luis Goldster
 
threads and its types ....in operating system ..
threads and its types ....in operating system ..threads and its types ....in operating system ..
threads and its types ....in operating system ..
Nimrakhan89
 
Operating System Chapter 4 Multithreaded programming
Operating System Chapter 4 Multithreaded programmingOperating System Chapter 4 Multithreaded programming
Operating System Chapter 4 Multithreaded programming
guesta40f80
 
Multithreading
Multithreading Multithreading
Multithreading
WafaQKhan
 
Treads
TreadsTreads
Multi threading model
Multi threading modelMulti threading model
Multi threading model
annalakshmir2
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
Kumbirai Junior Muzavazi
 
Multi threading models
Multi threading modelsMulti threading models
Multi threading models
DarakhshanNayyab
 

What's hot (20)

Threads
ThreadsThreads
Threads
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Thread management
Thread management Thread management
Thread management
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
 
Thread
ThreadThread
Thread
 
OS_Ch5
OS_Ch5OS_Ch5
OS_Ch5
 
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
 
Multithreading models
Multithreading modelsMultithreading models
Multithreading models
 
Thread (Operating System)
Thread  (Operating System)Thread  (Operating System)
Thread (Operating System)
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
 
threads and its types ....in operating system ..
threads and its types ....in operating system ..threads and its types ....in operating system ..
threads and its types ....in operating system ..
 
Operating System Chapter 4 Multithreaded programming
Operating System Chapter 4 Multithreaded programmingOperating System Chapter 4 Multithreaded programming
Operating System Chapter 4 Multithreaded programming
 
Ch4 Threads
Ch4 ThreadsCh4 Threads
Ch4 Threads
 
Multithreading
Multithreading Multithreading
Multithreading
 
Treads
TreadsTreads
Treads
 
Multi threading model
Multi threading modelMulti threading model
Multi threading model
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
 
Multi threading models
Multi threading modelsMulti threading models
Multi threading models
 
Lecutur24 25
Lecutur24 25Lecutur24 25
Lecutur24 25
 

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

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
 
Threads.ppt
Threads.pptThreads.ppt
Threads.ppt
amadayshwan
 
W-9.pptx
W-9.pptxW-9.pptx
W-9.pptx
alianwarr
 
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
 
Ch4 threads
Ch4   threadsCh4   threads
Ch4 threads
Welly Dian Astika
 
Multithreaded Programming in oprating system
Multithreaded Programming in oprating  systemMultithreaded Programming in oprating  system
Multithreaded Programming in oprating system
YOGENDRAMS
 
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
 
Operating system 20 threads
Operating system 20 threadsOperating system 20 threads
Operating system 20 threads
Vaibhav Khanna
 
Thread
ThreadThread
Thread
sajidhuseyin
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
bleh23
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
Ra'Fat Al-Msie'deen
 

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

Ch04 threads
Ch04 threadsCh04 threads
Ch04 threads
 
Lecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptxLecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptx
 
15 threads
15 threads15 threads
15 threads
 
Threads.ppt
Threads.pptThreads.ppt
Threads.ppt
 
W-9.pptx
W-9.pptxW-9.pptx
W-9.pptx
 
Multithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdfMultithreaded Programming Part- I.pdf
Multithreaded Programming Part- I.pdf
 
Lecture 3- Threads.pdf
Lecture 3- Threads.pdfLecture 3- Threads.pdf
Lecture 3- Threads.pdf
 
Ch4 threads
Ch4   threadsCh4   threads
Ch4 threads
 
Multithreaded Programming in oprating system
Multithreaded Programming in oprating  systemMultithreaded Programming in oprating  system
Multithreaded Programming in oprating system
 
Operating system 21 multithreading models
Operating system 21 multithreading modelsOperating system 21 multithreading models
Operating system 21 multithreading models
 
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
 
Module2 MultiThreads.ppt
Module2 MultiThreads.pptModule2 MultiThreads.ppt
Module2 MultiThreads.ppt
 
Multi threading models(operating systems)
Multi threading models(operating systems)Multi threading models(operating systems)
Multi threading models(operating systems)
 
thread os.pptx
thread os.pptxthread os.pptx
thread os.pptx
 
Pthread
PthreadPthread
Pthread
 
Operating system 20 threads
Operating system 20 threadsOperating system 20 threads
Operating system 20 threads
 
Thread
ThreadThread
Thread
 
Thread
ThreadThread
Thread
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
 

Recently uploaded

DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
ShahidSultan24
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 

Recently uploaded (20)

DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
addressing modes in computer architecture
addressing modes  in computer architectureaddressing modes  in computer architecture
addressing modes in computer architecture
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 

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