chapter 5 cpu scheduling outline
play

Chapter 5: CPU Scheduling Outline Wh a t i s s c h e d u - PowerPoint PPT Presentation

Chapter 5: CPU Scheduling Outline Wh a t i s s c h e d u l i n g i n t h e O S ? Wh a t a r e c o m m o n s c h e d u l i n g c r i t e r i a ? H o w t o e v a l u a t


  1. Chapter 5: CPU Scheduling – Outline  Wh a t i s s c h e d u l i n g i n t h e O S ?  Wh a t a r e c o m m o n s c h e d u l i n g c r i t e r i a ?  H o w t o e v a l u a t e s c h e d u l i n g a l g o r i t h m s ?  Wh a t a r e c o m m o n s c h e d u l i n g a l g o r i t h m s ?  H o w i s t h r e a d s c h e d u l i n g d i fg e r e n t f r o m p r o c e s s s c h e d u l i n g ?  Wh a t a r e t h e i s s u e s i n m u l t i p l e - p r o c e s s o r s c h e d u l i n g ?  O p e r a t i n g s y s t e m s c a s e s t u d i e s . 1

  2. Basic Concepts  M u l t i p r o g r a m m i n g  m o s t p r o c e s s e s a l t e r n a t e b e t w e e n C P U b u r s t s a n d I / O b u r s t s  C P U f r e e a n d i d l e d u r i n g I / O b u r s t  s c h e d u l e a n o t h e r p r o c e s s o n t h e C P U  m a x i m i z e s C P U u t i l i z a t i o n  C P U b o u n d p r o c e s s  s p e n d s m o s t o f i t s t i m e i n t h e C P U  a t l e a s t a f e w l o n g C P U b u r s t s  I / O b o u n d p r o c e s s  s p e n d s m o s t i t s t i m e p e r f o r m i n g I / O  s e v e r a l s h o r t C P U b u r s t s 2

  3. CPU Scheduler  R e s p o n s i b l e f o r t h e s e l e c t i o n o f t h e n e x t r u n n i n g p r o c e s s  p a r t o f t h e O S d i s p a t c h e r  s e l e c t s f r o m a m o n g t h e p r o c e s s e s i n m e m o r y t h a t a r e r e a d y t o e x e c u t e  b a s e d o n a p a r t i c u l a r s t r a t e g y  Wh e n d o e s C P U s c h e d u l i n g h a p p e n ?  p r o c e s s s w i t c h e s f r o m r u n n i n g t o w a i t i n g s t a t e  p r o c e s s s w i t c h e s f r o m r u n n i n g t o r e a d y s t a t e  p r o c e s s s w i t c h e s f r o m w a i t i n g t o r e a d y s t a t e  p r o c e s s t e r m i n a t e s  S c h e d u l i n g u n d e r 1 a n d 4 i s n o n p r e e mp t i v e  A l l o t h e r s c h e d u l i n g i s p r e e mp t i v e 3

  4. Preemptive Vs. Non-preemptive CPU Scheduling  N o n - p r e e m p t i v e s c h e d u l i n g  p r o c e s s v o l u n t a r i l y r e l e a s e s t h e C P U ( c o n d i t i o n s 1 a n d 4 )  e a s y , r e q u i r e s n o s p e c i a l h a r d w a r e  p o o r r e s p o n s e t i m e f o r i n t e r a c t i v e a n d r e a l - t i m e s y s t e m s  P r e e m p t i v e s c h e d u l i n g  O S c a n f o r c e a r u n n i n g p r o c e s s i n v o l u n t a r i l y r e l i n q u i s h t h e C P U  a r r i v a l o f a h i g h e r p r i o r i t y p r o c e s s  r u n n i n g p r o c e s s e x c e e d s i t s t i m e - s l o t  m a y r e q u i r e s p e c i a l h a r d w a r e , e g . , t i m e r  m a y r e q u i r e s y n c h r o n i z a t i o n m e c h a n i s m s t o m a i n t a i n d a t a c o n s i s t e n c y  c o m p l i c a t e s d e s i g n o f t h e k e r n e l  f a v o r e d b y m o s t O S e s 4

  5. Dispatcher  S c h e d u l e r i s a p a r t o f t h e d i s p a t c h e r m o d u l e i n t h e O S  F u n c t i o n s o f t h e d i s p a t c h e r  g e t t h e n e w p r o c e s s f r o m t h e s c h e d u l e r  s w i t c h o u t t h e c o n t e x t o f t h e c u r r e n t p r o c e s s  g i v e C P U c o n t r o l t o t h e n e w p r o c e s s  j u m p t o t h e p r o p e r l o c a t i o n i n t h e n e w p r o g r a m t o r e s t a r t t h a t p r o g r a m  T i m e t a k e n b y t h e d i s p a t c h e r t o s t o p o n e p r o c e s s a n d s t a r t a n o t h e r r u n n i n g i s c a l l e d t h e d i s p a t c h l a t e n c y 5

  6. Scheduling Queues  J o b q u e u e : c o n s i s t s o f a l l p r o c e s s e s  a l l j o b s ( p r o c e s s e s ) , o n c e s u b m i t t e d , a r e i n t h e j o b q u e u e  s c h e d u l e d b y t h e l o n g - t e r m s c h e d u l e r  R e a d y q u e u e : c o n s i s t s o f p r o c e s s e s i n m e m o r y  p r o c e s s e s r e a d y a n d w a i t i n g f o r e x e c u t i o n  s c h e d u l e d b y t h e s h o r t - t e r m o r C P U s c h e d u l e r  D e v i c e q u e u e : p r o c e s s e s w a i t i n g f o r a d e v i c e  m u l t i p l e p r o c e s s e s c a n b e b l o c k e d f o r t h e s a m e d e v i c e  I / O c o m p l e t i o n m o v e s p r o c e s s b a c k t o r e a d y q u e u e 6

  7. Scheduling Queues (2) 7

  8. Performance Metrics for CPU Scheduling  C P U u t i l i z a t i o n : p e r c e n t a g e o f t i m e t h a t t h e C P U i s b u s y  T h r o u g h p u t : n u m b e r o f p r o c e s s e s t h a t c o m p l e t e t h e i r e x e c u t i o n p e r t i m e u n i t  T u r n a r o u n d t i m e : a m o u n t o f t i m e t o e x e c u t e a p a r t i c u l a r p r o c e s s ( s u b m i s s i o n t i m e t o c o m p l e t i o n t i m e )  Wa i t i n g t i m e : a m o u n t o f t i m e a p r o c e s s h a s b e e n w a i t i n g i n t h e r e a d y q u e u e  R e s p o n s e t i m e : a m o u n t o f t i m e i t t a k e s f r o m w h e n a r e q u e s t w a s s u b m i t t e d u n t i l t h e fj r s t r e s p o n s e i s p r o d u c e d  S c h e d u l i n g g o a l s  m a x i m i z e C P U u t i l i z a t i o n a n d t h r o u g h p u t  m i n i m i z e t u r n a r o u n d t i m e , w a i t i n g t i m e a n d r e s p o n s e t i m e 8  b e f a i r t o a l l p r o c e s s e s a n d a l l u s e r s

  9. Method for Evaluating CPU Scheduling Algorithms  E v a l u a t i o n c r i t e r i a  d e fj n e r e l a t i v e i m p o r t a n c e o f t h e p e r f o r m a n c e m e t r i c s  i n c l u d e o t h e r s y s t e m - s p e c i fj c m e a s u r e s  D e t e r m i n i s t i c m o d e l i n g  t a k e s a p a r t i c u l a r p r e d e t e r m i n e d w o r k l o a d a n d d e fj n e s t h e p e r f o r m a n c e o f e a c h a l g o r i t h m f o r t h a t w o r k l o a d  s i m p l e a n d f a s t , g i v e s e x a c t n u m b e r s  d i ffj c u l t t o g e n e r a l i z e r e s u l t s  c a n r e c o g n i z e a l g o r i t h m p e r f o r m a n c e t r e n d s o v e r s e v e r a l i n p u t s  u s e d f o r e x p l a i n i n g s c h e d u l i n g a l g o r i t h m s  u s e d i n t h e r e s t o f t h i s c h a p t e r ! 9

  10. Workload Models and Gantt Charts  Wo r k l o a d m o d e l : Process Arrival Time Burst Time P1 0 8 P2 1 4 P3 1 10 P4 6 2  G a n t t c h a r t s :  b a r c h a r t t o i l l u s t r a t e a p a r t i c u l a r s c h e d u l e  fj g u r e s h o w s b a t c h s c h e d u l e P1 P2 P3 P4 0 0 8 12 22 24 10

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend