Understanding Processes, Threads, and Thread Management

Slide Note
Embed
Share

Explore the concepts of processes and threads, distinguish between them, and delve into the implementation of threads at kernel-supported and user-level. Discover the differences in address spaces and thread management tactics for efficient CPU utilization.


Uploaded on Dec 06, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Processes and Threads

  2. What is a process?

  3. What is a thread? How is a thread different from a process?

  4. Single-threaded Address Space

  5. Multithreaded process

  6. Multithreaded process address space

  7. Implementing threads Kernel-supported threads The kernel is aware of the threads within the process It keeps track of each thread s stack and its processor state (registers, program counter) Threads are a unit of scheduling. Each can be scheduled independently. Different threads can run concurrently on different CPUs. User-level The kernel unaware of the existence of threads The user program creates stacks on its heap (via malloc) The user program keeps track of the program counter and other context

  8. Kernel-Supported Thread Switch User address space Kernel address space

  9. Kernel-Supported Thread Switch User address space Kernel address space

  10. User-Level Thread Switch User address space Kernel address space

  11. User-Level Thread Switch User address space Kernel address space

  12. User-level Threads

  13. User-level Thread Management Stacks are allocated and managed by a user-level library How to switch between user-level threads? Need some way to swap CPU state. This does not require any privileged instructions Threads library can use the same instructions as the OS to change the PC and stackpointer (SP) Why is it safe to do so?

  14. Does a thread switch require trapping into the kernel? A. Yes B. No C. Depends on the thread implementation

Related


More Related Content