Windows XP uses a preemptive priority scheduling algorithm with multiple queues to assign threads to the CPU. It distinguishes between foreground and background processes, giving higher priority to foreground processes for good interactive response. The scheduler provides real-time processing and user-perceived performance. Processes that experience keyboard I/O waits receive a larger priority boost than those with disk I/O waits. Threads are scheduled rather than processes, and each class of thread is normally restricted to a small band of 5 priority levels.