Process States
A process that is waiting for an I/O operation to complete is in which state?
- A. Ready
- B. Running
- C. Blocked
- D. Terminated
- E. New
Context Switching
What is the primary purpose of a context switch in an operating system?
- A. To allocate more memory to the current process
- B. To switch the CPU from one process or thread to another
- C. To terminate a process that is consuming too many resources
- D. To prevent deadlock situations
- E. To perform garbage collection
Threads vs. Processes
Which of the following resources is typically shared between all threads within a process?
- A. Stack
- B. Program Counter
- C. Register Set
- D. Heap
- E. Thread ID
Process Control Block
Where is important information about a process, such as process state, program counter, and register contents, stored?
- A. Kernel Stack
- B. Page Table
- C. Process Control Block
- D. Memory Management Unit
- E. System Call Table
Thread Synchronization
Which synchronization primitive allows multiple threads to read a shared resource concurrently, but only one thread to write it at a time?
- A. Mutex
- B. Semaphore
- C. Monitor
- D. Reader-Writer Lock
- E. Spinlock
Thread States
A thread that is waiting to acquire a lock held by another thread is in which state?
- A. Running
- B. Ready
- C. Blocked
- D. Terminated
- E. New
Context Switch Overhead
Which of the following actions contributes to the overhead of a context switch?
- A. Saving and restoring the process's memory
- B. Updating the system clock
- C. Switching to kernel mode
- D. Invoking the garbage collector
- E. Saving and restoring the CPU's registers
Deadlock Prevention
Which condition must be present for a deadlock to occur?
- A. Preemption
- B. Circular wait
- C. Mutual exclusion
- D. Hold and wait
- E. All of the above
Process Creation
Which system call is typically used to create a new process in Unix-like operating systems?
- A. exec
- B. fork
- C. create
- D. thread_create
- E. open
Thread Synchronization Issues
What is the term for a situation where multiple threads access and modify shared data concurrently, resulting in unpredictable and incorrect results?
- A. Race condition
- B. Deadlock
- C. Starvation
- D. Priority Inversion
- E. Memory Leak