Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will a task be completed faster if it is the active window?

I have heard a myth that a job will finish faster if it is kept as the active window, and not in the background or minimized.

Is there any truth to this? Does the CPU put precedence to tasks where this happens?

Thanks,

like image 363
barfoon Avatar asked Jul 20 '09 14:07

barfoon


3 Answers

On Windows the foreground application gets a priority boost. This is to help it maintain responsiveness to the user and makes sure that when it's ready to run after waiting for some I/O event, it'll get to run next, ahead of most other applications that might be waiting to run.

There is also a potential for a longer quantum for foreground applications.

I don't know how much faster an application would complete if it's run in the foreground instead of the background - there are so many factors that would go into this (particularly I/O). The intent is to make the application more responsive.

This is all configurable to some extent (maybe only on server SKUs):

  • http://support.microsoft.com/kb/259025
like image 91
Michael Burr Avatar answered Oct 06 '22 00:10

Michael Burr


It depends on your setup. On a default Windows desktop operating system, this is true. On a Windows server operating system (like Windows 2003) this is not true.

You can change the setting by going into System Properties and clicking on the Performance tab. The exact layout differs depending on Windows version, but you should see (or be able to see by clicking an Advanced sub tab or finding "Scheduler") either a radio/combo choice between "Workstation" and "Server" configuration, or a choice between prioritizing Programs or Background Services. In both cases these are the same thing (just different language - the Server/Workstation language is from Windows 2000, while Programs/Services was created for the more consumer oriented XP) - they determine if the scheduler gives extra importance to the thread of the top most window, or if all threads are treated equally (based on the thread prioritity property).

like image 43
David Avatar answered Oct 05 '22 23:10

David


Windows allows you to give the "foreground" task a priority advantage, so it may be no myth. You can also set it the other way, to give "service" tasks the priority advantage instead, so it depends on the install.

Note that this only affects the priority... if there are no other tasks running, it won't run noticeably different in either case. It's only when there is another application that needs CPU time that you might notice the difference.

like image 42
Chris Arguin Avatar answered Oct 05 '22 23:10

Chris Arguin