Landy Wang - Windows Memory Manager
- Posted: Sep 29, 2010 at 11:24 AM
- 108,399 Views
- 33 Comments
Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
Right click “Save as…”
Charles Torre (interviewer) and Michael Lehman (cameraman) continue the "Going Deep: Windows" series with a discussion with Landy Wang, a developer of the oh so important Windows Memory Manager.
Sorry for the low audio volume.
EDIT November 2, 2008: There is no streaming video for this interview. We will look into it. For now, please clickhere.
Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums,
or
Contact Us and let us know.
Follow the Discussion
Oops, something didn't work.
What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in. You need to be signed in to Channel 9 to use this feature.What does this mean?
Following an item on Channel 9 allows you to watch for new content and comments that you are interested in and view them all on your notifications page.sign up for email notifications?
C
Landy is one of the two or three Microsoft developers I've interacted with who NEVER gets things wrong.
Which is a remarkable statement if you think about it. Most people I work with are falible.
IME, Landy isn't.
Good work, thank you.
Three things wrong with that
1. What does it have to do with this topic?
2. Is Windows unstable?
3. If your cheap hardware is making Windows unstable how would managed code help that?
And where would the managed code get it's memory?
Also, you can still leak memory in 100% managed code.
Like the who video was about memory management. And managed code has its own garbage collector.
That's a good question. What OS was it, I wonder...
looks a lot like that
http://www.winsupersite.com/images/review/lh5060_logon.jpg
C
yes it looks exactly like this. [although the picture is offline now, but i saw it when it was there] - i was asking my question because i remembered this picture
Yes, lots. I guess, since this is a Going Deep video, that it is time for the obligatory Windows Internals link.
NTFS stores everything in files, even the MFT. That way it can move sections of them around if there are corrupt sectors. It also means they can be dynamically resized as and when is necessary.
Again the Window Internals book goes into a lot of detail about this.
We don't need to see any code. There is much scalability between talking about a pagefile that is used to extend memory and the real code.
As beer said he should have talked a little more about the algorithms and how they work.
If you attend a lecture on OS at the university they tell you more then was mentioned in the video. And they simply talk about concepts and not about the actual code.
There is a difference between paging and swapping. You can't use the two terms interchangeably.
Pagefile accesses are largely limited by seek times. This is precisely why Windows tries to put the pagefile in the middle of your partition.
Remember, pagefile access is happening in parallel with other file activity. The futher the disk heads have to move, the slower your system will run.
If you put your pagefile on a dedicated partition (or use a swap partition like Linux does), then the disk heads have to go out of their way on each pagefile read/write.
The optimal place for a pagefile is in the middle of the most heavily used parition of the hard drive.
There is no such thing as "swap space" in Windows (NT anyway). Swapping and paging are not the same. Don't confuse them.
Windows "backs" pages of memory in the pagefile. I should note that it doesn't back every memory page in the pagefile. Things like EXE and DLL code are already backed in their on-disk files.
Notice that I used the word "backs". The pagefile is (loosely) mirroring the contents of RAM. This means that when an app does need to get paged to disk, it's already in the pagefile. The RAM can just be marked as free.
If this wasn't done, when an app needed to be paged out, Windows would have to write the modified pages to disk right then and there. This would increase the disk thrashing when a system gets maxed out.
Yes Windows is using the pagefile. Is it actually running programs from the pagefile? Probably not. Unfortunately, a lot of people don't understand this.
I feel that Task Manager is to blame for some of this. The way that it reports pagefile usage is misleading. If you want to get an idea for how much of your pagefile is really being used, run Perfmon.
FYI, You are incorrect when you say that Linux doesn't use the swap space with lots of physcial memory. It does something very similar to what I have described above.
Assuming you have multiple drives, the best place for the pagefile is the middle of the most-used partition on the least-used drive.
if u can see it from the direct link , go to that site
http://www.winsupersite.com/showcase/longhorn_preview_2005.asp
scroll down a bit und u will see the last thunbnailpic on the right sight
The best place is the only partition on a dedicated drive on a dedicated controller. Anything else is a compromise of some sort.
And even that's assuming all the drives are similar speeds. Which may not be the case.
I agree. And that is fully compatible with what I said. It's the most-used partition (the only one) of the least-used drive.
This is true. However, in a system with a sufficient amount of RAM, the pagefile will be hit so infrequently that this all becomes academic.
Reporting a 0 doesn't necessarily mean your swap space is completely unused.
Edit: http://sourcefrog.net/weblog/software/linux-kernel/swap.html
If not why?
Please reply back me on sonypappan@yahoo.com or sonypappan@hotmail.com
Regards,
Sony
Heap is always most likely to paged out. That's why we have working-sets to keep processes happy.
ISRs cannot use paged memory as a general rule, and a good one if you care about performance. No fun waiting for the file system to respond in at least 3 orders of magnitude delays. With that said, non-paged memory is simple: Don't use it if you don't absolutely need it. These are non-paged and thusly subtracted from your total free pool. When you unload your driver, all the allocated memory goes back to the system.
The memory manager only cares about allotting free pages and reclaiming pages that are committed, or pages from working-sets. People here are confusing paging for swapping and vice versa. Swapping is swapping a good portion of memory to disk to free memory. Paging is swapping out a "page" of memory, in i386 world that's typically 4KB.
By the kernel scheduler, you mean thread scheduler? These are two different concepts. The VMM probably implements LRU or something of that sort or use a clock algorithm. Who knows?
Haha you're fanny! Just add more memory and avoid page files altogether. There's a product like SuperCache that does Disk I/O level caching. All of course at the expense of reserving more memory for these operations. Personally I gave up page files after disk thrashing really put a burden on performance, especially when we're talking about compiling and linking 800MB worth of source codes every 15 minutes. The only reason you get "more" performance boost by putting the paging file on the second drive is that whenever you access your system the first disk is busy and the second drive is free to work. If you really think about this, to really get the benefits, at least for IDE "technology", you needed to put each device on its own separate channel. Basically one disk per ribbon. But then again, reality hits you again. We're talking about many orders of magnitudes of slowness because the disk is just so slow. You should look into borrowing memory from other systems over the network, if you're kinda cheap, since accessing them is still much faster than your local disks.
Hi there:
I´m a end user from Venezuela in the multimedia field, (using 3dmax, premiere, AfterFX, photoshop and so on), with a basic survival knowledge of windows set up. Mi system is a custom ordered Pentium D on Asus MB with 2 gig of ram, and lots of disk space. As you may know, all the applications I use are memory-cannibal, so I don´t know if I can disable the swap memory without affecting the performance of the programs. It´s there some sort of a program that "cleans" the swap memory after exiting an application without having to restart windows? I ask this because some times after a heavy use of some of this programs, the performance of the computer comes down to a crawl, which it´s noticeable in the update of the widows in the win explorer, for example.
Thanks in advance for any advice on this issue.
This is actually really crappy behavior on the part of Linux. In my experience, in real load scenarios, the behavior of swapping out entire processes only when under heavy load tends to lead to trashing. The system spends most of its time swapping out entire processes only to have to struggle to swap them back in so they can get their share of CPU time, to only then swap them back out again, etc.
Lots of systems, not just Windows, will page out unused pages ahead of time. In certain cases (like heap pages which tend to be backed by swap), this paging out is pushed to swap. So it's normal to see swap in use even though there are lots of free pages hanging around (i.e., lots of free RAM) -- on FreeBSD, or similar, this is what happens.
-B
So if the VMM is so smart, when will Internet Explorer NOT leak memory? One of the most aggravating things about IE is that it steadily expands to fill all available memory, degrading the system over time. This is true for IE7 and IE8 and is clearly observable in Task Manager. Exiting all instances of IE doesn't free it all and eventually the only solution is to reboot.
erm
"Posted: 22 hours ago" or a few years ago ?
what's up with reposting old content ? Did some of the converting process fail (old -> new site) ?
Or are you just lacking new content to upload ?
Great interview and a great personality, thanks for that! Interview would have been better with a bit of upfront preparation in terms of questions.
Remove this comment
Remove this thread
close