chapter 3 processes
play

Chapter 3: Processes Wh a t i s a p r o c e s s ? Wh - PowerPoint PPT Presentation

Chapter 3: Processes Wh a t i s a p r o c e s s ? Wh a t i s 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 c o m m o n o p e r a t i o n s o n p r o c e s s e


  1. Chapter 3: Processes  Wh a t i s a p r o c e s s ?  Wh a t i s 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 c o m m o n o p e r a t i o n s o n p r o c e s s e s ?  H o w t o c o n d u c t p r o c e s s - l e v e l c o m m u n i c a t i o n ?  H o w t o c o n d u c t c l i e n t - s e r v e r c o m m u n i c a t i o n ? 1

  2. Process Concept  P r o c e s s  i s a p r o g r a m i n e x e c u t i o n  i s a n i n s t a n c e o f a c o m p u t e r p r o g r a m b e i n g s e q u e n t i a l l y e x e c u t e d  p r o c e s s e x e c u t i o n m u s t p r o g r e s s i n s e q u e n t i a l f a s h i o n  p r o c e s s i s a l s o c a l l e d a j o b  P r o g r a m V s . p r o c e s s  p r o g r a m i s a p a s s i v e e n t i t y ; p r o c e s s i s a n a c t i v e e n t i t y  p r o g r a m o n l y c o n t a i n s t e x t ; p r o c e s s i s a s s o c i a t e d w i t h c o d e , d a t a , P C , h e a p , s t a c k , r e g i s t e r s , a n d o t h e r i n f o r m a t i o n  p r o g r a m b e c o m e s a p r o c e s s w h e n a n e x e c u t a b l e fj l e i s l o a d e d i n t o m e m o r y  s a m e p r o g r a m e x e c u t e d m u l t i p l e t i m e s w i l l c o r r e s p o n d t o d i fg e r e n t p r o c e s s e a c h t i m e 2

  3. Process in Memory 3

  4. Process State  D u r i n g e x e c u t i o n , t h e p r o c e s s m a y b e i n o n e o f t h e f o l l o w i n g s t a t e s  n e w – p r o c e s s i s b e i n g c r e a t e d  r u n n i n g – i n s t r u c t i o n s a r e b e i n g e x e c u t e d  w a i t i n g – w a i t i n g f o r s o m e e v e n t t o o c c u r  r e a d y – w a i t i n g t o b e a s s i g n e d a p r o c e s s o r  t e r m i n a t e d – p r o c e s s h a s fj n i s h e d e x e c u t i o n  E a c h p r o c e s s o r c a n o n l y r u n o n e p r o c e s s a t a i n s t a n t . 4

  5. Diagram of Process State 5

  6. Process Control Block (PCB)  P C B i s r e p r e s e n t a t i o n o f a p r o c e s s i n a n o p e r a t i n g s y s t e m .  m a i n t a i n s p r o c e s s - s p e c i fj c i n f o r m a t i o n  n e c e s s a r y f o r s c h e d u l i n g  I n f o r m a t i o n a s s o c i a t e d w i t h e a c h p r o c e s s  p r o c e s s s t a t e  p r o g r a m c o u n t e r  C P U r e g i s t e r s  C P U s c h e d u l i n g i n f o r m a t i o n  m e m o r y - m a n a g e m e n t i n f o r m a t i o n  a c c o u n t i n g i n f o r m a t i o n  I / O s t a t u s i n f o r m a t i o n 6

  7. Process Control Block (PCB) (2) 7

  8. CPU Switch From Process to Process 8

  9. Process Representation in Linux task_struct R e p r e s e n t e d b y t h e C s t r u c t u r e pid t_pid; /* process identifier */ long state; /* state of the process */ unsigned int time_slice /* scheduling information */ struct task_struct *parent; /* this process’s parent */ struct list_head children; /* this process’s children */ struct files_struct *files; /* list of open files */ struct mm_struct *mm; /* address space of this process */ 9

  10. Process Scheduling  P r o c e s s s c h e d u l i n g s e l e c t s t h e p r o c e s s t o r u n o n a 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 i n a m u l t i p r o g r a m m i n g O S  p r o v i d e s i l l u s i o n o f e a c h p r o c e s s o w n i n g t h e s y s t e m i n a t i m e - s h a r e d O S  T e r m i n o l o g y u s e d i n O S s c h e d u l e r s  j o b q u e u e – s e t o f a l l p r o c e s s e s i n t h e s y s t e m  r e a d y q u e u e – s e t o f a l l p r o c e s s e s r e s i d i n g i n m a i n m e m o r y , r e a d y a n d w a i t i n g t o e x e c u t e  d e v i c e q u e u e s – s e t o f p r o c e s s e s w a i t i n g f o r a n I / O d e v i c e  P r o c e s s e s m i g r a t e a m o n g t h e v a r i o u s q u e u e s 10

  11. Ready Queue And Various I/O Device Queues 11

  12. Representation of Process Scheduling 12

  13. Schedulers  S y s t e m s w i t h a p o s s i b i l i t y o f h u g e d e l u g e o f j o b r e q u e s t s m a y u s e m u l t i p l e s c h e d u l e r s .  L o n g - t e r m s c h e d u l e r ( o r j o b s c h e d u l e r )  s e l e c t s p r o c e s s e s t o b e b r o u g h t i n t o t h e r e a d y q u e u e  c o n t r o l s t h e d e g r e e o f m u l t i p r o g r a m m i n g  c o n t r o l s t h e m i x o f a c t i v e C P U - b o u n d a n d I / O - b o u n d p r o c e s s e s  i n v o k e d i n f r e q u e n t l y  c a n a fg o r d m o r e t i m e t o m a k e s e l e c t i o n d e c i s i o n  S h o r t - t e r m s c h e d u l e r ( o r C P U s c h e d u l e r )  s e l e c t s t h e p r o c e s s t o b e e x e c u t e d n e x t a n d a l l o c a t e s C P U  i n v o k e d f r e q u e n t l y  n e c e s s a r y t o l i m i t s c h e d u l i n g o v e r h e a d 13

  14. Context Switch  A c o n t e x t s w i t c h i s t h e p r o c e s s o f s t o r i n g a n d r e s t o r i n g t h e s t a t e ( c o n t e x t ) o f t h e C P U s u c h t h a t m u l t i p l e p r o c e s s e s c a n s h a r e a s i n g l e C P U r e s o u r c e  f o r t i m e - s h a r e d o r m u l t i p r o g r a m m i n g e n v i r o n m e n t s  c o n t e x t o f a p r o c e s s r e p r e s e n t e d i n t h e P C B  c o n t e x t s w i t c h i n v o l v e s a s t a t e s a v e o f t h e c u r r e n t p r o c e s s , a n d a s t a t e r e s t o r e o f t h e p r o c e s s b e i n g r e s u m e d n e x t  s w i t c h f r o m u s e r t o k e r n e l m o d e o r v i c e - v e r s a i s a m o d e s w i t c h  C o n t e x t - s w i t c h t i m e i s o v e r h e a d  t h e s y s t e m d o e s n o u s e f u l w o r k w h i l e s w i t c h i n g  o v e r h e a d d e p e n d s o n h a r d w a r e s u p p o r t  S u n U l t r a S P A R C p r o v i d e s m u l t i p l e b a n k s o f r e g i s t e r s  I n t e l x 8 6 p r o c e s s o r s a l s o p r o v i d e s o m e s u p p o r t 14

  15. Process Creation  A n y p r o c e s s c a n c r e a t e o t h e r p r o c e s s e s d u r i n g i t s e x e c u t i o n  o p e r a t i n g s y s t e m s h a v e a p r i m o r d i a l p r o c e s s  c r e a t i n g p r o c e s s c a l l e d p a r e n t p r o c e s s  n e w p r o c e s s c a l l e d c h i l d p r o c e s s  p r o c e s s e s i d e n t i fj e d a n d m a n a g e d v i a a p r o c e s s i d e n t i fj e r ( p i d )  R e s o u r c e s h a r i n g o p t i o n s  p a r e n t a n d c h i l d r e n s h a r e a l l r e s o u r c e s  c h i l d r e n s h a r e s u b s e t o f p a r e n t ’ s r e s o u r c e s  p a r e n t a n d c h i l d s h a r e n o r e s o u r c e s  E x e c u t i o n o p t i o n s  p a r e n t a n d c h i l d r e n e x e c u t e c o n c u r r e n t l y  p a r e n t w a i t s u n t i l c h i l d r e n t e r m i n a t e 15

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