Landy Wang - Windows Memory Manager

preview
Posted by The Channel 9 Team // Wed, Dec 7, 2005 5:36 PM

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.

Show: Going Deep

Tags: ,

Video Length: 00:36:00 Replies: 40 // Views: 29,094
  Beer28
  I contend Channel9 is a covert research project
 
  Tue, Jun 28 2005 7:36 PM
I'm at 9 minutes in, and I noticed Charles dropped a question about
"are you the one that handles memory exceptions"

He asked then dropped it shortly after.

page protection is set by the kernel and enforced by the CPU.
There is a table of exception handlers for CPU raised violations /interupts (amongst other things) starting from 0x00000000, called the interupt vector table. When there is a violation, it will look up the handler pointer in the IVT and resume execution at that kernel addr handler. So the actual memory access violation isn't handled by the system code.

This started in the i386


  Charles
  Welcome Change
 
  Tue, Jun 28 2005 8:13 PM
I actually asked about exception surfacing, which is distinct from the notion of handling. As poorly stated as the question was, I was really just trying to find out what the MM does when something goes "boo!" way down there as it relates to memory. I guess it makes sense that such a low level system wouldn't package up a Problem and send it up, but certainly, the MM is an aware system, as it relates to memory. Hey, I'm learning too!

C


  LarryOsterman
 
 
  Tue, Jun 28 2005 8:35 PM
YAY!  You got Landy!

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.



  jujitsu_sickness
 
 
  Tue, Jun 28 2005 8:45 PM
Very educational!

Good work, thank you.



  koorb
 
 
  Tue, Jun 28 2005 9:18 PM
Interesting and something tells me that Windows would be a lot more stable if everybody moved to managed code.

  Manip
  Be sure brain is in gear before engaging mouth
 
  Wed, Jun 29 2005 6:25 AM
koorb wrote:
Interesting and something tells me that Windows would be a lot more stable if everybody moved to managed code.


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?

  leighsword
  LeighSword
 
  Wed, Jun 29 2005 7:23 AM
i used to do something like this,
     HLOCAL hMem = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY, HUGE_SIZE);
...
     HeapFree(GetProcessHeap(), 0, hMem);

this way is faster than managed code MUCH, and never be wrong.


  LarryOsterman
 
 
  Wed, Jun 29 2005 9:51 AM
koorb wrote:
Interesting and something tells me that Windows would be a lot more stable if everybody moved to managed code.


And where would the managed code get it's memory?

Also, you can still leak memory in 100% managed code.


  koorb
 
 
  Wed, Jun 29 2005 10:12 AM
Manip wrote:


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?


Like the who video was about memory management. And managed code has its own garbage collector.

  DuNuNuBatman
 
 
  Wed, Jun 29 2005 12:35 PM
All this talk of food is making my hugry...

  Orbit86
  I'm a C# kind of guy
 
  Wed, Jun 29 2005 12:49 PM

"After the release of Longhorn in late 2006, Microsoft plans to release another version of Visual Studio, code-named Orcas, which will be optimized for building Longhorn applications. The code name for the follow-on release to Orcas is Hawaii.

The biggest product release of 2005 will come in November, when the company makes its Visual Studio 2005 programming tool and SQL Server 2005 database available. The releases of these products have been delayed several times." Cnet.com

this makes me sick, 2005 is not even out yet and 2006 will be out before we even see 2005 , and they just pump out software so we can spend more of our money..

http://news.com.com/Microsofts+road+map+for+Longhorn+tools/2100-1012_3-5737301.html?tag=st.rn

its sick..

int year = 2005;
int price = 400;


if (year == 2005)
year++
else
price * 5%

MS makes me sickkk

Microsoft and Adobe to square off?

http://news.com.com/Microsoft+and+Adobe+to+square+off+-+page+2/2100-1012_3-5751793-2.html?tag=st.num

this is sad if MS thinks it can compete with Adobe Photoshop,Premiere and all its QUALITY products..Macromedia and Adobe are too big giants that actually have quality products..never seen a security leak from photoshop...




  Beer28
  I contend Channel9 is a covert research project
 
  Wed, Jun 29 2005 12:48 PM
LarryOsterman wrote:
koorb wrote:
Interesting and something tells me that Windows would be a lot more stable if everybody moved to managed code.


And where would the managed code get it's memory?

Also, you can still leak memory in 100% managed code.


He probably meant that if all code is JIT'd IL like singularity, with the limited instruction set and memory fully managed by the library.

I think memory managers are ok, reference counting like perl is ok. It all depends on what you want to do. I think that if you start having to write more code from Java or .NET to do something, that's when it's time to use normal code. If it takes a page of .NET code to do something you can do with 1 line in C or C++, it's not the time to use managed code.


  Beer28
  I contend Channel9 is a covert research project
 
  Wed, Jun 29 2005 12:51 PM
was Landy there in the days it was called burgermaster?
Are there any major differences between the way windows handles memory pages and the way unix or linux handles pages?

Is there any major differences between the page file and swap?
Why not have a privilaged swap partition instead of a file?


  GRiNSER
  fenster wien [=windows vienna] - austria rocks ;-)
 
  Wed, Jun 29 2005 1:46 PM
was there longhorn running on the pc in the video?


  Orbit86
  I'm a C# kind of guy
 
  Wed, Jun 29 2005 2:02 PM
I think its LH....

he said its written in C, what program does he use?


  Charles
  Welcome Change
 
  Wed, Jun 29 2005 2:15 PM
GRiNSER wrote:
was there longhorn running on the pc in the video?


That's a good question. What OS was it, I wonder... 

  Orbit86
  I'm a C# kind of guy
 
  Wed, Jun 29 2005 2:22 PM
could be Longhorn because It was a login screen that I didnt recognize...its linux


  Beer28
  I contend Channel9 is a covert research project
 
  Wed, Jun 29 2005 2:25 PM
Orbit86 wrote:
could be Longhorn because It was a login screen that I didnt recognize...its linux


it's not linux, there's no halt, reboot, ect... bar at the bottom.
It looks like a lockout screen more than a login screen.


  supersonic
 
 
  Wed, Jun 29 2005 4:49 PM
Beer28 wrote:
Orbit86 wrote:
could be Longhorn because It was a login screen that I didnt recognize...its linux


it's not linux, there's no halt, reboot, ect... bar at the bottom.
It looks like a lockout screen more than a login screen.


looks a lot like that

http://www.winsupersite.com/images/review/lh5060_logon.jpg


  littleguru
  Kameo, I'm coming...
 
  Thu, Jun 30 2005 7:34 AM
I'm a little bid sad that they did not go a little bit deeper. Most of the talk was already known from books or the university...

  Beer28
  I contend Channel9 is a covert research project
 
  Thu, Jun 30 2005 12:20 PM
littleguru wrote:
I'm a little bid sad that they did not go a little bit deeper. Most of the talk was already known from books or the university...


I would have liked to see a graphical and code explaination of the code that calculates when pages are swapped out to disk and swaps them back.

He said that if X heap pages start to be requested, then the other ones that have sequential data on them will be put back in the RAM before they are actually requested. This is a rather simple explaination.
A detailed explaination on how it's determined when a page or set of heap pages is put on the disk would have been better.

Are stack pages swapped at all or is it just heap pages, what about bss and data where the data is static in memory for the duration of the program?

Are there there specific loaded segments of your executable file that are more likely to be paged than others?

I can't help but notice that even though swap is enabled on linux, it's hardly ever used because I have alot of ram. It's not turned off. But linux will not use the disk swap partition space unless it's necessary. I can have 1 gig of ram on windows and have notepad open and it will still use the swap file if I have it enabled. It obviously doesn't need it, why is that?

Why is swap space on windows used when you have enough physical ram to handle the processes? As opposed to it not being used until it's necessary on linux?

EDIT: What about boundaries where a large pointer has data across several pages? Are those pages flagged as having parts of a single structure and swapped out at once?


  Beer28
  I contend Channel9 is a covert research project
 
  Thu, Jun 30 2005 12:30 PM
Does the memory manager work with the kernel scheduler?

If a process releases it's timeslice as soon as it's started because it's a service or never accesses a good portion of memory or is in a sleep wait state, is it's heap more likely to be paged out?

What about non-paged driver memory? How does the memory manager handle that? ISR's can't use paged memory, are they still handled by the memory manager on windows TM?


  Charles
  Welcome Change
 
  Thu, Jun 30 2005 2:45 PM
We'll probably try and go a tad deeper with Landy sometime in the future, addressing the Longhorn Memory Manager, specifically. I realize this wasn't as deep as the other Going Deeps, but the MM is pretty complex and requires more than 30 minutes...



  Orbit86
  I'm a C# kind of guy
 
  Thu, Jun 30 2005 3:47 PM
beer, looks like you want to see Windows code...


Page 1 of 2 [41 total records]
Channel 9 Forums » The Videos » Landy Wang - Windows Memory Manager [1] 2 »