Mastering Processes u0026 Threads: An Operating Systems Quiz Quiz

  1. Process States

    A process that is waiting for an I/O operation to complete is in which state?

    1. A. Ready
    2. B. Running
    3. C. Blocked
    4. D. Terminated
    5. E. New
  2. Context Switching

    What is the primary purpose of a context switch in an operating system?

    1. A. To allocate more memory to the current process
    2. B. To switch the CPU from one process or thread to another
    3. C. To terminate a process that is consuming too many resources
    4. D. To prevent deadlock situations
    5. E. To perform garbage collection
  3. Threads vs. Processes

    Which of the following resources is typically shared between all threads within a process?

    1. A. Stack
    2. B. Program Counter
    3. C. Register Set
    4. D. Heap
    5. E. Thread ID
  4. Process Control Block

    Where is important information about a process, such as process state, program counter, and register contents, stored?

    1. A. Kernel Stack
    2. B. Page Table
    3. C. Process Control Block
    4. D. Memory Management Unit
    5. E. System Call Table
  5. Thread Synchronization

    Which synchronization primitive allows multiple threads to read a shared resource concurrently, but only one thread to write it at a time?

    1. A. Mutex
    2. B. Semaphore
    3. C. Monitor
    4. D. Reader-Writer Lock
    5. E. Spinlock
  6. Thread States

    A thread that is waiting to acquire a lock held by another thread is in which state?

    1. A. Running
    2. B. Ready
    3. C. Blocked
    4. D. Terminated
    5. E. New
  7. Context Switch Overhead

    Which of the following actions contributes to the overhead of a context switch?

    1. A. Saving and restoring the process's memory
    2. B. Updating the system clock
    3. C. Switching to kernel mode
    4. D. Invoking the garbage collector
    5. E. Saving and restoring the CPU's registers
  8. Deadlock Prevention

    Which condition must be present for a deadlock to occur?

    1. A. Preemption
    2. B. Circular wait
    3. C. Mutual exclusion
    4. D. Hold and wait
    5. E. All of the above
  9. Process Creation

    Which system call is typically used to create a new process in Unix-like operating systems?

    1. A. exec
    2. B. fork
    3. C. create
    4. D. thread_create
    5. E. open
  10. 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?

    1. A. Race condition
    2. B. Deadlock
    3. C. Starvation
    4. D. Priority Inversion
    5. E. Memory Leak