quiz

Threads in Operating System

1. What is a thread in the context of an operating system?

  • A) An independent program
  • B) A unit of execution within a process
  • C) A type of system call
  • D)  A hardware component
B) A unit of execution within a process Explanation

2. How many threads are active at once in a system with multiple CPU cores?

  • A) One thread per process
  • B) Two threads per CPU core
  • C) Multiple threads, potentially equal to the number of CPU cores
  • D) Unlimited threads, depending on system resources
C) Multiple threads, potentially equal to the number of CPU cores Explanation

3. What resources does a kernel thread own?

  • A) Memory and file resources
  • B) Thread-local storage and virtual memory
  • C) Stack, registers, and thread-local storage
  • D) CPU cache and TLB
C) Stack, registers, and thread-local storage Explanation

4. Which of the following is an example of one process with multiple threads?

  • A) A simple calculator program written in C
  • B) A web server program written in Java using Java Servlets
  • C) A file compression utility written in C++
  • D)  A graphical user interface (GUI) application written in JavaScript using Node.js
B) A web server program written in Java using Java Servlets Explanation

5. Which of the following is not a characteristic of threads?

  • A) Lightweight
  • B) Independent address space
  • C) Share resources with other threads
  • D) Can be scheduled independently 
B) Independent address space Explanation

6. Which threading model allows for a combination of user-level and kernel-level threads?

  • A) User-level threading model
  • B) Kernel-level threading model
  • C) Hybrid threading model
  • D) Multiprocessor threading model
C) Hybrid threading model Explanation

7. When a thread is waiting for a lock to be released by another thread, which state is it typically in?

  • A) Running
  • B) Terminated
  • C) Blocked
  • D) Sleeping
C) Blocked Explanation