views:

158

answers:

4

Hey everyone,

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,

+1  A: 

That's partially true on Windows. Windows would assign a GUI application that has its window on-top slightly higher priority. So if there're other tasks with normal or lower priority the program could really run a bit faster at the expense of other programs running a bit slower.

There's catch however. When you start compilation in Visual Studio IDE the IDE will spawn a separate process for the compilation and only redirect its output to its own window. Since the compilation process now has no own windows it will not gain acceleration.

sharptooth
+7  A: 

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):

Michael Burr
Also incidiently a configuration option on Symbian mobile phones
Will
+1  A: 

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.

Chris Arguin
+4  A: 

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).

David