πŸŽ“ BookMCQ
← Back to 6. CPU Scheduling

πŸ“ Windows Scheduling (69 MCQs)

πŸ“– From Operating System β€’ 6. CPU Scheduling β€’ 69 questions available

What is Windows Scheduling?

Definition:
Windows uses a priority-based preemptive scheduler with 32 priority levels (0-31), combining base priority and dynamic boosts, with quantum-based round-robin within same-priority threads.

Example:
A foreground GUI thread receives temporary priority boost +2 upon window activation, decaying after 3 quanta to prevent starvation of background services.

Reason:
The hybrid priority-quantum design balances responsiveness for interactive applications with fairness for background tasks, though complexity arises from numerous boost/decay heuristics tuned empirically over decades.

20
Easy
32
Medium
17
Hard

πŸ“ All Windows Scheduling MCQs

Q1. What type of scheduling algorithm does Windows use for thread scheduling?

A.Round-robin scheduling
B.Priority-based, preemptive scheduling βœ…
C.First-come, first-served scheduling
D.Proportional share scheduling
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: Windows uses a priority-based, preemptive scheduling algorithm. This means that threads are assigned priorities, and the highest-priority ready thread always runs. A running thread can be preempted if a higher-priority thread becomes ready.

Q2. What is the name of the Windows kernel component that handles scheduling?

A.The scheduler
B.The dispatcher βœ…
C.The interrupt handler
D.The memory manager
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The portion of the Windows kernel that handles scheduling is called the dispatcher. It is responsible for selecting the next thread to run and performing the context switch. The dispatcher always selects the highest-priority ready thread.

Q3. How many priority levels does the Windows dispatcher use?

A.16
B.32 βœ…
C.64
D.128
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The Windows dispatcher uses a 32-level priority scheme to determine the order of thread execution. Priorities range from 0 to 31, with higher numeric values indicating higher priority. Priority 0 is reserved for memory management.

Q4. Which priority level in Windows is used for memory management?

A.0 βœ…
B.1
C.15
D.16
πŸ’‘ Difficulty: easy | βœ… Correct: A

πŸ“– Explanation: Priority 0 is used for memory management in Windows. This special thread handles memory-related tasks and runs when no other threads are ready. It is the lowest priority level in the system.

Q5. What are the two priority classes in the Windows 32-level priority scheme?

A.Variable class and Real-time class βœ…
B.Normal class and High class
C.Idle class and Realtime class
D.Foreground class and Background class
πŸ’‘ Difficulty: easy | βœ… Correct: A

πŸ“– Explanation: Windows divides priorities into two classes: the variable class (priorities 1 to 15) and the real-time class (priorities 16 to 31). The variable class contains threads whose priorities can change, while the real-time class contains threads with fixed priorities.

Q6. What range of priorities does the variable class cover in Windows?

A.0 to 15
B.1 to 15 βœ…
C.16 to 31
D.0 to 31
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The variable class in Windows covers priorities from 1 to 15. Threads in this class can have their priorities adjusted by the system, typically lowered on quantum expiration or boosted after wait operations. Priority 0 is used for memory management.

Q7. What range of priorities does the real-time class cover in Windows?

A.1 to 15
B.0 to 15
C.16 to 31 βœ…
D.0 to 31
πŸ’‘ Difficulty: easy | βœ… Correct: C

πŸ“– Explanation: The real-time class in Windows covers priorities from 16 to 31. Threads in this class have fixed priorities and run at higher priority than variable class threads. Real-time threads get preferential access to the CPU when they need it.

Q8. How does the dispatcher select the next thread to run in Windows?

A.It uses a round-robin approach
B.It traverses queues from highest to lowest priority βœ…
C.It selects the thread that has been waiting the longest
D.It uses a random selection algorithm
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: The dispatcher uses a queue for each scheduling priority and traverses the set of queues from highest to lowest priority until it finds a thread that is ready to run. This ensures that the highest-priority ready thread is always selected.

Q9. What happens if the dispatcher finds no ready thread in any priority queue?

A.The system crashes
B.It executes a special idle thread βœ…
C.It waits for an interrupt
D.It shuts down the system
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: If no ready thread is found, the dispatcher executes a special thread called the idle thread. This thread runs when the system has no work to do and typically places the CPU in a low-power state until an interrupt occurs.

Q10. Which Windows API function can be used to alter the priority class of a process?

A.SetPriorityClass() βœ…
B.SetThreadPriority()
C.SetProcessPriority()
D.ChangePriorityClass()
πŸ’‘ Difficulty: easy | βœ… Correct: A

πŸ“– Explanation: The SetPriorityClass() function in the Windows API can be used to alter the priority class of a process. This allows programs to change their priority level dynamically based on their needs.

Q11. How many priority classes does the Windows API identify?

A.4
B.5
C.6 βœ…
D.7
πŸ’‘ Difficulty: easy | βœ… Correct: C

πŸ“– Explanation: The Windows API identifies six priority classes: IDLE, BELOW NORMAL, NORMAL, ABOVE NORMAL, HIGH, and REALTIME. Processes can belong to one of these classes, which determines the base priority range for their threads.

Q12. Which priority class is the default for most processes in Windows?

A.IDLE PRIORITY CLASS
B.NORMAL PRIORITY CLASS βœ…
C.HIGH PRIORITY CLASS
D.REALTIME PRIORITY CLASS
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: Processes are typically members of the NORMAL PRIORITY CLASS. This is the default class unless the parent process was in the IDLE PRIORITY CLASS or unless another class was specified when the process was created.

Q13. Which priority class in Windows has threads with variable priorities?

A.REALTIME PRIORITY CLASS
B.All priority classes
C.All classes except REALTIME PRIORITY CLASS βœ…
D.Only NORMAL PRIORITY CLASS
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: Priorities in all classes except the REALTIME PRIORITY CLASS are variable. This means that threads belonging to these classes can have their priorities changed by the system, typically to improve responsiveness or manage CPU usage.

Q14. Which priority class in Windows has threads with fixed priorities?

A.REALTIME PRIORITY CLASS βœ…
B.HIGH PRIORITY CLASS
C.NORMAL PRIORITY CLASS
D.IDLE PRIORITY CLASS
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: The REALTIME PRIORITY CLASS has threads with fixed priorities. Threads in this class are not subject to priority adjustments, ensuring they receive consistent, predictable CPU access for time-critical tasks.

Q15. What are the seven relative priority values for threads within a priority class in Windows?

A.IDLE, LOW, MEDIUM, HIGH, CRITICAL
B.IDLE, LOWEST, BELOW NORMAL, NORMAL, ABOVE NORMAL, HIGHEST, TIME CRITICAL βœ…
C.LOW, NORMAL, HIGH, REALTIME, CRITICAL
D.BASE, NORMAL, HIGH, REALTIME, MAXIMUM
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The seven relative priority values for threads within a priority class are: IDLE, LOWEST, BELOW NORMAL, NORMAL, ABOVE NORMAL, HIGHEST, and TIME CRITICAL. These values combine with the priority class to determine the thread's numeric priority.

Q16. What is the numeric priority of a thread in the ABOVE NORMAL PRIORITY CLASS with NORMAL relative priority?

A.8
B.9
C.10 βœ…
D.11
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: According to the Windows priority mapping, a thread in the ABOVE NORMAL PRIORITY CLASS with NORMAL relative priority has a numeric priority of 10. This demonstrates how priority class and relative priority combine to determine the final numeric priority.

Q17. What is the base priority for the REALTIME PRIORITY CLASS in Windows?

A.13
B.10
C.8
D.24 βœ…
πŸ’‘ Difficulty: medium | βœ… Correct: D

πŸ“– Explanation: The base priority for the REALTIME PRIORITY CLASS is 24. This is the highest base priority among all classes, reflecting the importance of real-time threads that need immediate CPU access.

Q18. What is the base priority for the HIGH PRIORITY CLASS in Windows?

A.24
B.13 βœ…
C.10
D.8
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: The base priority for the HIGH PRIORITY CLASS is 13. This is the second-highest base priority among the non-real-time classes, used for system processes that need higher priority than normal processes.

Q19. What is the base priority for the ABOVE NORMAL PRIORITY CLASS in Windows?

A.24
B.13
C.10 βœ…
D.8
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: The base priority for the ABOVE NORMAL PRIORITY CLASS is 10. This class is used for processes that need slightly higher priority than normal processes but not as high as HIGH PRIORITY CLASS processes.

Q20. What is the base priority for the NORMAL PRIORITY CLASS in Windows?

A.24
B.13
C.10
D.8 βœ…
πŸ’‘ Difficulty: medium | βœ… Correct: D

πŸ“– Explanation: The base priority for the NORMAL PRIORITY CLASS is 8. This is the default base priority for most processes in Windows, providing a balanced priority level for typical applications.

Q21. What is the base priority for the BELOW NORMAL PRIORITY CLASS in Windows?

A.6 βœ…
B.4
C.8
D.10
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: The base priority for the BELOW NORMAL PRIORITY CLASS is 6. This class is used for processes that should receive lower priority than normal processes, such as background tasks or less critical applications.

Q22. What is the base priority for the IDLE PRIORITY CLASS in Windows?

A.4 βœ…
B.6
C.8
D.10
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: The base priority for the IDLE PRIORITY CLASS is 4. This is the lowest base priority among all classes, used for processes that only run when the system is otherwise idle.

Q23. What is the initial priority of a thread typically set to in Windows?

A.The lowest priority
B.The base priority of the process the thread belongs to βœ…
C.The highest priority
D.A random priority value
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: The initial priority of a thread is typically the base priority of the process the thread belongs to. This provides a consistent starting priority based on the process's priority class, though it can be modified later using SetThreadPriority().

Q24. Which Windows API function can be used to modify a thread's base priority?

A.SetPriorityClass()
B.SetThreadPriority() βœ…
C.SetProcessPriority()
D.ModifyThreadPriority()
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The SetThreadPriority() function in the Windows API can be used to modify a thread's base priority. This allows individual threads within a process to have different priorities than the process's base priority.

Q25. What happens to a thread's priority when its time quantum runs out in Windows?

A.Its priority is increased
B.Its priority is lowered βœ…
C.Its priority remains unchanged
D.Its priority is reset to base
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: When a thread's time quantum runs out, the thread is interrupted and its priority is lowered if it is in the variable-priority class. This limits the CPU consumption of compute-bound threads, preventing them from monopolizing the CPU.

Q26. How low can a thread's priority be lowered when its time quantum runs out?

A.Below zero
B.Below the base priority
C.Not below the base priority βœ…
D.To the lowest priority
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: When a thread's priority is lowered due to quantum expiration, it is never lowered below the base priority. This ensures that the thread retains at least its original priority level, preventing starvation while still limiting excessive CPU consumption.

Q27. What happens to a variable-priority thread's priority when it is released from a wait operation?

A.Its priority is lowered
B.Its priority remains unchanged
C.The dispatcher boosts its priority βœ…
D.Its priority is reset to base
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: When a variable-priority thread is released from a wait operation, the dispatcher boosts its priority. This helps ensure that threads waiting for I/O or user input get responsive service when the event they are waiting for occurs.

Q28. Which type of thread typically receives the largest priority boost when released from a wait?

A.A thread waiting for disk I/O
B.A thread waiting for keyboard I/O βœ…
C.A thread waiting for network I/O
D.A thread waiting for a timer
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: A thread waiting for keyboard I/O typically receives a large priority boost, while a thread waiting for a disk operation receives a moderate one. This strategy gives good response times to interactive threads that are using the mouse and windows.

Q29. What is the purpose of boosting thread priorities after wait operations?

A.To improve the performance of CPU-bound threads
B.To give good response times to interactive and I/O-bound threads βœ…
C.To reduce context switching overhead
D.To prevent threads from being preempted
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: Priority boosting after wait operations tends to give good response times to interactive threads using input devices and enables I/O-bound threads to keep I/O devices busy. This improves overall system responsiveness.

Q30. What special scheduling rule does Windows have for processes in the NORMAL PRIORITY CLASS?

A.They are always preempted by higher priority threads
B.The foreground process gets a quantum boost βœ…
C.They are not subject to priority adjustment
D.They run at the same priority as real-time threads
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Windows distinguishes between foreground processes (currently selected on the screen) and background processes. When a process moves into the foreground, Windows increases its scheduling quantum by some factorβ€”typically by 3β€”giving it three times longer to run before a time-sharing preemption occurs.

Q31. How much does Windows typically increase the scheduling quantum for a foreground process?

A.2 times longer
B.3 times longer βœ…
C.4 times longer
D.5 times longer
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: When a process moves into the foreground, Windows increases its scheduling quantum by a factor of 3. This gives the foreground process three times longer to run before a time-sharing preemption occurs, improving its performance and responsiveness.

Q32. What feature introduced in Windows 7 allows applications to create and manage threads independently of the kernel?

A.Fibers
B.User-Mode Scheduling (UMS) βœ…
C.Hyper-Threading
D.NUMA
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Windows 7 introduced User-Mode Scheduling (UMS), which allows applications to create and manage threads independently of the kernel. This enables applications to schedule multiple threads without involving the Windows kernel scheduler, improving efficiency for applications with many threads.

Q33. What is the main advantage of User-Mode Scheduling (UMS) over kernel-mode thread scheduling?

A.It provides higher priority to threads
B.It allows threads to run without context switching
C.It is more efficient for applications that create a large number of threads βœ…
D.It eliminates the need for thread synchronization
πŸ’‘ Difficulty: hard | βœ… Correct: C

πŸ“– Explanation: Scheduling threads in user mode is much more efficient than kernel-mode thread scheduling for applications that create a large number of threads, as no kernel intervention is necessary. This reduces overhead and improves performance.

Q34. What was the earlier feature in Windows that allowed several user-mode threads to be mapped to a single kernel thread?

A.User-Mode Scheduling (UMS)
B.Fibers βœ…
C.Thread pools
D.Asynchronous Procedure Calls (APCs)
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Earlier versions of Windows provided a feature known as fibers, which allowed several user-mode threads (fibers) to be mapped to a single kernel thread. This provided a form of user-mode scheduling but had significant limitations.

Q35. What was the main limitation of fibers in Windows?

A.They could not be preempted
B.They were unable to make calls to the Windows API βœ…
C.They consumed too much memory
D.They required kernel involvement
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Fibers were unable to make calls to the Windows API because all fibers had to share the thread environment block (TEB) of the thread on which they were running. This presented a problem if a Windows API function placed state information into the TEB for one fiber, only to have the information overwritten by a different fiber.

Q36. How does User-Mode Scheduling (UMS) overcome the limitations of fibers?

A.By providing each user-mode thread with its own thread context βœ…
B.By using kernel-mode scheduling
C.By eliminating the need for the Windows API
D.By using a single shared context
πŸ’‘ Difficulty: hard | βœ… Correct: A

πŸ“– Explanation: UMS overcomes the limitations of fibers by providing each user-mode thread with its own thread context. This prevents the TEB overwrite problem that plagued fibers, as each thread has its own state information that is not shared with other threads.

Q37. Is UMS intended to be used directly by programmers?

A.Yes, it provides a simple API
B.No, it does not include a user-mode scheduler βœ…
C.Yes, it is a complete scheduling solution
D.No, it requires kernel modification
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: UMS is not intended to be used directly by the programmer. The details of writing user-mode schedulers can be very challenging, and UMS does not include such a scheduler. Rather, schedulers come from programming language libraries that build on top of UMS.

Q38. What is the Concurrency Runtime (ConcRT)?

A.A kernel-mode scheduling feature
B.A C++ concurrent programming framework for task-based parallelism βœ…
C.A fiber management system
D.A priority boosting mechanism
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Concurrency Runtime (ConcRT) is a concurrent programming framework for C++ designed for task-based parallelism on multicore processors. It provides a user-mode scheduler together with facilities for decomposing programs into tasks that can be scheduled on available processing cores.

Q39. What does ConcRT build on top of?

A.Kernel threads
B.Fibers
C.User-Mode Scheduling (UMS) βœ…
D.The Windows dispatcher
πŸ’‘ Difficulty: hard | βœ… Correct: C

πŸ“– Explanation: ConcRT builds on top of UMS (User-Mode Scheduling). It provides a user-mode scheduler that leverages UMS to efficiently schedule tasks on available processing cores, making it easier to develop parallel applications in C++.

Q40. What is the thread environment block (TEB)?

A.The structure that stores thread-specific state information βœ…
B.The queue used by the dispatcher
C.The priority class of a thread
D.The quantum value for a thread
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: The thread environment block (TEB) is a data structure that stores thread-specific state information. It contains data that is private to each thread, such as thread-local storage, stack information, and other context-specific data.

Q41. Why did fibers sharing the TEB cause problems?

A.It caused memory leaks
B.Windows API functions could overwrite TEB information for one fiber with data from another fiber βœ…
C.It made threads run slower
D.It prevented thread creation
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Fibers sharing the TEB caused problems because a Windows API function might place state information into the TEB for one fiber, only to have that information overwritten by a different fiber running on the same thread. This could lead to corrupted state and unpredictable behavior.

Q42. What is the numeric priority of a thread in the REALTIME PRIORITY CLASS with TIME CRITICAL relative priority?

A.31 βœ…
B.24
C.16
D.15
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: According to the Windows priority mapping, a thread in the REALTIME PRIORITY CLASS with TIME CRITICAL relative priority has the highest numeric priority of 31. This provides the maximum priority level for time-critical real-time tasks.

Q43. What is the numeric priority of a thread in the HIGH PRIORITY CLASS with NORMAL relative priority?

A.13 βœ…
B.14
C.15
D.16
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: According to the Windows priority mapping, a thread in the HIGH PRIORITY CLASS with NORMAL relative priority has a numeric priority of 13. This is the base priority for the HIGH PRIORITY CLASS.

Q44. What is the numeric priority of a thread in the IDLE PRIORITY CLASS with NORMAL relative priority?

A.1
B.2
C.3
D.4 βœ…
πŸ’‘ Difficulty: medium | βœ… Correct: D

πŸ“– Explanation: According to the Windows priority mapping, a thread in the IDLE PRIORITY CLASS with NORMAL relative priority has a numeric priority of 4. This is the base priority for the IDLE PRIORITY CLASS.

Q45. What is the numeric priority of a thread in the NORMAL PRIORITY CLASS with HIGHEST relative priority?

A.8
B.10
C.13 βœ…
D.15
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: According to the Windows priority mapping, a thread in the NORMAL PRIORITY CLASS with HIGHEST relative priority has a numeric priority of 15. This is the highest priority achievable in the NORMAL PRIORITY CLASS without using real-time priorities.

Q46. What is the numeric priority of a thread in the NORMAL PRIORITY CLASS with IDLE relative priority?

A.1 βœ…
B.2
C.3
D.4
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: According to the Windows priority mapping, a thread in the NORMAL PRIORITY CLASS with IDLE relative priority has a numeric priority of 1. This is the lowest priority in the NORMAL PRIORITY CLASS, just above the memory management thread.

Q47. What is the purpose of lowering a thread's priority when its time quantum expires?

A.To increase the thread's priority
B.To limit CPU consumption of compute-bound threads βœ…
C.To prevent threads from being scheduled
D.To give threads more CPU time
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Lowering a thread's priority when its time quantum expires tends to limit the CPU consumption of compute-bound threads. This prevents them from monopolizing the CPU and allows other threads, especially I/O-bound and interactive threads, to get CPU time.

Q48. What type of thread typically gets a large priority boost when released from a wait?

A.A compute-bound thread
B.A thread waiting for keyboard input βœ…
C.A thread waiting for disk I/O
D.A background thread
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: A thread waiting for keyboard I/O typically gets a large priority boost. This is because interactive threads that receive user input should be responsive, and boosting their priority ensures they get CPU time quickly when input arrives.

Q49. What type of thread typically gets a moderate priority boost when released from a wait?

A.A thread waiting for keyboard input
B.A thread waiting for disk I/O βœ…
C.A thread waiting for network I/O
D.A thread waiting for a timer
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: A thread waiting for disk I/O typically gets a moderate priority boost. Disk operations are common, and the moderate boost ensures that I/O-bound threads can keep devices busy while not taking priority over interactive threads.

Q50. What is the priority of a thread that is selected to run by the dispatcher?

A.It has the highest priority among ready threads βœ…
B.It has the lowest priority among ready threads
C.It has the same priority as all other threads
D.Its priority is determined by its wait time
πŸ’‘ Difficulty: easy | βœ… Correct: A

πŸ“– Explanation: The dispatcher selects the highest-priority ready thread to run. This ensures that the most important thread always gets CPU time, and lower-priority threads only run when no higher-priority threads are ready.

Q51. What events can cause a running Windows thread to stop running?

A.Preemption by a higher-priority thread, termination, quantum end, or blocking call βœ…
B.Only termination
C.Only quantum end
D.Only blocking calls
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: A running Windows thread can stop running when it is preempted by a higher-priority thread, when it terminates, when its time quantum ends, or when it calls a blocking system call such as for I/O. These are the standard conditions for thread preemption or voluntary yielding.

Q52. What happens when a higher-priority real-time thread becomes ready while a lower-priority thread is running?

A.The lower-priority thread continues running
B.The lower-priority thread is preempted βœ…
C.Both threads run simultaneously
D.The real-time thread waits
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: When a higher-priority real-time thread becomes ready while a lower-priority thread is running, the lower-priority thread will be preempted. This gives real-time threads preferential access to the CPU when they need such access.

Q53. What is the purpose of the idle thread in Windows?

A.To perform background tasks
B.To run when no ready thread is found βœ…
C.To handle interrupts
D.To manage memory
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The idle thread runs when the dispatcher finds no ready thread in any priority queue. This thread typically puts the CPU in a low-power state and waits for an interrupt, which would indicate that a thread has become ready to run.

Q54. How does the dispatcher traverse priority queues to find a ready thread?

A.From lowest to highest priority
B.From highest to lowest priority βœ…
C.In a random order
D.From the middle outward
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: The dispatcher traverses the set of queues from highest to lowest priority until it finds a thread that is ready to run. This ensures that the highest-priority ready thread is always selected, providing strict priority-based scheduling.

Q55. What is the relationship between a thread's priority class and its relative priority?

A.They are independent
B.The priority class determines the base range, and relative priority determines the exact value within that range βœ…
C.Relative priority determines the class
D.They are the same thing
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: The priority of each thread is based on both the priority class it belongs to and its relative priority within that class. The priority class defines the overall range of priorities available to threads in that class, and the relative priority determines the exact numeric value within that range.

Q56. What is the default relative priority for a thread within its priority class?

A.IDLE
B.LOWEST
C.NORMAL βœ…
D.HIGHEST
πŸ’‘ Difficulty: medium | βœ… Correct: C

πŸ“– Explanation: The default relative priority for a thread within its priority class is NORMAL. The base priority for each priority class is defined as the value of the NORMAL relative priority for that class.

Q57. What is the main purpose of Windows' special scheduling rule for foreground processes?

A.To reduce power consumption
B.To provide especially good performance for interactive programs βœ…
C.To give background processes more CPU time
D.To simplify the scheduling algorithm
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: The special scheduling rule for foreground processes provides especially good performance when a user is running an interactive program. By giving the foreground process a larger quantum, Windows ensures that the program the user is actively using remains responsive.

Q58. What is the priority of a thread in the REALTIME PRIORITY CLASS with NORMAL relative priority?

A.24 βœ…
B.16
C.20
D.31
πŸ’‘ Difficulty: medium | βœ… Correct: A

πŸ“– Explanation: According to the Windows priority mapping, a thread in the REALTIME PRIORITY CLASS with NORMAL relative priority has a numeric priority of 24. This is the base priority for the REALTIME PRIORITY CLASS.

Q59. What is the priority of a thread in the ABOVE NORMAL PRIORITY CLASS with HIGHEST relative priority?

A.10
B.13
C.14
D.15 βœ…
πŸ’‘ Difficulty: medium | βœ… Correct: D

πŸ“– Explanation: According to the Windows priority mapping, a thread in the ABOVE NORMAL PRIORITY CLASS with HIGHEST relative priority has a numeric priority of 15. This is the highest priority achievable in the ABOVE NORMAL PRIORITY CLASS.

Q60. What is the priority of a thread in the BELOW NORMAL PRIORITY CLASS with LOWEST relative priority?

A.2
B.3 βœ…
C.4
D.6
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: According to the Windows priority mapping, a thread in the BELOW NORMAL PRIORITY CLASS with LOWEST relative priority has a numeric priority of 3. This is one of the lower priorities in the system, used for threads that should receive minimal CPU time.

Q61. What is the priority of a thread in the IDLE PRIORITY CLASS with TIME CRITICAL relative priority?

A.1
B.15 βœ…
C.16
D.31
πŸ’‘ Difficulty: medium | βœ… Correct: B

πŸ“– Explanation: According to the Windows priority mapping, a thread in the IDLE PRIORITY CLASS with TIME CRITICAL relative priority has a numeric priority of 15. This is the highest priority achievable in the IDLE PRIORITY CLASS.

Q62. What is the main challenge with writing user-mode schedulers for UMS?

A.It requires kernel modifications
B.The details can be very challenging βœ…
C.It is not supported by Windows
D.It requires hardware support
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: The details of writing user-mode schedulers for UMS can be very challenging. UMS does not include a user-mode scheduler itself, so application developers must implement sophisticated scheduling logic, which is complex and error-prone.

Q63. What is task-based parallelism in the context of ConcRT?

A.A method of scheduling threads
B.Decomposing programs into tasks that can be scheduled on available processing cores βœ…
C.A method of memory management
D.A priority boosting technique
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: Task-based parallelism in ConcRT involves decomposing programs into tasks that can be scheduled on available processing cores. This allows programs to leverage the parallel processing capabilities of multicore processors by breaking work into smaller, independent units that can run concurrently.

Q64. What is the main purpose of the Concurrency Runtime (ConcRT)?

A.To manage memory in concurrent programs
B.To provide a user-mode scheduler and facilities for task-based parallelism βœ…
C.To boost priority of interactive threads
D.To handle I/O operations
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: The Concurrency Runtime (ConcRT) provides a user-mode scheduler together with facilities for decomposing programs into tasks, which can then be scheduled on the available processing cores. It is designed for task-based parallelism on multicore processors.

Q65. What is the numeric priority range for the variable class in Windows?

A.0 to 15
B.1 to 15 βœ…
C.16 to 31
D.0 to 31
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The variable class in Windows covers priorities from 1 to 15. This range is used for threads that can have their priorities adjusted by the system to improve responsiveness and manage CPU usage.

Q66. What is the numeric priority range for the real-time class in Windows?

A.1 to 15
B.0 to 15
C.16 to 31 βœ…
D.0 to 31
πŸ’‘ Difficulty: easy | βœ… Correct: C

πŸ“– Explanation: The real-time class in Windows covers priorities from 16 to 31. Threads in this class have fixed priorities and always run before any threads in the variable class, ensuring real-time threads get immediate CPU access.

Q67. What is the purpose of the SetThreadPriority() function?

A.To set the priority class of a process
B.To modify a thread's base priority βœ…
C.To create a new thread
D.To join a thread
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The SetThreadPriority() function is used to modify a thread's base priority. This allows individual threads within a process to have priorities different from the process's default base priority, providing fine-grained control over thread scheduling.

Q68. What is the purpose of the SetPriorityClass() function?

A.To modify a thread's base priority
B.To alter the priority class of a process βœ…
C.To create a new process
D.To terminate a process
πŸ’‘ Difficulty: easy | βœ… Correct: B

πŸ“– Explanation: The SetPriorityClass() function is used to alter the priority class of a process. This allows the entire process, and all its threads, to be assigned a different priority level, which is useful for changing the performance characteristics of an application.

Q69. What is the main benefit of using UMS for applications with large numbers of threads?

A.It provides higher priority to threads
B.It eliminates the need for kernel involvement in thread scheduling βœ…
C.It reduces memory usage
D.It simplifies thread synchronization
πŸ’‘ Difficulty: hard | βœ… Correct: B

πŸ“– Explanation: The main benefit of UMS is that it eliminates the need for kernel involvement in thread scheduling. For applications that create a large number of threads, scheduling in user mode is much more efficient than kernel-mode scheduling, as it avoids the overhead of system calls and kernel context switches.

πŸ”— Related Topics (MCQs)