1/27
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What is concurrency?
The ability for a system to run multiple independent but related tasks simultaneously or interleaved, improving efficiency on multi-processor systems.
Why is concurrency needed?
A sequential program uses only one processor. Concurrency allows multiple processors to execute separate or related tasks for better utilization.
What's the most efficient IPC mechanism for concurrency?
Shared memory — no copying between buffers and minimal system call overhead after setup.
What are the downsides of using processes for concurrency?
High cost of creating/destroying processes and expensive context switching.
What is a thread?
A lightweight execution unit within a process that shares the same address space and resources with other threads.
Why use threads instead of processes?
Threads allow concurrency with lower overhead and faster context switching since they share memory.
What is a Thread Control Block (TCB)?
A data structure maintained by the kernel that stores thread-specific info (analogous to the PCB for processes).
What are User-Level Threads (ULT)?
Threads managed entirely in user space without kernel involvement.
Advantages of ULT?
Low overhead, customizable scheduling, no mode switch needed.
Disadvantages of ULT?
No true parallelism — one thread blocks the entire process.
What are Kernel-Level Threads (KLT)?
Threads managed directly by the OS kernel, allowing true parallelism.
Advantages of KLT?
Independent progress and optimal CPU utilization.
Disadvantages of KLT?
High overhead — creating/destroying threads requires kernel calls and mode switches.
What is Many-to-One threading?
Multiple user threads mapped to one kernel thread.
What is One-to-One threading?
Each user thread corresponds to one kernel thread (e.g., Windows, Linux).
What is Many-to-Many threading?
Multiple user threads mapped to multiple kernel threads (hybrid model).
What is Scheduler Activation?
A user-space scheduling mechanism once used for hybrid threading (now mostly abandoned).
What's the issue with fork and exec in multithreaded programs?
Whether the new process should copy all threads or just the calling one — copying all is inefficient.
What's a common solution?
The process invokes fork, and the child immediately calls exec to start fresh.
What are the main signal-handling options in multithreaded systems?
Send signal to: all threads, specific threads, designated thread, or the one the signal applies to.
What are the two main types of thread cancellation?
Asynchronous (immediate kill) and Deferred (thread periodically checks a cancel flag).
Why is deferred cancellation preferred?
Prevents data corruption if the thread is modifying shared data.
What is Thread-Local Storage?
A mechanism giving each thread its own copy of certain variables.
Why use TLS?
Prevents data races and allows compiler optimizations.
Where is TLS data stored?
As static data, persisting even after thread termination.
What is a Thread Pool?
A group of pre-created worker threads used to handle tasks dynamically.
Why use a Thread Pool?
Reduces overhead of creating/destroying threads and improves runtime efficiency.
What is Grand Central Dispatch (GCD)?
Apple's efficient implementation of thread pools for managing concurrent operations.