Process Isolation
Which characteristic best describes how operating systems manage processes?
- Processes share the same memory space by default.
- Processes are isolated, each with its own memory space.
- Processes communicate directly through shared variables.
- Processes are grouped into threads for resource sharing.
- Processes cease once they terminate
Resource Usage
Which typically has a higher overhead in terms of resource usage: creating a new process or creating a new thread within an existing process?
- Creating a thread.
- Creating a process.
- They have roughly the same overhead.
- It depends on the programming language.
- It depends on the operating system.
Inter-Process Communication (IPC)
Which of the following mechanisms is commonly used for inter-process communication (IPC)?
- Shared memory within the same process.
- Direct access to thread stacks.
- Message queues or pipes.
- Direct function calls across processes.
- Global variables across processes
Concurrency within a Process
Which feature allows multiple parts of a program to execute concurrently within the same process?
- Multiple processes.
- Threads.
- Virtual machines.
- System calls.
- Interrupt handlers
Context Switching Speed
Which is generally faster: a context switch between threads within the same process, or a context switch between two different processes?
- Context switching between processes.
- Context switching between threads.
- The speeds are identical.
- Context switching is not possible between processes.
- Context switching is not possible between threads.
Crash Impact
If a thread within a process crashes, what is the likely impact on the rest of the application?
- Only the crashing thread will be affected.
- The entire process will likely crash.
- The operating system will automatically restart the thread.
- The operating system will automatically restart the process.
- Other processes will be affected.
Threading Models
Which threading model maps multiple user-level threads to a single kernel-level thread?
- One-to-one model.
- Many-to-one model.
- One-to-many model.
- Many-to-many model.
- One-to-few model.
Use Case: Web Server
In a web server, which approach is typically used to handle multiple client requests concurrently: creating a new process for each request, or creating a new thread for each request?
- Creating a new process for each request.
- Creating a new thread for each request.
- Using a single process to handle all requests sequentially.
- Using a message queue to handle requests sequentially.
- Using a single thread to handle all requests sequentially.
Memory Sharing
How do threads within the same process typically share memory?
- Each thread has its own completely isolated memory space.
- Threads share the same code, data, and heap segments.
- Threads only share the stack segment.
- Threads can choose which parts of memory to share.
- Threads share only global variables.
Deadlock Prevention
Threads are accessing shared resources, what should programmers use to ensure no deadlock happens?
- Use atomic operations, mutexes, or semaphores for synchronization.
- Avoid using shared resources entirely.
- Rely on the operating system to automatically resolve deadlocks.
- Increase the number of threads to reduce contention.
- Decrease the number of threads to reduce contention.