🎓 BookMCQ
← Back to 4. Threads in Operating System

📝 Scheduler activations in operating system (33 MCQs)

Coordination Between User-Level and Kernel-Level Threads

Scheduler activations are a historical mechanism for coordinating user-level thread libraries with kernel scheduling in a many-to-many threading environment. The kernel provides virtual processors, commonly described as lightweight processes, through which user threads can execute. It also sends upcalls to notify the user-level scheduler about events such as blocking and processor allocation changes, allowing the runtime to adjust thread scheduling.

Why User and Kernel Schedulers Need Coordination

User-level thread libraries can manage application threads efficiently, but the kernel may block or preempt their underlying execution entities without directly understanding the library's thread states. This can leave the runtime unaware that execution capacity has changed. Scheduler activations address the coordination gap by informing the user scheduler about relevant kernel events and resource availability.

Virtual Processors, Upcalls, and Thread-State Recovery

The kernel allocates virtual processors for user-level thread execution and notifies the user scheduler through upcalls when scheduling events occur. If a running thread blocks in the kernel, the runtime can schedule another eligible user thread on an available execution entity. When the blocked operation completes, the kernel communicates the event so the runtime can restore scheduling capacity.

Handling a Blocking System Call in a User Thread

Suppose three user threads share two virtual processors. One thread performs a blocking disk operation. The kernel notifies the user-level scheduler that one execution entity is blocked, allowing the runtime to schedule another ready thread on available capacity. When the disk operation completes, an upcall informs the runtime that the blocked thread can become eligible again.

Flexible Thread Scheduling and Coordination Complexity

Scheduler activations were designed to combine efficient user-level thread management with kernel awareness of blocking and processor allocation. They offered a model for scalable many-to-many threading. However, implementation complexity, coordination overhead, and the need for close runtime-kernel cooperation limited widespread adoption. Modern threading systems commonly use different kernel-thread arrangements rather than this historical mechanism.

Misconceptions About Scheduler Activation Events

'An upcall is an ordinary application system call' is incorrect because it is a kernel-originated notification to the user-level scheduler. 'A virtual processor is always a physical CPU core' is incorrect because it is an execution abstraction. 'Scheduler activations eliminate kernel scheduling' is incorrect because the kernel still manages underlying execution resources.

Exam Focus: Upcalls and User-Kernel Scheduler Interaction

Explain the roles of virtual processors, lightweight processes, user-level schedulers, and kernel upcalls. Trace what happens when a user thread blocks and later becomes runnable. Questions may compare scheduler activations with many-to-many mapping and identify how kernel notifications help maintain usable execution capacity.

Key Terms of Scheduler Activations

  • Scheduler activation - User-kernel scheduling coordination mechanism.
  • Upcall - Kernel notification to user-level code.
  • Virtual processor - Execution resource supplied to a runtime.
  • Lightweight process - Kernel-supported execution entity.
  • User scheduler - Runtime managing user threads.
  • Blocking event - Event suspending an execution entity.
11
Easy
11
Medium
11
Hard

📝 All Scheduler activations in operating system MCQs

Q1. A language runtime manages many user-level threads over a few kernel-supported execution entities. The kernel can block or preempt an entity without knowing which application thread it was running. What coordination problem does this create?

A.The runtime may have an outdated view of which user threads are running and which execution resources remain usable ✅
B.The kernel loses control of physical processor allocation
C.Every user-level thread is converted into a separate process
D.The runtime is forced to execute all user threads serially
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The kernel can change execution state without exposing the affected user-level thread to the runtime. Scheduler activations address this information gap by delivering kernel events so the user scheduler can update its state and decisions.

Q2. In a scheduler-activation design, which allocation of responsibilities is correct?

A.The user-level scheduler assigns physical processors to address spaces, while the kernel chooses each application thread
B.The kernel chooses every user-level thread, while the runtime only records statistics
C.The kernel allocates processors to an address space, while that address space's runtime chooses which user-level threads use them ✅
D.The kernel and runtime independently select threads for the same processor without exchanging state
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The kernel controls how many processors an address space receives, while its user-level scheduler selects application threads for those processors. This division preserves kernel control over machine resources and runtime control over application-level scheduling policy.

Q3. A runtime is told that its process currently has three processors and later receives notice that one has been reassigned elsewhere. Which interpretation of its virtual multiprocessor is correct?

A.It represents the set of processors currently allocated to the address space, and its size can change during execution ✅
B.It is a permanently reserved set of three physical cores
C.It is the collection of user-level thread identifiers, not execution resources
D.It guarantees that every runnable user-level thread has a dedicated processor
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A virtual multiprocessor presents the processors currently allocated to an address space as its execution resource. The kernel may increase or decrease that allocation, so the runtime must track changes rather than assume permanence.

Q4. Which description captures the three principal functions of a scheduler activation?

A.It creates a process, allocates virtual memory, and terminates blocked threads
B.It selects application priorities, releases user locks, and assigns physical cores
C.It stores every user-level thread's stack, schedules I/O, and replaces the kernel scheduler
D.It provides an execution context, communicates a kernel event, and supports saving the stopped thread's processor state ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: A scheduler activation is an execution context for user-level work, a vehicle for notifying the runtime about a kernel event, and a place in which the stopped thread's processor state can be saved for later recovery.

Q5. A kernel detects that an execution event requires attention from a process's user-level thread manager. What does an upcall do in this design?

A.It asks the application to enter the kernel through an ordinary system call
B.It transfers control from the kernel into the address space's scheduler code to report the event ✅
C.It transfers control directly to an arbitrary blocked user thread without informing the runtime
D.It permanently raises the process's processor allocation
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: An upcall is initiated by the kernel and enters the address space's thread-management code. It reports a kernel event in a scheduler-activation context, allowing the runtime to update thread state and choose subsequent work.

Q6. A process has three runnable user threads and two allocated execution contexts. One running thread blocks in a disk read. What is the intended immediate response?

A.Wait until the disk read completes because a blocked user thread prevents all other threads from running
B.Create a physical processor for every remaining runnable thread
C.Notify the user-level scheduler so it can run another eligible thread using execution capacity that remains available ✅
D.Mark the two other user threads as blocked because they share the same address space
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The blocking event must be reported so the runtime can stop treating the affected execution context as occupied by that thread. It can then dispatch another ready user thread on available processor capacity.

Q7. A student says that when a user-level thread blocked in the kernel becomes unblocked, the kernel simply resumes that same thread in its old scheduler activation. Which correction is most accurate?

A.The kernel creates a notification through a new activation, and the runtime decides how and when to schedule the unblocked user thread ✅
B.The kernel resumes every user-level thread in the process at once
C.The blocked thread must be terminated before another activation can be created
D.The old activation remains permanently reserved even while the thread is blocked
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The flawed step is assuming direct resumption in the old activation. The kernel reports the unblocking event through an activation, and the runtime returns the affected user thread to its scheduling structures before selecting work.

Q8. After an I/O completion notification, a previously blocked user-level thread is eligible to run again. What should the runtime normally do with that thread first?

A.Treat it as already executing because I/O completion resumes application code automatically
B.Assign it every processor in the virtual multiprocessor
C.Discard its saved register state and restart the thread from its entry point
D.Place it back among ready threads, then select a thread according to the runtime's scheduling policy ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: I/O completion changes the thread from blocked to eligible, not automatically to executing. The runtime records it as ready and chooses which eligible thread should use an available scheduler activation under its own policy.

Q9. In the described implementation, a scheduler activation has separate kernel and application-address-space stacks. When a user-level thread traps into the kernel, which stack is used for the kernel-side execution?

A.The stack belonging to the next user-level thread in the ready queue
B.A single process-wide stack shared by all activations
C.The kernel stack associated with that scheduler activation ✅
D.The user-level thread's own stack is remapped as the kernel stack
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Each activation has a kernel-mapped stack and an application-mapped stack. A user-level thread uses the activation's kernel stack when it enters the kernel, while the runtime scheduler executes on the application-side stack.

Q10. An application has five runnable user-level threads throughout an interval. Its allocated execution contexts are shown as (time, contexts): (0,3); (1,2); (2,2); (3,4); (4,3); (5,1). At time 3, what is the maximum number of these threads that can execute simultaneously?

A.Five, because every runnable thread must execute at once
B.Four, because four execution contexts are allocated at that time ✅
C.Three, because the initial allocation remains fixed for the whole interval
D.Two, because the smallest earlier allocation limits all later execution
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: At time 3 the plot gives four allocated execution contexts. Even though five threads are runnable, simultaneous execution is bounded by available contexts, so the maximum is min⁡(5,4)=4\min(5,4)=4 threads at that observation.

Q11. An engineer manages 120 user-level threads on four kernel-supported lightweight processes (LWPs). Which interpretation of this arrangement is correct?

A.The kernel must create 120 physical processors before the runtime can schedule any thread
B.The runtime multiplexes the 120 user-level threads over the four allocated execution contexts; one kernel entity is not required per user thread ✅
C.Each user-level thread permanently owns one of the four execution contexts
D.The four execution contexts mean that only four user-level thread objects may exist
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The kernel supplies a limited number of execution contexts to the address space, while the user-level scheduler multiplexes many application threads over them. The mapping is not necessarily one kernel entity per user-level thread.

Q12. A developer claims that an I/O completion makes the kernel directly resume the blocked user-level thread without notifying the runtime. What is the specific flaw in this reasoning?

A.It confuses an I/O completion with process creation
B.It assumes that the user scheduler controls the physical interrupt controller
C.It treats an unblocking event as a direct restart; the kernel instead notifies the user scheduler, which restores the thread to its own scheduling structures ✅
D.It assumes that a blocked thread can never become runnable again
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The flawed step is bypassing the user scheduler. An unblocking event is delivered to the runtime, which updates the ready list and chooses a thread; the kernel does not independently select that user-level thread.

Q13. A program begins with one allocated processor and then the kernel grants it a second. How is the new capacity normally exposed to the user-level thread system?

A.The runtime discovers it by polling every user thread's stack
B.The kernel creates another scheduler activation and upcalls to tell the runtime that the processor is available ✅
C.The kernel terminates one existing user thread to make room
D.The processor is added to the process without any scheduling notification
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: When another processor is assigned, the kernel creates an activation for that execution resource and enters the user-level scheduler through an upcall. The runtime can then choose a ready thread to run there.

Q14. A multiprogrammed system reclaims one processor from an address space that was running a user-level thread on it. What information must the affected runtime receive?

A.Only the identity of the process that requested the processor
B.A guarantee that the same user thread will continue on the reclaimed processor
C.A command to terminate every thread previously running in the address space
D.A preemption notification and the stopped execution state, so the associated user thread can be returned to the ready list ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The runtime must learn that its processor allocation has decreased and identify the user thread stopped on the reclaimed activation. It can then update the ready list and schedule remaining work on processors still assigned.

Q15. A blocking event and a processor reallocation event occur close together and both require runtime attention. Which notification behavior is supported by this design?

A.The kernel can combine the relevant events into one upcall carrying the information needed to handle both ✅
B.The kernel must suppress one event because each activation represents exactly one event
C.The runtime receives no notification until every user-level thread terminates
D.The events are converted automatically into two independent application processes
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: When kernel events occur in combination, one upcall can communicate all events that need handling. The user-level scheduler processes the combined state changes rather than assuming that every event requires a separate entry.

Q16. A runtime receives notice that one user-level thread blocked, but its event handler marks every thread in the process as blocked. What is the main error?

A.It should have increased the number of physical processors instead
B.It treated a process-wide address space as though it could contain only one thread
C.It applied one thread's blocking state to unrelated threads, removing runnable work from scheduling consideration ✅
D.It should have deleted the blocked thread's stack before notifying the kernel
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The flawed update spreads one thread's blocking condition to unrelated threads. Only the affected thread should become blocked; other ready threads must remain eligible so the runtime can use available execution capacity.

Q17. A runtime's ready queue grows beyond the number of processors currently allocated to its address space. Which user-to-kernel communication is appropriate?

A.Report that every processor is idle so the kernel can take them away
B.Ask the kernel to select the next user-level thread directly
C.Report that the application has no further parallel work
D.Indicate that additional processors are needed, allowing the kernel's allocator to consider the request ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: When runnable parallelism exceeds allocated processor capacity, the address space can tell the kernel that it needs more processors. This information informs allocation policy, but it does not guarantee an immediate grant.

Q18. A runtime has four allocated processors but only two runnable user threads. What should it communicate when an execution context is genuinely idle and available for reassignment?

A.That one processor is idle and may be taken if another address space needs it ✅
B.That two blocked threads should be marked as running
C.That the kernel must create two additional processors for the same address space
D.That all user-level scheduling decisions should now move into the kernel
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The runtime can report an idle processor so the kernel may reassign it to another address space. This avoids retaining execution capacity that the application currently cannot use for runnable work.

Q19. An application has three allocated processors throughout the interval. The graph gives (time, runnable user threads): (0,2); (1,3); (2,4); (3,5); (4,2); (5,1). At what earliest time does runnable work exceed allocated processor capacity?

A.Time 1
B.Time 2 ✅
C.Time 3
D.Time 4
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: With three processors, the queue first exceeds capacity when its runnable count becomes four. The sequence is two, three, then four, so the first excess occurs at time 2, not when the counts are equal.

Q20. Why does the user-level thread system notify the kernel about only a subset of its thread operations rather than every creation, dispatch, or context switch?

A.The kernel cannot receive messages from a user address space
B.The user scheduler is not permitted to create or switch user-level threads
C.Only selected changes affect processor-allocation decisions, so limiting notifications avoids kernel-crossing overhead for common operations ✅
D.Every user-level thread operation already changes the number of physical processors
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Most user-level scheduling operations do not change how many processors the address space needs. Reporting only allocation-relevant transitions preserves the low cost of common runtime operations while still informing the kernel when resource demand changes.

Q21. A student argues that every user-level thread creation and every user-level context switch must trap into the kernel, because the kernel alone decides which application thread runs next. Which correction fixes the reasoning?

A.The kernel decides each user-level dispatch, but it performs the switch without any runtime state
B.Thread creation is forbidden unless the kernel allocates a new physical core
C.The runtime must create a new process for every user-level context switch
D.The runtime normally schedules its own threads; it informs the kernel only about user-level events that can affect processor allocation ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The mistaken assumption gives the kernel responsibility for every application-thread choice. The runtime handles ordinary user-level scheduling locally and communicates only the subset of state changes relevant to the kernel's processor-allocation decisions.

Q22. A server has 120 runnable user-level threads but receives four execution contexts from the kernel. Which statement correctly distinguishes concurrency from simultaneous parallel execution?

A.The runtime can manage all 120 as concurrent work, but at most four can execute simultaneously on the allocated contexts ✅
B.All 120 execute simultaneously because they are user-level threads
C.Only four user-level threads can exist in the process
D.The four contexts imply that the other 116 threads have terminated
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Concurrency allows many threads to make progress through scheduling over time, whereas simultaneous execution requires a processor context. With four allocated contexts, at most four of the 120 runnable threads execute at once.

Q23. A language runtime uses scheduler activations so that ordinary user-thread operations remain local, while kernel events are reported when necessary. Which performance benefit is the design intended to preserve?

A.Every thread operation becomes a system call with a fixed cost
B.Application scheduling policies are replaced by one universal kernel policy
C.Common thread-management operations can retain low user-level overhead without losing awareness of important kernel events ✅
D.Kernel notifications eliminate all context switches and state management
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The design keeps frequent thread operations in the user-level runtime, avoiding unnecessary protection-boundary crossings. Kernel notifications still provide system integration for blocking and processor changes, balancing efficiency with correct scheduling information.

Q24. A media server spends much of its time waiting for disk and network operations, while several other user-level threads remain ready. Why is coordinated scheduling especially useful for this workload?

A.I/O waiting permanently converts every user thread into a kernel thread
B.Blocking and completion events can change usable execution capacity, allowing the runtime to schedule ready work instead of relying on stale assumptions ✅
C.I/O-bound programs never require processor allocation from the kernel
D.The runtime can force the disk operation to finish before switching threads
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Blocking-heavy workloads frequently change which execution contexts can run useful work. Notifications let the runtime react to those changes and dispatch ready threads, reducing avoidable idle intervals while I/O remains pending.

Q25. A graph lists (allocated processors, runnable user threads) at six observations: (1,3); (2,5); (3,4); (4,2); (5,1); (6,5). At which observation is surplus allocated capacity over runnable work greatest?

A.(3,4), because it has three allocated processors
B.(4,2), because two processors are idle
C.(6,5), because it has six allocated processors
D.(5,1), because five processors are allocated for one runnable thread ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Surplus capacity is allocated processors minus runnable threads. The values are negative, negative, negative, two, four, and one; therefore the greatest surplus is at (5,1), with 5−1=45-1=4 idle contexts, exceeding every other plotted surplus.

Q26. During a preemption, a user-level thread is interrupted while holding the runtime's ready-list lock. The new upcall also needs that lock to place the interrupted thread back on the ready list. What recovery approach prevents deadlock?

A.Temporarily continue the interrupted thread until it exits the critical section, then return control to the upcall ✅
B.Delete the ready list and rebuild it without checking thread states
C.Allow the upcall to wait indefinitely for the lock while the interrupted thread remains stopped
D.Release every user-level lock from the kernel without consulting the runtime
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: If the interrupted thread holds the ready-list lock, the upcall cannot safely acquire it while that thread remains stopped. Continuing the lock holder until it exits the critical section lets event handling proceed safely.

Q27. A user-level thread holds a spin-lock when its underlying execution is preempted. Other user threads continue spinning on that lock. Which consequence explains why kernel preemption must be communicated to the runtime?

A.The spin-lock is automatically transferred to the next scheduled thread
B.Processors can waste time spinning while the lock holder cannot run; the runtime needs the event to apply an appropriate recovery or scheduling action ✅
C.The preempted thread's critical section is automatically completed by the kernel
D.The lock becomes process-private and cannot be observed by other threads
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Preempting a lock holder can leave other threads spinning without progress because the owner is not executing to release the lock. Event notification lets the runtime recognize and handle this unsafe preemption situation.

Q28. A student claims that the kernel understands every user-level mutex and automatically releases any lock held by a thread before sending a preemption upcall. What is wrong with this explanation?

A.The kernel must delete the entire address space before any upcall can occur
B.User-level mutexes can only be used by processes, never by threads
C.The kernel does not generally know the runtime's lock data structures; the runtime must handle a preempted critical section safely ✅
D.A preemption notification is delivered only after all locks are released
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The flawed step assumes kernel knowledge of application-level synchronization structures. The kernel reports the preemption and saved state, while the runtime must detect critical-section conditions and use its own recovery protocol.

Q29. A user thread faults while running on an activation. The runtime already maintains the thread's stack and control block. Which state is particularly important for the kernel to save and provide with the notification?

A.The complete ready queue of every process in the system
B.All source-code lines executed by the user thread since creation
C.The values of every heap object reachable from the thread's stack
D.The processor's machine state, including the register context needed to continue execution ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The runtime retains the thread's stack and control block, but the interrupted register state must be preserved by low-level kernel handling. That machine state is supplied with the notification so the runtime can resume correctly.

Q30. A user thread is blocked on I/O. When the I/O completes, the kernel must also preempt one processor currently assigned to the same address space to perform the notification. What should the combined upcall enable the runtime to do?

A.Return both the newly unblocked thread and the preempted thread to the ready list, then choose which one should run ✅
B.Resume the unblocked thread directly and discard the preempted thread's state
C.Treat the I/O completion as proof that the address space has gained another processor
D.Terminate the thread that was preempted so the I/O thread can continue
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The upcall can report both I/O completion and processor preemption together. The runtime makes the unblocked and preempted user threads ready, then selects work according to its policy and the remaining allocation.

Q31. A process has two allocated processors running user threads U1 and U2, while U3 and U4 are ready. U1 blocks, and the runtime schedules U3 on the freed execution capacity. Later, the kernel reclaims one processor for another address space. What must happen to the user thread stopped on that reclaimed processor?

A.It must be terminated because its processor no longer belongs to the process
B.It remains marked as running because the process originally had two processors
C.Its saved state is reported to the runtime and the associated user thread is returned to the ready list for possible later execution ✅
D.It is automatically migrated to the other address space with its locks and stack unchanged
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Reclaiming a processor stops the activation and its current user thread, but does not imply that the user thread has terminated. The upcall gives the runtime its state so it can reschedule that thread later.

Q32. A runtime requests two additional processors because it has more runnable threads than allocated contexts. Before the kernel grants them, several threads block, leaving no extra runnable work. If a requested processor is nevertheless assigned, what should the runtime do?

A.Run a blocked thread on it even though its blocking condition has not cleared
B.Report that the processor is no longer needed and make it available for reassignment ✅
C.Keep it idle indefinitely because a previous request reserves it permanently
D.Convert the idle processor into a new user-level thread
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Processor-demand notifications are hints because workload parallelism can change before allocation occurs. If a granted processor is no longer useful, the runtime should report it idle so the kernel can reassign it.

Q33. A runtime uses scheduler activations and receives every relevant kernel notification, but its own policy continually favors one high-priority user thread while lower-priority runnable threads wait. Which conclusion is justified?

A.Scheduler activations automatically make every user-level thread equally likely to run
B.Kernel notifications force the runtime to use round-robin scheduling
C.The kernel will detect the starvation and choose a different user-level thread directly
D.Coordination provides event and resource information, but fairness among user-level threads still depends on the runtime's scheduling policy ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Scheduler activations coordinate kernel events and processor resources; they do not prescribe a fair user-level scheduling policy. A runtime that persistently favors one thread can still starve others unless its own policy prevents it.

🔗 Related Topics (MCQs)