Does a computer use fewer resources when programs are minimized?

93

12

When programs are minimized in Windows 7, do they use less memory and CPU than leaving them maximized?

jao

Posted 2011-12-05T20:53:32.680

Reputation: 1 780

Answers

67

Yes. According to MS Support, the working set for a minimised application is trimmed. You can check this yourself with Process Explorer.

Here's a test of a single instance of Firefox 5.0 in Windows 7 x64 with a single tab of the ESPN.com website loaded. Values were read using Task Manager.

type                 not minimised  minimised     diff
------------------------------------------------------
working set               165,752k   163,768k  -1,984k
peak working set          169,624k   169,624k      N/A
mem (private working set) 121,600k   119,576k  -2,024k
commit size               135,576k   133,504k     -72k
paged pool                    396k       397k      +1k
np pool                        82k        81k      -1k
handles                        504        483      -21
threads                         34         31       -3
user objects                    40         44       +4
GDI objects                     71         75       +4

Here's a test of a single instance of Paint.NET in Windows 7 x64 with a few small images open. This app was written in Microsoft .NET unlike Firefox which is almost certainly C/C++.

type                 not minimised  minimised     diff
------------------------------------------------------
working set               125,904k   125,256k    -684k
peak working set          217,836k   217,836k      N/A
mem (private working set)  61,844k    61,844k       0k
commit size               102,388k   102,384k      -4k
paged pool                    542k       541k      -1k
np pool                        59k        59k       0k
handles                        741        741        0
threads                         19         19        0
user objects                   276        273       -3
GDI objects                    489        491       +2

kinokijuf

Posted 2011-12-05T20:53:32.680

Reputation: 7 734

7Wow, this is interesting and you have a KB to back it up. +1 – Supercereal – 2011-12-05T21:19:54.980

2This also makes the other answers just plain wrong... – Supercereal – 2011-12-05T21:21:08.397

1I hate doing that to people, but I already am... I suppose it's just the nature of the site at work. – Supercereal – 2011-12-05T21:23:40.713

57This doesn't apply to modern versions of Windows (7, Vista). On a modern OS, if the memory is needed for something, the operating system will trim the resident working sets of all processes, minimized or not (based on how recently they've accessed the memory pages). And if the memory is not needed for any reason, it would be foolish to trim it -- why gratuitously drop the performance of an application when memory is plentiful? – David Schwartz – 2011-12-05T23:12:07.770

3As @DavidSchwartz said, there is no proof that this applies to Windows Vista and above. As the KB says, it only applies to Win200 and XP. Unless you can find a similar KB for Windows 7, as this answer explicitly states, this is not the correct answer. – DMan – 2011-12-06T00:55:07.047

1-1 As this is misleading for the majority of Windows operating systems being used today. As @DMan said, it likely doesn't apply to Windows Vista or 7. Besides, just test it with the Task Manager. So far I can see no difference between minimized windows and maximized. – Phil – 2011-12-06T01:00:42.990

1I don't think it applies even to Windows XP with recent service packs. It may never have applied to Windows XP, since Windows XP has proper page recency tracking, it would make no sense for it do that. (Though it's possible Microsoft simply forgot to remove it even though it makes no sense.) – David Schwartz – 2011-12-06T01:22:42.360

1-1: Bad citation and having something that is misleading highly voted is bad for anybody viewing the question. – Jeff Ferland – 2011-12-06T02:18:48.003

2I can confirm on my Vista machine (with Process Explorer) that the working set does indeed drop. – kinokijuf – 2011-12-06T11:10:28.733

6Wow so people don't like an answer... Does anyone have any proof of the opposite? The way I see it Kinokijuf actually has some proof, you guys say it doesn't apply to windows 7 and vista but offer no source... You guys don't even test it :\ working set and allocated memory are two different things. Process explorer is the only way to test this. – Supercereal – 2011-12-06T13:46:35.417

@Jeff Attwood: The effect is even more apparent with Notepad. – kinokijuf – 2011-12-07T16:04:09.770

5It seems worth noting that the reduction in the use of system resources is trivial: in the example given, by minimizing the application, the working set is only reduced by about 1.2%. – bgvaughan – 2011-12-07T17:21:09.670

1@Kyle the linked KB article says that it doesn't apply to Windows 7 or Vista: "Applies To: Microsoft Win32 Application Programming Interface, when used with: Microsoft Windows NT 4.0 Microsoft Windows 2000 Standard Edition the operating system: Microsoft Windows XP" – Jon – 2011-12-08T06:50:00.883

I'd like to point any developers to this chunk of code I wrote over three years ago which mimics this functionality: http://stackoverflow.com/a/263459/3312 . Feel free to write an app that does that on a button click or what-not and measure the memory statistics before and after.

– Jesse Slicer – 2011-12-08T15:19:41.020

4@Jon: it doesn’t state it doesn’t apply to Vista. It was simply written before Vista. – kinokijuf – 2011-12-08T17:31:58.600

And as others have pointed out: Working set size (Mem usage in TaskMgr before Vista) is automatically trimmed as needed and not means Windows uses less memory. It just means more if it is written to the slower disk (page file). – Lars Truijens – 2011-12-08T21:04:26.237

1@kinokijuf The differences are very small and not unitlaterally in favor of minimization. I am seriously questioning if these results are statistically significant. – Peter Olson – 2011-12-09T23:47:54.650

@Peter Olson: Try it With Notepad. The results will be more significant. – kinokijuf – 2011-12-10T14:07:27.707

@LarsTruijens: I think that's the whole point of the discussion, does a minimized program are given lower priority for staying in RAM. It is not possible for an outside entity (e.g. Windows, the OS) to be able to safely reduce the memory usage of a program (except by terminating the program altogether); only the program itself can safely release memory. – Lie Ryan – 2011-12-11T03:54:39.623

5Notice the lack of Win32 devs in this comment thread. There are a number of Win32 events that skip over minimized applications. Even if there is not a noticable memory savings, there sure is a CPU usage savings. – surfasb – 2011-12-17T10:15:25.263

27

Yes and no. They will use less resources on your GPU - less need for screen refreshes - but not on your main system memory or CPU.

The working set size shown in the task manager is not the actual amount of memory consumed by an application. It is more of a ceiling of how much it could use at a given point in time.

If another app requests memory allocated to one process's working set that is not in active use this number can be driven down without changing the amount of memory the app is actually using.

Tim Brigham

Posted 2011-12-05T20:53:32.680

Reputation: 1 102

I really hate down voting answers but this is just wrong... If you asked me 10 minutes ago I would have thought you were right. – Supercereal – 2011-12-05T21:23:07.050

@Kyle, well, I believe he is right (at least after the edit). If you read the KB, it states As a result of this trimming, a process may experience significantly poorer performance because its memory pages are being faulted back into RAM. so in effect, it is using less memory but performance might suffer from it. – Lieven Keersmaekers – 2011-12-05T22:13:09.007

3@Lieven the offending line, for me at least, and why the downvote stands: "They will use less resources on your GPU - less need for screen refreshes - but not on your main system memory or CPU." The question explicitly states: "do they use less memory and CPU than leaving them maximized" which the answer is, according to MS at least (And I'll trust MS here since they did write it), yes it uses less resources. He doesn't ask anything about the preformance of the application while minimized, just if it will use less resources. – Supercereal – 2011-12-05T22:18:17.020

@Kyle - you are right about the error concerning memory but I could assume the CPU rising as a result of resolving memory faults and reading pages back into memory. – Lieven Keersmaekers – 2011-12-05T22:23:47.130

14@Kyle That KB article is 5 years old. It doesn't apply to modern memory management schemes. (And if you see my comment to kinokijuf's answer, you'll see why it was a bad idea in the first place -- except on operating systems that can't track recency of page usage.) – David Schwartz – 2011-12-05T23:21:10.827

1The footnotes state that it apples for NT4, 2000 and XP. I doubt anything has changed since then. – kinokijuf – 2011-12-06T11:02:59.493

4And I can confirm on my Vista machine (with Process Explorer) that the working set still does drop. – kinokijuf – 2011-12-06T11:04:02.957

12

"Working Set" is NOT the same as "Memory Usage"

If a program needs a chunk of memory, it will always need it. If it doesn't, then it doesn't. Minimizing the program doesn't suddenly make the program 'not require' the memory. "Trimming" the working set is simply paging out the memory from physical memory onto the disk, or simply removing the page if it is available elsewhere on the disk. (In the latter case, the OS does it anyway if there is shortage of memory, so it's just a caching issue, not a 'usage' issue.) In either case, it does not reduce what the program uses; it merely relocates the data elsewhere.

That said, regarding CPU usage: there is something called a priority boost given by the OS in certain conditions, which can indeed cause a foreground application to use more CPU. See here for details.

user541686

Posted 2011-12-05T20:53:32.680

Reputation: 21 330

4

It really depends on the application that you're talking about and the way that the application is coded; however for comparison sake lets say that the program is coded in a way that it will run the same functions when maximized and minimized.

We would therefore expect the program to use the same amount of CPU when minimized if the same underlying functions are being called by the application.

However, your system processes will certainly use less CPU when the programs are minimized as there will be less graphics to be rendered for the application viewing, probably now just a system tray icon.

That is unless upon minimizing the application you cause a more graphical application to be brought into view and therefore rendered instead, now the CPU load could increase due to the extra graphics work load.

All in all the changes we are talking about here are probably going to be negligible unless your on a very low spec machine.

iTom

Posted 2011-12-05T20:53:32.680

Reputation: 545

-1, for irrelevancies. For any comparisons you always had to assume Ceteris paribus

– Lie Ryan – 2011-12-06T22:17:52.960

2Didn't realise assuming was a bad thing when made clear and covering both possibilities. – iTom – 2011-12-07T07:50:13.230

certain assumptions are irrelevant, therefore useless, even if made clear. If the program are written in such a way that minimization would terminate the program, that would obviously make the computer uses much fewer resources; that assumption is totally useless for the discussion. – Lie Ryan – 2011-12-11T03:50:27.620

1

Rarely. For an interactive program that recognizes when it's minimized, yes it will use less CPU power. For programs like Microsoft Word, there won't be a decrease in CPU ussage.

For graphics intensive applications (ex. World of Warcraft or Call of Duty 3) there would be a significant decrease in GPU (Graphics Processing Unit) usage.

wizlog

Posted 2011-12-05T20:53:32.680

Reputation: 12 320

An interactive program doesn't have to "recognize when it's minimized" to be using less CPU due to simply not having any keyboard/mouse window messages to respond to. – Random832 – 2011-12-05T23:37:59.800

@Random832 I'm not sure what you mean entirely, however I meant to convey the type of program (like a game) that pauses when it looses focus. These games generally use less CPU power when minimized. – wizlog – 2011-12-06T00:36:06.397

1

I'd say it does use less resources because it does not update its window.

http://msdn.microsoft.com/en-us/library/dd145193(v=VS.85).aspx

surfasb

Posted 2011-12-05T20:53:32.680

Reputation: 21 453

0

While it is not available in windows 7 to the best of my knowledge, in Windows 8, programs that are minimized are suspended.

soandos

Posted 2011-12-05T20:53:32.680

Reputation: 22 744

Is that for classic programmes as well? Its necessary for metro since you cannot actually close software – Journeyman Geek – 2011-12-08T06:41:56.940

Yes, at least that is what I have seen in the beta. (example used was internet explorer, the non-metro version) – soandos – 2011-12-08T06:44:33.293

best to wait until Win8 is released rather than speculating on what may or may not carry forward from very early betas. – Jeff Atwood – 2011-12-09T00:31:33.063

Well the suspension part for the metro apps cannot go away, so I would be relatively confident in the rest of the suspension system staying in place. It is also part of current win7 system, though it is not automatic. – soandos – 2011-12-09T00:34:46.807