study_os_l3
"/home/yossef/notes/Su/os/study_os_l3.md"
path: Su/os/study_os_l3.md
- **fileName**: study_os_l3
- **Created on**: 2025-04-05 19:22:18
What is threads?
It's the basic units for cpu utilization , it's have PC, Register, ID and stack
Comparison of Processes and Threads
Process:
- Definition: An instance of a computer program that is being executed.
- Weight: Heavyweight.
- Switching: Switching requires interacting with the operating system.
- Memory: Each has its own memory space.
- Resources: Requires more resources.
- Creation: Difficult to create a process.
- Communication: Inter-process communication is slow because each process
has a different memory address.
Thread:
- Definition: A component of a process which is the smallest execution unit.
- Weight: Lightweight.
- Switching: Switching does not require interacting with the operating system.
- Memory: Use the memory of the process they belong to.
- Resources: Requires minimum resources.
- Creation: Easier to create.
- Communication: Inter-thread communication is fast because the threads
share the same memory address of the process they belong to.
relationship between user threads and Kernel threads.
- One-to-One model
- Many-to-One model
- One -to -Many model
- Many-to-Many model
What is benefits of threading?
- resource sharing: threads sharing resources of a process
- economy: creating thread cheaper than process
- Scalability: process can take advantage of multi process structure
- responsiveness: may allow continued execution if part of process is booked
What is thread library?
Provides programmer with API for creating and managing threads
what is the two primary ways of thread library?
- library entirely in user space
- kernel level library supported by OS
What is thread issues?
- Semantics of fork() and exec() system calls
- Signal handling
- Thread pools
- Thread-specific data
- Scheduler activations
Terminating a thread before it has finished
Two general approaches:
-
Asynchronous cancellation terminates the target thread
immediately -
Deferred cancellation allows the target thread to periodically
check if it should be cancelledcontinue:./study_os_l4.md
before:./study_os_l2.md