Question: My question is not confined to an existing systerm.What must be done when allocating memory? I have heared a memory manager [lmm(list-based memory manager)](http://www.cs.utah.edu/flux/oskit/html/oskit-wwwch25.html), and could't find any system calls.

Answer: 
Unless the memory requirements of an application or a driver are known beforehand (before their execution starts), that driver or application should normally request memory from the OS/kernel in one way or another.

System calls are one such way of making memory allocation requests. Often system call invocation is done by means of a dedicated CPU instruction (e.g. `int`, `syscall`, `sysenter` on the x86 CPU).

But there may be additional ways to call into the OS/kernel to request memory, either other instructions or events that the application/driver can initiate that will make the CPU preempt execution of the app/driver and transfer control into the OS/kernel. Page faults, which occur when there's an attempt to access a memory location that is either protected or isn't backed up by physical memory, can be another. For example, an application may have its own virtual address space and whenever it tries to read or write from/to a memory that doesn't have physical memory allocated to it, the CPU switches execution from the app to the kernel, which allocates memory, and then the CPU switches back. That's another way that doesn't necessarily involve any system calls.

Of course, if there's no OS or it lacks memory management services and there's only one application running at any given time and it has access to all computer resources (this is more or less what you had in `DOS`), it may manage memory itself, in which case no system calls are necessary.

As for the rest of `what must be done when allocating memory`, it depends on the OS (if any) and the CPU. It may be necessary to map physical pages of memory into the virtual address space, for example. And generally, the entire address space needs to be somehow sliced into allocated memory blocks. The memory manager must keep track of allocated and free regions of the address space. Memory protection (if supported by the CPU and OS) will need to be taken care of too. All the usual stuff.
On a system where a kernel manages physical memory, either the process has to ask the kernel for more memory (i.e. make a system call) or the kernel has to automatically allocate pages the process wants when the process dereferences a pointer that points outside its existing text and data segments. This applies to lmm or any other memory allocator running in user space. If you look at the example code on the lmm page you linked to, you'll see a call to **sbrk** (a Unix system call) to obtain a block of memory which is then handed to **lmm\_add\_free**.

On a system where a process has full and direct access to physical memory, then the process can do as it likes. No kernel means no system calls.