Xiao-Feng Li said:
> People usually develop memory manager for OS kernel at multiple levels
> for a variety of purposes. It's not limited to the hardware page
> granularity. People just don't call them GC in OS kernel.

Hmmm. We are getting off topic here. Ironically I think we also have a
problem with terminology.

An OS memory manager (by my definition) is responsible for physical
memory, for allocating memory to processes, and for reclaiming that memory
afterwards. It has to deal with hardware specific issues, ensuring that
virtual memory addresses have a physical memory address to live in. As
such it is very coarse, dealing in chunks of memory at a time.

A garbage collector, or memory routines if you will, allocates arrays,
structures and objects using memory that was handed to it by the memory
manager. These are fine grained structures and no knowledge of the
physical location of the memory is required.

> OS kernel has also data structures or objects like a VM has, and can
> be managed in the same way. The problems you mentioned can exist in a
> VM if the memory management is implemented improperly.

I wasn't talking about the OS kernel. Of course the OS kernel has data
structures. But the OS kernel does not - and I am arguing that it should
not - know about the fine details of memory inside other processes. Unless
I am mistaken, most operating systems use completely different routines to
allocate in-kernel memory and process memory. The exception could be
micro-kernels, but even then I would not be surprised if this happens.

> what does the "OS-like allocation" here refer to? I think the
> main difference between OS-like allocation and VM-like allocation is,
> more frequently the OS doesn't know the semantics of the objects
> consuming the memory, while VM has object class or type information.
> But they are not entirely different.

Hopefully you now understand my distinction. Yes, they are not entirely
different and they do share common themes. But for various reasons the one
works better with chunks of memory with no semantics, while the other uses
exact segments of memory and utilises the semantics to better manage the
memory.

An analogy would be that you have a train (kernel) and a school bus
(process). The train has carriages to transport people, but it also has
carriages to carry the bus. The train allocates a carriage to a bus, not
to the people in the bus.

(Hmmm. The analogy sounded so much better when I first thought about it.)

Anyway, this has nothing to do with Harmony. I think we are talking about
the same thing, the issue is a matter of (human) semantics.

- Matthew


Reply via email to