SlideShare a Scribd company logo
THREAD SCHEDULING




                  By-
             Nitish Gulati
THREADS…
 It is the basic unit of CPU utilization
 Comprises of
     thread ID,
     private storage area,
     register set, and
     a stack
Processes



Single Threaded               Multi Threaded
TYPES OF THREADS

                Threads



   User level             Kernel level
OPERATING SYSTEM ARCHITECTURE

                USER


                APPN.


               KERNEL




                 H/W
COMPARISON
Parameters           User Level Threads      Kernel Level
                                             Threads
1. Support           Managed without the     Managed by the OS
                     kernel


2 . Implementation   Through the following   Through the following
                     thread models           thread models
                     •many to many           •One to one
                     •many to one
3. Examples          Depends on the          •Windows XP
                     application             •Solaris 9
                                             •Linux
NEED OF THREAD SCHEDULING?
 To exploit the power of parallelism in a multiprocessor.
 Utilized in medium grained parallelism.
APPROACHES TO THREAD SCHEDULING
 Load Sharing
 Dedicated Processor Assignment

 Dynamic Scheduling
LOAD SHARING

  T1         T2        T3        T4   T5




  P1    P2        P3        P4
ADVANTAGES OF LOAD SHARING
 Load distributed evenly across the processors
 No centralized scheduler required

 Global queue can be organized and accessed
DISADVANTAGES OF LOAD SHARING
   Central queue needs mutual exclusion
DEDICATED PROCESSOR ASSIGNMENT
 When application is scheduled, its threads are
  assigned to a processor that remains dedicated to
  it.
 Some processors may be idle

 No multiprogramming of processors
Test results for multiprocessor system with 16 processors




                       Speedup drops off
                       when number of
                       threads exceeds
                       number of
                       processors
DYNAMIC SCHEDULING
 Number of threads in a process are altered dynamically
  by the application
 Operating system adjusts the load to improve utilization
CASE STUDY: SOLARIS
   Schedules threads based on priority.




                          Priority
                          Classes



                                   Time
Real Time          System                   Interactive
                                  Sharing
SOLARIS SCHEDULING
FEATURES OF PRIORITY IN SOLARIS
   Altered dynamically
                    250

                    200
     Time Quantum




                    150

                    100

                     50

                      0
                          1   2       3         4   5
                                   Priority
   Benefits-
     Good response time to interactive processes
     Good throughput
CASE STUDY: LINUX
 Uses a priority-based, preemptive scheduling
  algorithm.
 Interactive tasks are assigned higher priority



                      Priority
                      Scheme


            Real time             Nice
             [0-99]            [100-140]
RELATIONSHIP BETWEEN TIME SLICE AND PRIORITIES
250


               200
Time Quantum




               150


               100


                50


                 0
                     1   2      3       4   5
                             Priority
LIST OF TASKS INDEXED ACCORDING TO PRIORITY
CASE STUDY: WINDOWS XP
 Uses a priority-based, preemptive scheduling
  algorithm.
 The dispatcher uses a 32 bit priority scheme.




                     32 bit priority




                                  Real time
           Variable class
                                   class
               [1-15]
                                   [1-15]
 Distributed into classes
 Base priority.

 Priority is increased by the dispatcher.

 The increase depends on the operation.
EXAMPLE




  Initial Priority=8   Initial Priority=9




 After increase=11        After increase=12
THANK YOU

More Related Content

PPT
Memory Management in OS
PDF
Process scheduling (CPU Scheduling)
PDF
Memory management
PPT
CPU Scheduling Algorithms
PPTX
Page replacement algorithms
PPTX
Multi processor scheduling
PPTX
Process management os concept
Memory Management in OS
Process scheduling (CPU Scheduling)
Memory management
CPU Scheduling Algorithms
Page replacement algorithms
Multi processor scheduling
Process management os concept

What's hot (20)

PPTX
Segmentation in Operating Systems.
PPS
Virtual memory
PPTX
Disk structure
PDF
Disk allocation methods
PDF
Distributed Operating System_1
PPT
Free space managment46
PPT
Memory management
PPTX
Deadlock ppt
PPTX
Process in operating system
PDF
OS - Process Concepts
PPT
Operating system services 9
PDF
Multithreading
PPT
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
PPTX
MULTILEVEL QUEUE SCHEDULING
PPTX
distributed Computing system model
PPTX
Memory management ppt
PPTX
Operations on Processes
PPTX
Storage Management
Segmentation in Operating Systems.
Virtual memory
Disk structure
Disk allocation methods
Distributed Operating System_1
Free space managment46
Memory management
Deadlock ppt
Process in operating system
OS - Process Concepts
Operating system services 9
Multithreading
OPERATING SYSTEM SERVICES, OPERATING SYSTEM STRUCTURES
MULTILEVEL QUEUE SCHEDULING
distributed Computing system model
Memory management ppt
Operations on Processes
Storage Management
Ad

Similar to Thread scheduling in Operating Systems (20)

PDF
Solving Real-Time Scheduling Problems With RT_PREEMPT and Deadline-Based Sche...
PPTX
Windows process scheduling presentation
PPTX
Lecture 2 Processes in operating systems.pptx
PDF
Lect07
PPT
Module2 MultiThreads.ppt
PPT
Window scheduling algorithm
PPTX
Windows process-scheduling
PPT
cpu sechduling
PPTX
Engineeering Operating systemsOS UNIT 3 Threads.pptx
PPTX
OS_module2. .pptx
PPT
10-MultiprocessorScheduling chapter8.ppt
PPTX
Operating Systems - CPU Scheduling Process
PPTX
OS Module-2.pptx
PDF
Scheduling
PDF
Real time operating systems
PDF
CH06.pdf
PPTX
Operating system
PPTX
windows xp scheduling
Solving Real-Time Scheduling Problems With RT_PREEMPT and Deadline-Based Sche...
Windows process scheduling presentation
Lecture 2 Processes in operating systems.pptx
Lect07
Module2 MultiThreads.ppt
Window scheduling algorithm
Windows process-scheduling
cpu sechduling
Engineeering Operating systemsOS UNIT 3 Threads.pptx
OS_module2. .pptx
10-MultiprocessorScheduling chapter8.ppt
Operating Systems - CPU Scheduling Process
OS Module-2.pptx
Scheduling
Real time operating systems
CH06.pdf
Operating system
windows xp scheduling
Ad

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Cloud computing and distributed systems.
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Approach and Philosophy of On baking technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Electronic commerce courselecture one. Pdf
PDF
Encapsulation theory and applications.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
MYSQL Presentation for SQL database connectivity
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Digital-Transformation-Roadmap-for-Companies.pptx
Understanding_Digital_Forensics_Presentation.pptx
Cloud computing and distributed systems.
20250228 LYD VKU AI Blended-Learning.pptx
Approach and Philosophy of On baking technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Electronic commerce courselecture one. Pdf
Encapsulation theory and applications.pdf
Review of recent advances in non-invasive hemoglobin estimation
MYSQL Presentation for SQL database connectivity
NewMind AI Weekly Chronicles - August'25 Week I
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Building Integrated photovoltaic BIPV_UPV.pdf
Spectral efficient network and resource selection model in 5G networks
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Thread scheduling in Operating Systems

  • 1. THREAD SCHEDULING By- Nitish Gulati
  • 2. THREADS…  It is the basic unit of CPU utilization  Comprises of  thread ID,  private storage area,  register set, and  a stack
  • 3. Processes Single Threaded Multi Threaded
  • 4. TYPES OF THREADS Threads User level Kernel level
  • 5. OPERATING SYSTEM ARCHITECTURE USER APPN. KERNEL H/W
  • 6. COMPARISON Parameters User Level Threads Kernel Level Threads 1. Support Managed without the Managed by the OS kernel 2 . Implementation Through the following Through the following thread models thread models •many to many •One to one •many to one 3. Examples Depends on the •Windows XP application •Solaris 9 •Linux
  • 7. NEED OF THREAD SCHEDULING?  To exploit the power of parallelism in a multiprocessor.  Utilized in medium grained parallelism.
  • 8. APPROACHES TO THREAD SCHEDULING  Load Sharing  Dedicated Processor Assignment  Dynamic Scheduling
  • 9. LOAD SHARING T1 T2 T3 T4 T5 P1 P2 P3 P4
  • 10. ADVANTAGES OF LOAD SHARING  Load distributed evenly across the processors  No centralized scheduler required  Global queue can be organized and accessed
  • 11. DISADVANTAGES OF LOAD SHARING  Central queue needs mutual exclusion
  • 12. DEDICATED PROCESSOR ASSIGNMENT  When application is scheduled, its threads are assigned to a processor that remains dedicated to it.  Some processors may be idle  No multiprogramming of processors
  • 13. Test results for multiprocessor system with 16 processors Speedup drops off when number of threads exceeds number of processors
  • 14. DYNAMIC SCHEDULING  Number of threads in a process are altered dynamically by the application  Operating system adjusts the load to improve utilization
  • 15. CASE STUDY: SOLARIS  Schedules threads based on priority. Priority Classes Time Real Time System Interactive Sharing
  • 17. FEATURES OF PRIORITY IN SOLARIS  Altered dynamically 250 200 Time Quantum 150 100 50 0 1 2 3 4 5 Priority  Benefits-  Good response time to interactive processes  Good throughput
  • 18. CASE STUDY: LINUX  Uses a priority-based, preemptive scheduling algorithm.  Interactive tasks are assigned higher priority Priority Scheme Real time Nice [0-99] [100-140]
  • 19. RELATIONSHIP BETWEEN TIME SLICE AND PRIORITIES
  • 20. 250 200 Time Quantum 150 100 50 0 1 2 3 4 5 Priority
  • 21. LIST OF TASKS INDEXED ACCORDING TO PRIORITY
  • 22. CASE STUDY: WINDOWS XP  Uses a priority-based, preemptive scheduling algorithm.  The dispatcher uses a 32 bit priority scheme. 32 bit priority Real time Variable class class [1-15] [1-15]
  • 23.  Distributed into classes  Base priority.  Priority is increased by the dispatcher.  The increase depends on the operation.
  • 24. EXAMPLE Initial Priority=8 Initial Priority=9 After increase=11 After increase=12

Editor's Notes

  • #3: private storage area(used for DLLs),register set(status of the processor), and a stack(user stack when running in user mode & kernel stack for kernel mode)
  • #4: As is clear from here, shares code & data section
  • #8: What exactly is medium grained parallelism? In 1 sentenceSingle application is a collection of threadsThreads usually interact frequently, affecting the performance of the entire application
  • #10: Processes not assigned to a particular processorA global queue of ready threads is maintainedEach processor, when idle , selects a thread from the queue.
  • #11: Explain 2nd point…when processor is available,schedulingalgo is run to select next ttread according to the desire of the programmer
  • #12: Add about Mach OSpointA refinement of the load-sharing technique is used in the Mach operating system[BLAC90, WEND89]. The operating system maintains a local run queue foreach processor and a shared global run queue. The local run queue is used bythreads that have been temporarily bound to a specific processor. A processor examinesthe local run queue first to give bound threads absolute preference over unboundthreads. As an example of the use of bound threads, one or more processorscould be dedicated to running processes that are part of the operating system.May be a bottleneck when more than one processor looks for work at the same time
  • #14: There are two observations regarding this extreme strategy that indicate better than expected performance:In a highly parallel system, with tens or hundreds of processors, each of which represents a small fraction of the cost of the system, processor utilization is no longer an extremely important metric for effectiveness or performance.Total avoidance of process switching during the lifetime of a program should result in a substantial speedup of that program
  • #17: As seen from the diag., the scheduler converts the threads priority into a global priority and then schedules the highest one foremost.The real time processes are given highest priority.
  • #18: Priority and time slice are inversely proportionalInteractive processes have a higher priorityCPU bound processes have a lower priority
  • #19: Interactivity is determined depending on the sleep time of the task, ie, how long it has been waiting for I/OTasks that are more interactive have higher sleep times
  • #22: A runnable task is considered eligible for execution as long as it has its remaining time quantumThe runnable tasks are maintained on a runqueue data structure which contains 2 priority arraysOn multiprocessors,each processor schedules the highest priority task from its own runqueueWhen exhausted the 2 arrays are exchanged
  • #23: Schedules threads using a priority-based, preemptive scheduling algorithm.
  • #24: divided according to the Win32 API.Each thread has a bWhen released from wait operation, its
  • #25: Addeg of foreground & background process