SlideShare a Scribd company logo
1 of 11
Presented by: kanza batool (2096-2019)
 A thread is the smallest unit of processing that can be performed in an OS.
 A thread is a flow of execution through the process code, with its own program
counter that keeps track of which instruction to execute next, system registers which
hold its current working variables, and a stack which contains the execution history.
 Each thread belongs to exactly one process and no thread can exist outside a process.
 Threads are also known as Lightweight processes.
 For example, in a browser, many tabs can be viewed as threads. MS Word uses
many threads - formatting text from one thread, processing input from another
thread, etc.
In the operating system, there are two types of threads.
 User Level Threads − User managed threads.
 Kernel Level Threads − Operating System managed threads acting on kernel, an
operating system core.
 The user-level threads are managed by users and the kernel is not aware of it.
 These threads are faster to create and manage.
 The kernel manages them as if it was a single-threaded process.
 It is implemented using user-level libraries and not by system calls. So, no call to
the operating system is made when a thread switches the context.
 Each process has its own private thread table to keep the track of the threads.
 The kernel knows about the thread and is supported by the OS.
 The threads are created and implemented using system calls.
 The thread table is not present here for each process. The kernel has a thread
table to keep the track of all the threads present in the system.
 Kernel-level threads are slower to create and manage as compared to user-level
threads.
 Multithreading is a phenomenon of executing multiple threads at the same time.
Example: Playing a video and downloading it at the same time is an example of
multithreading.
 For user-level thread and kernel-level thread to function together there must exist
a relationship between them.
 This relation is established by using Multithreading Models.
There are three common ways of establishing this relationship.
 Many-to-One Model: multiple user threads are associated or mapped with one
kernel thread.
 One-to-One Model: The one to one model creates a separate kernel thread to
handle each and every user thread
 Many-to-Many Model: 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.
 Thread Control Blocks (TCBs) represents threads generated in the system.
 It contains information about the threads, such as it’s ID and states.
 The components have been defined below:
 Thread ID: It is a unique identifier assigned by the Operating System to the
thread when it is being created.
 Thread states: These are the states of the thread which changes as the thread
progresses through the system
 CPU information: It includes everything that the OS needs to know about, such as
how far the thread has progressed and what data is being used.
 Thread Priority: It indicates the weight (or priority) of the thread over other
threads which helps the thread scheduler to determine which thread should be
selected next from the READY queue.
 A pointer which points to the process which triggered the creation of this thread.
 A pointer which points to the thread(s) created by this thread.
 Performance: Threads improve the overall performance(throughput, computational
speed, responsiveness) of a program.
 Resource sharing: As the threads can share the memory and resources of any
process it allows any application to perform multiple activities inside the same
address space.
 Utilization of Multiple Processor Architecture: The different threads can run
parallel on the multiple processors hence, this enables the utilization of the
processor to a large extent and efficiency.
 Reduced Context Switching Time: The threads minimize the context switching time
as in Thread Switching, the virtual memory space remains the same.
 Concurrency: Thread provides concurrency within a process.
 Parallelism: Parallel programming techniques are easier to implement.
Concept of thread, multi thread, tcb

More Related Content

What's hot

Operating System 4
Operating System 4Operating System 4
Operating System 4
tech2click
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
Luis Goldster
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
Nitish Gulati
 

What's hot (20)

Threads .ppt
Threads .pptThreads .ppt
Threads .ppt
 
Lecture 3 threads
Lecture 3   threadsLecture 3   threads
Lecture 3 threads
 
Os Threads
Os ThreadsOs Threads
Os Threads
 
Threads ppt
Threads pptThreads ppt
Threads ppt
 
Operating System 4
Operating System 4Operating System 4
Operating System 4
 
Thread
ThreadThread
Thread
 
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 ..
 
Multithreading models.ppt
Multithreading models.pptMultithreading models.ppt
Multithreading models.ppt
 
Thread scheduling in Operating Systems
Thread scheduling in Operating SystemsThread scheduling in Operating Systems
Thread scheduling in Operating Systems
 
Treads
TreadsTreads
Treads
 
Multi threading model
Multi threading modelMulti threading model
Multi threading model
 
Thread (Operating System)
Thread  (Operating System)Thread  (Operating System)
Thread (Operating System)
 
Multi threading models
Multi threading modelsMulti threading models
Multi threading models
 
4 threads
4 threads4 threads
4 threads
 
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
 
Lecutur24 25
Lecutur24 25Lecutur24 25
Lecutur24 25
 
Threading
ThreadingThreading
Threading
 
Threads (operating System)
Threads (operating System)Threads (operating System)
Threads (operating System)
 
Multi threaded programming
Multi threaded programmingMulti threaded programming
Multi threaded programming
 
An Introduction to threads
An Introduction to threadsAn Introduction to threads
An Introduction to threads
 

Similar to Concept of thread, multi thread, tcb

OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
bleh23
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
mona_hakmy
 
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemProcess, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
LieYah Daliah
 
Operating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdfOperating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdf
JUSTSTYLISH3B2MOHALI
 

Similar to Concept of thread, multi thread, tcb (20)

dos slide share.pptx
dos slide share.pptxdos slide share.pptx
dos slide share.pptx
 
Wiki 2
Wiki 2Wiki 2
Wiki 2
 
Topic 4- processes.pptx
Topic 4- processes.pptxTopic 4- processes.pptx
Topic 4- processes.pptx
 
Epc 3.ppt
Epc 3.pptEpc 3.ppt
Epc 3.ppt
 
Threads
ThreadsThreads
Threads
 
OS Module-2.pptx
OS Module-2.pptxOS Module-2.pptx
OS Module-2.pptx
 
4.Process.ppt
4.Process.ppt4.Process.ppt
4.Process.ppt
 
Chapter04 new
Chapter04 newChapter04 new
Chapter04 new
 
Lecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptxLecture 3- Threads (1).pptx
Lecture 3- Threads (1).pptx
 
Lecture 3- Threads.pdf
Lecture 3- Threads.pdfLecture 3- Threads.pdf
Lecture 3- Threads.pdf
 
threads-ppfldkgsh;reghuiregiuhrughet.pptx
threads-ppfldkgsh;reghuiregiuhrughet.pptxthreads-ppfldkgsh;reghuiregiuhrughet.pptx
threads-ppfldkgsh;reghuiregiuhrughet.pptx
 
thread os.pptx
thread os.pptxthread os.pptx
thread os.pptx
 
Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2Operating System 4 1193308760782240 2
Operating System 4 1193308760782240 2
 
Operating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptxOperating Systems R20 Unit 2.pptx
Operating Systems R20 Unit 2.pptx
 
multi-threading
multi-threadingmulti-threading
multi-threading
 
Threads
ThreadsThreads
Threads
 
Operating Systems - "Chapter 4: Multithreaded Programming"
Operating Systems - "Chapter 4:  Multithreaded Programming"Operating Systems - "Chapter 4:  Multithreaded Programming"
Operating Systems - "Chapter 4: Multithreaded Programming"
 
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating SystemProcess, Threads, Symmetric Multiprocessing and Microkernels in Operating System
Process, Threads, Symmetric Multiprocessing and Microkernels in Operating System
 
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
Scheduler Activations - Effective Kernel Support for the User-Level Managemen...
 
Operating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdfOperating system (OS) itself is a process, what approaches are there.pdf
Operating system (OS) itself is a process, what approaches are there.pdf
 

More from Kanza batool

More from Kanza batool (6)

ecommerce-ppt.pdf
ecommerce-ppt.pdfecommerce-ppt.pdf
ecommerce-ppt.pdf
 
agile.pptx
agile.pptxagile.pptx
agile.pptx
 
Professional practice presentation.pptx
Professional practice presentation.pptxProfessional practice presentation.pptx
Professional practice presentation.pptx
 
Agile
AgileAgile
Agile
 
Set relationship, set operation and sigmoid
Set relationship, set operation and sigmoidSet relationship, set operation and sigmoid
Set relationship, set operation and sigmoid
 
Scheduling (sjf, fcfs and round robin
Scheduling (sjf, fcfs and round robinScheduling (sjf, fcfs and round robin
Scheduling (sjf, fcfs and round robin
 

Recently uploaded

Recently uploaded (20)

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Ă...
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
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
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
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
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
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...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
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
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 

Concept of thread, multi thread, tcb

  • 1. Presented by: kanza batool (2096-2019)
  • 2.  A thread is the smallest unit of processing that can be performed in an OS.  A thread is a flow of execution through the process code, with its own program counter that keeps track of which instruction to execute next, system registers which hold its current working variables, and a stack which contains the execution history.  Each thread belongs to exactly one process and no thread can exist outside a process.  Threads are also known as Lightweight processes.  For example, in a browser, many tabs can be viewed as threads. MS Word uses many threads - formatting text from one thread, processing input from another thread, etc.
  • 3. In the operating system, there are two types of threads.  User Level Threads − User managed threads.  Kernel Level Threads − Operating System managed threads acting on kernel, an operating system core.
  • 4.  The user-level threads are managed by users and the kernel is not aware of it.  These threads are faster to create and manage.  The kernel manages them as if it was a single-threaded process.  It is implemented using user-level libraries and not by system calls. So, no call to the operating system is made when a thread switches the context.  Each process has its own private thread table to keep the track of the threads.
  • 5.  The kernel knows about the thread and is supported by the OS.  The threads are created and implemented using system calls.  The thread table is not present here for each process. The kernel has a thread table to keep the track of all the threads present in the system.  Kernel-level threads are slower to create and manage as compared to user-level threads.
  • 6.  Multithreading is a phenomenon of executing multiple threads at the same time. Example: Playing a video and downloading it at the same time is an example of multithreading.  For user-level thread and kernel-level thread to function together there must exist a relationship between them.  This relation is established by using Multithreading Models.
  • 7. There are three common ways of establishing this relationship.  Many-to-One Model: multiple user threads are associated or mapped with one kernel thread.  One-to-One Model: The one to one model creates a separate kernel thread to handle each and every user thread  Many-to-Many Model: 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.
  • 8.  Thread Control Blocks (TCBs) represents threads generated in the system.  It contains information about the threads, such as it’s ID and states.
  • 9.  The components have been defined below:  Thread ID: It is a unique identifier assigned by the Operating System to the thread when it is being created.  Thread states: These are the states of the thread which changes as the thread progresses through the system  CPU information: It includes everything that the OS needs to know about, such as how far the thread has progressed and what data is being used.  Thread Priority: It indicates the weight (or priority) of the thread over other threads which helps the thread scheduler to determine which thread should be selected next from the READY queue.  A pointer which points to the process which triggered the creation of this thread.  A pointer which points to the thread(s) created by this thread.
  • 10.  Performance: Threads improve the overall performance(throughput, computational speed, responsiveness) of a program.  Resource sharing: As the threads can share the memory and resources of any process it allows any application to perform multiple activities inside the same address space.  Utilization of Multiple Processor Architecture: The different threads can run parallel on the multiple processors hence, this enables the utilization of the processor to a large extent and efficiency.  Reduced Context Switching Time: The threads minimize the context switching time as in Thread Switching, the virtual memory space remains the same.  Concurrency: Thread provides concurrency within a process.  Parallelism: Parallel programming techniques are easier to implement.