🎓 BookMCQ
← Back to 4. Threads in Operating System

📝 Why threads are used in operating system (33 MCQs)

Multiple Activities Within a Single Process

Threads are used to divide a process into independent execution paths that can perform different activities concurrently. Each thread maintains its own processor context and stack but shares the process address space and resources. This arrangement allows an application to handle user interaction, computation, file access, and communication without requiring a separate process for every activity.

Limitations of Single-Threaded Application Execution

A single-threaded application can become unresponsive when its only execution path blocks during network communication, disk access, or another lengthy operation. Creating separate processes for every task also introduces additional resource and communication overhead. Threads address these limitations by supporting concurrent activities within one process and allowing them to exchange data through shared memory.

Independent Execution Paths and Resource Sharing

An application creates threads through a threading library or operating system interface. Each thread receives its own stack, register state, and scheduling information. The scheduler allocates available CPU time to runnable threads, while all threads can access shared process memory, open files, and other permitted resources. Synchronisation controls access to shared data.

Keeping an Application Responsive During Network Access

Suppose a desktop application uses one thread for its interface and another for downloading a 20 MB file. When the download thread waits for network packets, the interface thread can continue processing mouse clicks and keyboard input. The application remains responsive because the waiting operation does not suspend every thread in the process.

Application Responsiveness and Efficient Resource Utilisation

Threads are valuable in interactive software, web servers, multimedia applications, and background processing systems. They support overlapping activities and reduce the need for independent process address spaces. However, shared resources require synchronisation, and excessive thread creation increases memory consumption and scheduling overhead. Blocking operations can also affect other threads when unsuitable synchronisation or process-level resources are used.

Misconceptions About the Purpose of Threading

'Threads are created only to increase processor speed' is incorrect because they also improve responsiveness and structure concurrent tasks. 'Every blocking operation blocks the entire process' is incorrect when other schedulable threads can continue. 'Threads provide automatic protection between tasks' is incorrect because threads normally share the same process address space.

Exam Focus: Reasons for Using Threads

Explain how threading improves responsiveness, resource sharing, and concurrency. Compare creating multiple processes with creating multiple threads in terms of memory and communication overhead. Given an application involving user interaction, computation, and I/O, identify suitable independent execution activities and explain the synchronisation needed when they access shared data.

Key Terms of Thread Utilisation

  • Responsiveness - Ability to react promptly to input.
  • Concurrency - Overlapping execution of activities.
  • Blocking - Waiting for an event or resource.
  • Shared resource - Resource accessible by multiple threads.
  • Threading - Creating multiple execution paths.
  • Synchronisation - Coordinating concurrent operations.
11
Easy
11
Medium
11
Hard

📝 All Why threads are used in operating system MCQs

Q1. A word processor must accept keystrokes, check spelling, and save changes in the background. Why is dividing these activities among threads useful?

A.separate execution paths can handle different activities within one application ✅
B.each activity must run as a separate operating-system process
C.all activities are forced to execute the same instruction simultaneously
D.each activity automatically receives an isolated address space
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Separate threads organize independent activities within one application. The interface can process input while spelling and saving work proceed, without requiring a separate process and address space for every activity.

Q2. A monitoring application receives sensor updates, refreshes a dashboard, and writes records to disk. What is the main reason to assign these activities to different threads?

A.to guarantee that every activity finishes at the same instant
B.to let each activity make progress according to its own work and waiting conditions
C.to prevent the activities from accessing common application data
D.to eliminate the need for the operating system scheduler ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Different activities often have different timing and waiting requirements. Separate threads let the scheduler run whichever execution path is ready, rather than forcing sensor handling, display updates, and disk writing into one sequential flow.

Q3. A single-threaded inventory program waits for a remote stock query before it can process another user action. Which redesign addresses the underlying limitation?

A.increase the size of the program stack without changing its execution flow
B.copy the entire application memory after every user action
C.perform the remote query in an independent thread while the main flow handles other work ✅
D.disable network access whenever the interface is active
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The single execution path cannot advance while its network operation is waiting. A separate worker thread can wait for the response while another ready thread handles user actions, improving overlap without requiring another process.

Q4. A mail client downloads a large attachment while the user continues composing a reply. Which arrangement most directly supports this behavior?

A.the download and editing tasks run as separate threads in the client process ✅
B.the editing task is suspended until the complete attachment arrives
C.the download task replaces the user-interface thread during every network transfer
D.the operating system duplicates the entire client process for each keystroke
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A download thread can wait for network data while the interface thread remains available to process typing and display updates. This arrangement separates independent work while keeping both activities within the same application process.

Q5. A developer claims that creating a worker thread gives it a private address space, so the worker cannot affect the main thread data. Which correction identifies the error?

A.a worker thread always receives a separate process identifier and executable image
B.threads share the process address space, so shared data can be accessed by both execution paths ✅
C.private stacks prevent threads from accessing global variables
D.the operating system copies all global variables whenever a thread starts
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The claim confuses threads with processes. Threads in one process normally share its address space, including global data and heap objects; this enables cooperation but also means that unsynchronized writes can affect other threads.

Q6. A desktop application performs a long report export after the user selects Export. Why can a separate worker thread improve the user experience?

A.it makes the export require no processor time
B.it guarantees that the export finishes before the next input event
C.it lets the interface continue processing input while the export runs ✅
D.it prevents the export from accessing application memory
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Running the export in a worker leaves the interface execution path available for input, repainting, and status updates. The export may still consume CPU time, but it no longer has to occupy the only application thread.

Q7. A browser has one thread waiting for a network response and another thread ready to update the page controls. What normally allows the controls to remain usable?

A.the waiting thread continues executing while its network request is pending
B.the operating system can schedule the ready thread while the other thread is blocked ✅
C.the browser automatically creates a new process for every control
D.the network response is converted into processor instructions
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: A blocked thread cannot use the processor until its awaited event occurs. The scheduler can select another ready thread in the process, allowing controls to remain responsive while the network operation is pending.

Q8. A single-core application records this execution: worker runs from 0 to 2 ms, waits for disk I/O from 2 to 8 ms, and the interface thread runs from 2 to 5 ms. What does the trace demonstrate?

A.both threads execute instructions simultaneously on the same core
B.the interface thread must wait until the worker finishes its disk request
C.the disk operation is performed by the interface thread
D.another ready thread can use the CPU while the worker waits ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The worker is blocked from 2 to 8 ms, so the scheduler runs the ready interface thread during part of that interval. This is concurrency through interleaving, not simultaneous execution on one core.

Q9. A user-interface response-delay chart for a long background export contains these pairs: export duration in seconds and input delay in milliseconds: (1,8) ; (2,9) ; (3,8) ; (4,10) ; (5,9). Which conclusion is best supported?

A.input delay grows in direct proportion to export duration
B.the interface remains comparatively responsive while export duration increases ✅
C.the export is completing before each input event
D.the measurements prove that the export and interface execute on separate physical cores
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Input delay stays between 8 and 10 milliseconds even as export duration rises from one to five seconds. The pattern is consistent with a responsive interface thread, but it does not prove execution on separate cores.

Q10. A student moves a long calculation to a worker thread but the interface still freezes whenever the worker updates a shared document. The student concludes that threads cannot improve responsiveness. What is the flaw in this reasoning?

A.a shared lock or other blocking dependency can still prevent the interface from progressing ✅
B.a worker thread is always scheduled at a lower priority than the interface
C.threads in one process cannot access the same document
D.responsiveness improves only when every thread runs on a different physical core
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The flawed conclusion ignores synchronization and shared-resource blocking. If the worker holds a lock needed by the interface, the interface may wait despite being a separate thread; thread separation alone does not guarantee responsiveness.

Q11. Which operating-system benefit is illustrated when an application continues accepting user input while a lengthy background operation is still running?

A.resource isolation
B.deadlock prevention
C.responsiveness ✅
D.process replacement
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Responsiveness is the ability of an application to continue reacting to input while another part performs lengthy work or waits for an event. Separate threads can preserve this behavior when the interface remains runnable.

Q12. A web service handles independent client requests. Why might separate execution paths be preferable to processing every request in one strictly sequential flow?

A.a slow request would otherwise delay unrelated requests waiting behind it ✅
B.separate execution paths guarantee that every client uses a different server machine
C.sequential processing always consumes more memory than concurrent processing
D.multiple execution paths remove the need to check request data
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: With one sequential flow, a request waiting for network or storage can delay later requests. Multiple threads allow ready requests to progress while another waits, improving service responsiveness and the use of available processor time.

Q13. Which default property makes communication between threads of one process easier than communication between unrelated processes?

A.each thread owns a separate virtual address space
B.threads share the process address space and can access common objects ✅
C.threads exchange information only through network sockets
D.the kernel automatically serializes every shared variable
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Threads belonging to one process normally share its address space, so they can communicate through common variables and objects. Separate processes generally need an explicitly arranged mechanism such as shared memory or message passing.

Q14. A database server uses several threads to process queries against one in-memory buffer pool. Which benefit of threads is most directly relevant?

A.each query receives a private copy of every cached page
B.the buffer pool becomes inaccessible while a query is running
C.the operating system merges independent process address spaces automatically
D.query workers can access shared cache data within the same process ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Because query workers belong to the same process, they can access the common buffer pool directly. This avoids arranging a separate interprocess data-transfer mechanism, although concurrent updates to shared structures still require coordination.

Q15. A student argues that two processes and two threads communicate in exactly the same way because both can exchange data. Which statement corrects this comparison?

A.threads normally share memory by default, whereas processes generally require an explicit communication arrangement ✅
B.processes always share all global variables without configuration
C.threads can communicate only by writing to disk
D.process communication never uses shared memory or message passing
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The error is treating the communication setup as identical. Threads in one process can access shared memory directly, while separate processes normally need mechanisms such as configured shared memory, pipes, or message passing.

Q16. A photo application has one thread decode image tiles and another prepare them for display. Why is a shared in-memory tile queue useful?

A.it gives each thread an independent copy of the entire application
B.it prevents the decoder from making progress while the display is active
C.it lets both threads exchange tile references through common process memory ✅
D.it removes the need to coordinate access to the queue
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A shared queue lets the decoder place tile references in process memory and the display thread retrieve them directly. This simplifies communication, but queue operations still need coordination to prevent conflicting concurrent updates.

Q17. A document editor uses a worker to autosave while the interface displays the same document. Which combination best explains why threads are suitable for this design?

A.separate processes are required to share the document without copying
B.the worker can save a shared document representation while the interface remains available ✅
C.the interface must stop whenever the worker reads document data
D.a shared address space prevents the worker from seeing recent edits
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Threads support both goals: the worker and interface can access the same document data, and separate execution paths can progress independently. Synchronization or a consistent snapshot is still needed while edits and saving overlap.

Q18. Why is creating a thread within an existing process generally more economical than creating another process for a related task?

A.the thread needs no execution context or stack
B.the thread receives a complete independent address space
C.the thread can reuse process resources instead of establishing a separate process environment
D.the thread is exempt from scheduling and memory management ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: A new thread reuses the process address space and many existing resources. It still needs its own execution context and stack, but it usually requires less setup and memory than creating a separate process.

Q19. A system measures task-start overhead as 4 ms for a new process and 1 ms for a new thread. If 12 tasks are started sequentially, how much setup time is saved by using threads under these measurements?

A.12 ms
B.24 ms
C.36 ms ✅
D.48 ms
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Process setup takes 12×4=4812 \times 4 = 48 ms, while thread setup takes 12×1=1212 \times 1 = 12 ms. The saved time is 48−12=3648 - 12 = 36 ms; these figures describe the stated measurements, not a universal ratio.

Q20. A student says switching between two threads in the same process requires no processor-state saving because both use one address space. Which part of the explanation is incorrect?

A.threads must save and restore their execution context even when the address space is unchanged ✅
B.a thread switch always creates a new process
C.the shared heap must be copied before every switch
D.the scheduler cannot interrupt a running thread
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The flawed step is assuming a shared address space eliminates context management. The operating system must still preserve and restore registers, the program counter, and stack state, even when no process address-space change is needed.

Q21. A program already has one process loaded. It creates a worker thread to perform a related calculation. Which operation can usually be avoided compared with launching a separate process?

A.saving the worker thread program counter when it is switched out
B.allocating a private execution stack for the worker
C.recording the worker thread scheduling state
D.establishing a separate process address space and its associated memory mappings ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The worker reuses the existing process address space, so a separate set of process memory mappings does not need to be established. The thread still requires its own stack, registers, program counter, and scheduling information.

Q22. Why should thread creation be described as lower-overhead rather than cost-free?

A.threads never require memory after they start
B.each thread still needs a stack, execution state, and management resources ✅
C.threads execute without scheduler involvement
D.the operating system stores all threads in the process code section
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Thread creation avoids much of the setup required for a separate process, but it still allocates a stack and records execution and scheduling state. Creating excessive threads can therefore consume memory and management time.

Q23. A scientific program launches 500 threads, but each performs only a tiny amount of work. Which observation best explains why this can reduce rather than improve efficiency?

A.the operating system must assign one physical core to every thread
B.threads cannot perform short computations
C.the time and resources spent creating and scheduling threads may exceed the useful work
D.a process can contain only one thread at a time ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Threads are cheaper than processes, not free. When each task performs very little work, creation, scheduling, and context-switching costs can outweigh computation, so a smaller number of threads handling larger work units may be more efficient.

Q24. Which statement describes concurrency as a reason for using threads on a single-core processor?

A.several threads can make progress by taking turns on the processor ✅
B.several threads execute instructions at exactly the same instant on one core
C.each thread must wait until the entire process terminates
D.the operating system disables switching while a thread is active
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: On a single core, only one thread executes instructions at an instant, but the scheduler can interleave their execution. This lets multiple activities make progress during overlapping time intervals, even without hardware parallelism.

Q25. An I/O-bound server reports completed requests as the number of worker threads changes: (1,10) ; (2,18) ; (3,24) ; (4,27) ; (5,27), where each pair is (workers, requests per second). What trend is shown?

A.throughput falls whenever another worker is added
B.throughput rises initially and then reaches a plateau ✅
C.throughput increases by exactly 10 requests per second at every step
D.five workers reduce throughput to zero
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Throughput rises from 10 to 27 requests per second as workers increase from one to four, then remains at 27 with five. Overlapping I/O waits initially helps, but another worker adds no measured throughput.

Q26. A single-core file service has one thread waiting for disk data while another thread processes an already available block. Which reason for using threads does this illustrate most directly?

A.creating isolated address spaces for every block
B.forcing disk and CPU operations to occur sequentially
C.overlapping a waiting activity with useful computation ✅
D.guaranteeing that both threads execute in parallel
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The disk-waiting thread cannot use the processor, so the ready processing thread can perform useful work. This overlap improves utilization through concurrency, although the single core still executes only one thread at a time.

Q27. A media application reads chunks from storage and processes previously read chunks. Why can separate threads improve the flow of this work?

A.the reader must finish the entire file before processing can begin
B.the reader can wait for storage while another thread processes available data ✅
C.the processing thread automatically makes storage access instantaneous
D.separate threads eliminate the need to store intermediate chunks
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The reader and processing thread can progress independently. When storage access blocks the reader, the other thread can process data already available, reducing idle time and avoiding a strictly sequential read-then-process workflow.

Q28. A workstation has eight CPU cores but runs a CPU-bound application containing only one execution thread. Which statement best describes the application's ability to use those cores for its own work?

A.the single thread can execute on all eight cores simultaneously
B.the operating system automatically divides the thread into eight independent threads
C.the application can use only one core for that single execution path at a time ✅
D.the application receives eight times the CPU capacity without changing its design
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A single execution thread can run on only one core at a time. Additional threads provide independent execution paths that the scheduler may place on different cores, subject to dependencies, available work, and system scheduling.

Q29. A parallel service records throughput as core count and completed jobs per second: (1,100) ; (2,185) ; (3,255) ; (4,310) ; (5,330). Which conclusion best fits the measurements?

A.each added core produces the same throughput increase
B.throughput decreases as more cores become available
C.five cores provide exactly five times the one-core throughput
D.throughput improves with more cores, but the gains become smaller ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Throughput increases from 100 to 330 jobs per second, but successive gains shrink from 85 to 20. The data show improved scalability with diminishing returns rather than a constant or perfectly linear increase.

Q30. A student states that using several threads on a single-core computer makes their instructions run in parallel. Which correction is accurate?

A.the threads can make concurrent progress through interleaving, but one core executes only one at an instant ✅
B.parallel execution occurs because every thread has a separate stack
C.a single core can execute one instruction from every thread during the same clock cycle
D.threads on one core never interrupt one another
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The student's error is confusing concurrency with parallelism. A single core switches among runnable threads, allowing overlapping progress over time, but simultaneous instruction execution requires multiple execution cores or processors.

Q31. Two worker threads update different records in a shared in-memory table while running on separate cores. Which statement best captures both the opportunity and the concern?

A.sharing the address space prevents the threads from running on separate cores
B.parallel execution is possible, but coordination is needed if their operations touch shared state ✅
C.separate cores automatically create private copies of every table record
D.the threads must be converted into separate processes before they can run simultaneously
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Threads can execute on separate cores while accessing one process address space. If their operations overlap on shared data, synchronization may be needed to prevent inconsistent updates; sharing memory does not itself prevent parallel execution.

Q32. A service has nine independent CPU-bound jobs, each requiring 2 ms of CPU time. With four available cores, assume ideal balancing and no overhead. What is the minimum completion time when the jobs are assigned to threads?

A.2 ms
B.4 ms
C.6 ms ✅
D.18 ms
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Four cores can process four jobs in each 2 ms wave. Nine jobs require three waves, so the ideal completion time is 3×2=63 \times 2 = 6 ms, compared with 18 ms if one core handles all jobs sequentially.

Q33. A document-processing service needs strong fault isolation because a failure in one task must not corrupt or terminate the others. Why might separate processes be preferable to threads in this case?

A.threads provide stronger memory protection because they share an address space
B.processes always have lower creation overhead than threads
C.threads prevent one task from accessing another task data automatically
D.separate process address spaces provide stronger isolation between tasks ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: Threads are efficient when activities need shared memory, but that sharing weakens isolation. Separate processes provide distinct address spaces, reducing the chance that one task directly corrupts another task memory or execution environment.

🔗 Related Topics (MCQs)