Process Isolation
Which of the following best describes the primary reason processes are typically isolated from each other in an operating system?
- To improve inter-process communication speed.
- To prevent a process from corrupting the memory of other processes.
- To allow multiple processes to share the same memory address space.
- To reduce the overhead of context switching.
- To enforce single-threading across the system.
Resource Consumption
Considering resource consumption, what is generally true when comparing a process and a thread?
- Threads consume significantly more resources than processes.
- Processes and threads consume roughly the same amount of resources.
- Processes consume significantly more resources than threads.
- Threads never consume memory, only CPU time.
- Processes consume less memory but more CPU time.
Context Switching Overhead
What is typically the cost of context switching between threads compared to context switching between processes?
- Context switching between threads is always more expensive.
- Context switching between threads is generally faster and less resource-intensive.
- Context switching between processes is faster because processes are isolated.
- The cost is identical because the operating system handles both the same way.
- Context switching is instant and has no cost, therefore, negligible.
Shared Memory
In a multithreaded environment, how do threads within the same process typically share memory?
- Threads cannot share memory and communicate only through message passing.
- Threads share the same address space, allowing direct access to the same memory locations.
- Threads share memory only through explicitly created shared memory segments.
- Each thread has its own private memory space, but can indirectly alter other's.
- Threads can only share data using a file system.
Inter-Process Communication (IPC)
Which of the following is a common method for inter-process communication?
- Directly accessing shared memory locations (without synchronization).
- Using global variables within the same program.
- Pipes, message queues, and shared memory segments.
- Automatically shared stack space.
- Using the operating system's standard output stream (stdout) exclusively.
Fault Isolation
If one thread within a process crashes due to a segmentation fault, what is the most likely outcome?
- Only the crashing thread is terminated, the process continues.
- The entire system crashes to prevent data corruption.
- The entire process, including all threads, is terminated.
- The operating system attempts to recover the crashing thread automatically.
- A new thread is automatically spawned to take its place.
Parallel Processing Scenario
Which of the following application types would most benefit from a multithreaded architecture?
- A single-threaded command-line utility with minimal I/O.
- A web server handling multiple concurrent client requests.
- A real-time embedded system with strict timing constraints.
- A system that reads from a single input stream sequentially.
- A simple calculator program.
Green Threads
What are 'green threads'?
- Threads that are exclusively used for handling green screen displays.
- Threads managed by the operating system kernel.
- Threads managed by a user-level library rather than the kernel.
- A type of thread that consumes minimal CPU resources.
- Threads that are scheduled based on priority.
Multiprocessing vs. Multithreading: Scalability
In terms of scalability on a multi-core processor, what is the primary advantage of multiprocessing over multithreading?
- Multithreading automatically distributes work across all cores.
- Multiprocessing inherently avoids the Global Interpreter Lock (GIL) limitations often found in interpreted languages like Python.
- Multiprocessing requires less operating system overhead.
- Multithreading has better isolation that reduces conflicts.
- Multithreading offers a simplified approach to inter-process communication.
Concurrency and Parallelism
What is the key distinction between concurrency and parallelism?
- Concurrency means tasks run simultaneously; parallelism means tasks appear to run simultaneously.
- Parallelism is a software concept, concurrency is a hardware concept.
- Concurrency is a programming error; parallelism is the desired outcome.
- Concurrency means tasks appear to run simultaneously; parallelism means tasks run simultaneously.
- They are synonyms, meaning exactly the same thing.