📝 Thread priorities in Process management in Window 7 (6 MCQs)
Priority Levels for Windows 7 Threads
Windows 7 assigns each thread a scheduling priority that influences its position among runnable threads. The system provides 32 priority levels numbered 0 through 31, with priority 0 reserved for a special system role. Ordinary variable priorities occupy levels 1 through 15, while real-time priorities occupy levels 16 through 31.
Why Different Threads Need Different Scheduling Importance
Applications contain threads with different responsiveness requirements. A user-interface thread may need prompt execution, while a background maintenance thread can tolerate delay. Priority levels allow Windows to prefer urgent work, although excessive high-priority activity may starve ordinary threads.
Base Priority and Dynamic Priority Adjustments
A process has a priority class, and each thread has a relative priority within that class. Windows derives a base priority and may adjust variable-priority threads dynamically in response to events. The scheduler chooses the highest-priority ready thread, while equal-priority threads share processor time according to scheduling rules.
Example of Two Thread Priorities
Two ready threads belong to the same process. Thread A has priority 10, while Thread B has priority 7. On an available processor, A is selected first. If A blocks for I/O, B may run; when A becomes ready again, its higher priority can allow pre-emption.
Responsiveness and Priority Inversion Risks
Thread priorities improve responsiveness for selected work but do not guarantee completion deadlines. A high-priority thread waiting for a lock held by a low-priority thread can experience priority inversion. Synchronisation design and priority boosts help address selected cases, but excessive priority assignment can reduce system-wide fairness.
Misconceptions About Windows Thread Priorities
'Priority 31 is lower than priority 1' reverses the numeric order. 'A thread's priority never changes' ignores dynamic boosts and other adjustments. 'High priority guarantees immediate execution' overlooks processor availability, interrupts, locks, and higher-priority runnable threads.
Exam Focus: Priority Classes and Relative Thread Levels
Identify the 0 to 31 priority range and distinguish variable priorities from real-time levels. Explain how process priority class combines with relative thread priority. Questions may compare two ready threads, examine priority inversion, or ask why a high-priority thread can still remain blocked.
Key Terms of Windows Thread Priorities
- Priority level - Numeric scheduling importance of a thread.
- Variable priority - Dynamically adjustable priority range.
- Real-time priority - Higher priority scheduling range.
- Priority inversion - High-priority task delayed by lower-priority ownership.
- Priority boost - Temporary increase in scheduling priority.
📝 All Thread priorities in Process management in Window 7 MCQs
Q1. What does APC stand for in the Windows kernel?
📖 Explanation: An APC is an Asynchronous Procedure Call, a mechanism that lets the system queue a routine to run in the context of a specific thread. Option A matches this definition. Options B, C, and D are unrelated terms; they describe unrelated concepts and thus are incorrect. Knowing the correct expansion helps identify the role of APCs in thread management and how they differ from other kernel objects.
Q2. Why are DPC routines executed at a priority higher than normal threads but lower than hardware interrupts?
📖 Explanation: DPCs run after the ISR finishes, so they need a priority above standard threads to ensure timely processing, yet they must stay below hardware interrupt levels to avoid delaying critical ISRs. Option A captures this balance. Options B, C, and D mischaracterize DPC priority relative to user‑mode code, thread priority, or core allocation, making them inaccurate.
Q3. A driver queues a DPC to handle a timer expiration while many threads are ready to run. What is the most likely effect on thread scheduling?
📖 Explanation: When a DPC is queued, it is given a priority above normal threads, so the scheduler will run the DPC first, postponing thread execution until the DPC completes. This ensures timely handling of deferred work. Option A describes this behavior. Option B is wrong because DPCs outrank regular threads; Option C is incorrect because the scheduler does not split time equally; Option D is false since DPCs are not ignored.
Q4. In which condition can a user‑mode APC be delivered to a thread?
📖 Explanation: User‑mode APCs are delivered only when a thread is waiting in the kernel and has been marked as alertable, allowing the system to invoke the APC safely. Option C states this precisely. Option A is incorrect because a non‑alertable wait blocks APC delivery. Option B is wrong because APCs run in user mode, not during kernel execution. Option D misstates priority requirements, which are unrelated to APC delivery.
Q5. If a system experiences a surge of queued DPCs, which outcome is most likely regarding thread quantum and overall responsiveness?
📖 Explanation: A large number of DPCs can consume CPU time, prompting the scheduler to shorten thread quanta to maintain system balance, which leads to more context switches and can degrade responsiveness. Option A reflects this effect. Option B is opposite of typical behavior; Option C is inaccurate because DPCs run on the same core unless multi‑core scheduling is explicitly used; Option D misrepresents priority adjustments, which are not automatically made for DPC load.
Q6. A developer wants to ensure that an APC delivering I/O completion runs promptly without being delayed by lower‑priority threads. Which action should they take?
📖 Explanation: To guarantee timely APC execution, the thread must be in an alertable wait state, allowing the kernel to deliver the APC as soon as possible. Option C correctly describes this requirement. Raising the thread’s priority (Option A) does not affect APC delivery because APCs are independent of thread priority. Lowering DPC priority (Option B) does not influence APC scheduling. Disabling other APCs (Option D) is unnecessary and could interfere with system functionality.