1 / 20

User-Mode & Kernel Mode Threads Implementation and Properties

CS 514 Operating Systems. User-Mode & Kernel Mode Threads Implementation and Properties. Department of Computer Science Southern Illinois University Edwardsville Spring, 2009 Dr. Hiroshi Fujinoki E-mail: hfujino@siue.edu. UK_Threads/000. Processes and Threads.  Concept of threads.

blithe
Download Presentation

User-Mode & Kernel Mode Threads Implementation and Properties

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 514 Operating Systems User-Mode & Kernel Mode Threads Implementation and Properties Department of Computer Science Southern Illinois University Edwardsville Spring, 2009 Dr. Hiroshi Fujinoki E-mail: hfujino@siue.edu UK_Threads/000

  2. Processes and Threads  Concept of threads  How do threads solve the problem in processes?  Two different thread implementations CS 514 Operating Systems  Problems in processes UK_Threads/001

  3. Processes and Threads CS 514 Operating Systems  Problems in processes • High overhead in inter-process-communication (IPC) • High context-switching overhead in multitasking using processes UK_Threads/002

  4. Processes and Threads Memory address space for each process P1 What if, some process need to share some information (data)? P2 P3 Processes exchange information through OS (IPC) OS Memory CS 514 Operating Systems  Problems in processes • High overhead in inter-process-communication (IPC) • Processes can not access memory • address outside of its address space • “output redirection” • “pipe” • “semaphore” • “message passing” UK_Threads/003

  5. Processes and Threads The high-overhead IPC’s are acceptable for loosely-coupled processes system call Memory address space for each process P1 P2 P3 Closely-coupled processes OS Memory CS 514 Operating Systems  Problems in processes • High overhead in inter-process-communication (IPC) • Processes can not access memory • address outside of its address space What if, some process need to share some information (data)? Processes exchange information through OS (IPC) • Keyboard input • “output redirection” • Background spell-check • “pipe” • Automatic file-save • “semaphore” • “message passing” UK_Threads/004

  6. Processes and Threads Processor P1 P2    P3 Registers Time PCB-P2 PCB-P3 Memory PCB-P1 CS 514 Operating Systems  Problems in processes • High context-switching overhead in multitasking using processes SAVE LOAD OS UK_Threads/005

  7. Processes and Threads The high-overhead IPC’s are acceptable for loosely-coupled processes Processor P1 P2    P3 Registers Time PCB-P3 PCB-P2 Memory PCB-P1 CS 514 Operating Systems  Problems in processes • High context-switching overhead in multitasking using processes Closely-coupled processes • Keyboard input • Background spell-check • Automatic file-save LOAD SAVE OS UK_Threads/006

  8. Processes and Threads Thread1 P1 Thread2 Process Thread3 P2 P3 OS OS Memory Memory CS 514 Operating Systems  Concept of threads UK_Threads/007

  9. Processes and Threads Global Variable Area P1 P2 P3 OS OS Memory Memory CS 514 Operating Systems  Concept of threads Process Address Space Thread1 Thread2 Thread3 UK_Threads/008

  10. Processes and Threads CS 514 Operating Systems  How do threads solve the problem in processes? • High overhead in inter-process-communication (IPC) • High context-switching overhead in multitasking using processes UK_Threads/009

  11. Processes and Threads Solved  system call Inter-process communications must go through OS (system call) P1 P2 The member threads can access shared data w/out going through a system call P3 OS OS Memory Memory CS 514 Operating Systems  How do threads solve the problem in processes? • High overhead in inter-process-communication (IPC) Thread1 Thread2 Thread3 UK_Threads/010

  12. Processes and Threads TCB TCB TCB TCB PCB TCB is a subset of PCB CS 514 Operating Systems  How do threads solve the problem in processes? • High context-switching overhead in multitasking using processes UK_Threads/011

  13. Processes and Threads PCB TCB is a subset of PCB CS 514 Operating Systems  How do threads solve the problem in processes? • High context-switching overhead in multitasking using processes TCB TCB TCB TCB UK_Threads/012

  14. Processes and Threads PCB TCB is a subset of PCB CS 514 Operating Systems  How do threads solve the problem in processes? • High context-switching overhead in multitasking using processes TCB TCB TCB TCB UK_Threads/013

  15. Processes and Threads Solved  PCB TCB is a subset of PCB CS 514 Operating Systems  How do threads solve the problem in processes? • High context-switching overhead in multitasking using processes TCB TCB TCB TCB UK_Threads/014

  16. Processes and Threads Where are “TCB’s”? PCB Processor P1 Thread1 Thread2 Process Registers P2 Thread3    P3 OS PCB-P3 PCB-P2 Memory Memory PCB-P1 CS 514 Operating Systems  How do threads solve the problem in processes? • High context-switching overhead in multitasking using processes OS UK_Threads/015

  17. Processes and Threads Kernel-Mode Threads Application-Mode Threads CS 514 Operating Systems  Two different thread implementations • OS manages each thread • (as well as processes) Thread Implementation • OS has thread manager (scheduler) • A.K.A. “OS-mode threads” • OS does NOT manage each • thread (it manages only processes) • OS does not have thread manager • A.K.A. “user-mode threads” UK_Threads/016

  18. Processes and Threads Application-Mode Threads Kernel-Mode Threads Process Scheduler Process Scheduler = PCB = TCB Thread Scheduler OS OS Memory Memory CS 514 Operating Systems Thread1 Thread1 Thread2 Thread2 Thread3 Thread3 UK_Threads/017

  19. Processes and Threads Application-Mode Threads Kernel-Mode Threads Process Scheduler = PCB = TCB OS OS Memory Memory CS 514 Operating Systems Thread1 Thread1 Thread2 Thread2 Thread3 Thread3 Thread Scheduler Process Scheduler Thread Scheduler UK_Threads/018

  20. Processes and Threads Application-Mode Threads Kernel-Mode Threads CS 514 Operating Systems System call Function call (faster than system call) Process T1 T2 Process T3 OS Process Thread Scheduler T1 Process T2 T3 OS UK_Threads/019

More Related