📝 Scheduling rule in Process management in Window 7 (6 MCQs)
Preemptive Priority Scheduling in Windows 7
Windows 7 uses priority-driven pre-emptive scheduling to allocate processor time among runnable threads. The scheduler selects the highest-priority eligible thread for an available CPU, with round-robin selection among equal-priority ready threads. Thread priorities are organised into variable and real-time ranges, while quantum allocation influences how long a thread runs before reconsideration.
Why Priority Rules Must Balance Responsiveness and Fairness
Interactive programs, background services, and time-sensitive tasks have different response requirements. A simple arrival-order policy would not adequately prioritise urgent work. Windows uses priority levels and pre-emption to respond to important threads, while dynamic adjustments can improve responsiveness for selected interactive workloads.
Ready Queues, Priority Selection and Quantum
The scheduler maintains ready threads organised by priority. A newly ready thread with a higher priority can pre-empt the current thread. Threads at the same priority share execution through quantum-based rotation, while waiting threads become ready after an event or resource becomes available.
Example of Priority Based Pre-emption
A normal application thread is running at priority 8. A device event makes a ready thread at priority 12 eligible for execution. The scheduler selects the higher-priority thread and the dispatcher performs a context switch. The original thread remains ready and can resume when higher-priority work no longer requires the CPU.
Priority Responsiveness and Starvation Risk
Priority scheduling helps important tasks respond quickly, but sustained high-priority work may delay lower-priority threads. Windows can apply dynamic priority boosts for selected events, while real-time priorities require careful use. Scheduling behaviour also depends on processor availability, affinity, quantum settings, and the current Windows edition and configuration.
Misconceptions About Windows Scheduling Rules
'The scheduler chooses the oldest ready thread first' ignores priority selection. 'A higher numeric priority value means lower priority' reverses Windows priority ordering. 'Every thread receives the same quantum and CPU share' overlooks priority classes, thread state, and scheduling adjustments.
Exam Focus: Priority Pre-emption and Ready Queues
Compare two ready threads by priority and identify which executes first. Explain pre-emption, equal-priority rotation, and quantum expiration. Questions may examine dynamic priority boosts, real-time levels, starvation, or the distinction between scheduling priority and the priority class selected for a process.
Key Terms of Windows Scheduling Rules
- Pre-emption - Interrupting one thread for another.
- Ready queue - Collection of runnable threads.
- Priority - Scheduling importance assigned to a thread.
- Quantum - Allocated processor time interval.
- Dynamic boost - Temporary increase in thread priority.
📝 All Scheduling rule in Process management in Window 7 MCQs
Q1. What does APC stand for in Windows kernel terminology?
📖 Explanation: An APC, or Asynchronous Procedure Call, is a mechanism that allows the system to execute a procedure in the context of a specific thread at a later, safe point. Option A correctly defines this term. Options B, C, and D describe unrelated concepts; they do not match the established abbreviation. Understanding the exact meaning helps developers correctly use APCs for thread control and I/O notifications.
Q2. Why are Deferred Procedure Calls (DPC) scheduled at a priority lower than hardware interrupt service routines but higher than normal thread execution?
📖 Explanation: DPCs are placed below hardware ISRs so that the most urgent interrupt handling is never delayed. At the same time, they sit above normal threads, ensuring that the deferred work completes before regular scheduling resumes. This ordering balances responsiveness and system stability. Option B captures this hierarchy; the other options misrepresent the priority relationship or the execution mode of DPCs.
Q3. How does the requirement that user‑mode APCs can execute only when a thread is in an alertable wait state affect system responsiveness and security?
📖 Explanation: User‑mode APCs are only delivered when a thread voluntarily enters an alertable wait, which creates a predictable point for execution. This limitation prevents APCs from interrupting arbitrary code paths, enhancing security by reducing opportunities for malicious injection. At the same time, it can modestly affect responsiveness because the APC must wait for the alertable state. Options A, C, and D describe incorrect behaviors that do not align with the Windows scheduling model.
Q4. A driver receives a high‑frequency hardware interrupt. The ISR quickly queues a DPC to process the data and then returns. If the DPC routine takes longer than the scheduling quantum, what is the most likely impact on other threads on the same CPU?
📖 Explanation: When a DPC runs, it monopolizes the CPU at a priority above normal threads, preventing those threads from being scheduled until the DPC yields or completes. If the DPC exceeds its quantum, the scheduler does not pre‑empt it for regular threads, so other threads remain blocked. Option A describes this behavior. Options B and C suggest mechanisms that do not exist for DPCs, and D describes an extreme error condition that is not typical for long DPC execution.
Q5. Suppose a developer queues a long‑running computation to a worker thread via a DPC, instead of using the thread pool. Which of the following best describes the effect on overall system latency?
📖 Explanation: Running a lengthy task as a DPC elevates its priority above normal threads, which can delay other DPCs and critical interrupt processing, thereby raising overall latency. Option C captures this side effect. Option A incorrectly assumes higher priority always improves latency, while B ignores the priority difference. Option D misstates the relationship between ISR and DPC, as moving work to a DPC does not inherently speed up ISR handling.
Q6. In a multi‑core system, a thread is marked alertable and awaiting I/O completion. Simultaneously, a high‑priority DPC is queued on the same core. Which sequence ensures that the thread’s APC runs after the DPC without starving the thread?
📖 Explanation: The correct order is that the DPC executes first because it has higher priority than normal threads, and once it finishes, the scheduler checks for pending APCs when the thread returns to an alertable wait state. This guarantees the APC runs after the DPC without causing starvation. Option B describes this flow. Option A would invert priorities, which is not allowed. Option C suggests pre‑emption that does not occur, and Option D describes an impossible simultaneous execution on a single core.