memory management in minix 3.1.4

370 views
Skip to first unread message

snell

unread,
May 13, 2009, 9:15:03 AM5/13/09
to minix3
Hi all,

I wanted to know what all is different in 3.1.4 as compared to 3.1.2.

1) A completely new module vm has been added in the 3.1.4 version of
minix.
which implements virtual memory. Is paging also implemented???

2) what is the use of fork and exec in pm when we have already have
exec and fork in vm.

3) there is no alloc in pm .... does that mean the memory allocation
for the main memory is also done in vm.



Guanqun Lu

unread,
May 13, 2009, 11:23:56 AM5/13/09
to min...@googlegroups.com
Hi snell,

I'm reading the code in vm these days, and i'm trying to answer your questions.

Correct me if I'm wrong on something.

On Wed, May 13, 2009 at 9:15 PM, snell <snel...@gmail.com> wrote:
>
> Hi all,
>
> I wanted to know what all is different in 3.1.4 as compared to 3.1.2.
>
> 1) A completely new module vm has been added in the 3.1.4 version of
> minix.
> which implements virtual memory. Is paging also implemented???

Yes, a complete module named vm is added in 3.1.4, kudo to Ben.
Paging is implemented, so you can call it modern virtual memory support.

>
>  2) what is the use of fork and exec in pm when we have already have
> exec and fork in vm.

They do different jobs in different servers. in pm, fork() has to setup a slot
in the data structure and do some initialization, e.g. setup pid, gid.
etc. While in vm,
the job is more specific, it inherits the memory from the parent
process in a word,
technically speaking, copying the page tables. (map proc copy).

>
> 3) there is no alloc in pm .... does that mean the memory allocation
> for the main memory is also done in vm.

I think it's yes.
Let's take the brk() system call as an example, since brk() is a very
primitive memory allocation utility.
when you invoke brk() system call, it will first send a message to PM
server (server/pm/break.c:do_brk), it then send the message to VM
server(vm_brk()), then later, the VM gets the call from PM server, it
does the real job.(servers/vm/break.c:do_brk()->real_brk()).

HTH.

>
>
>
>
> >
>



--
Guanqun

snell

unread,
May 13, 2009, 2:51:45 PM5/13/09
to minix3
hey thanks,

I cannot find pagetable.h file which is included in the exec.c of vm
and where exactly is the paging implemented??


--Regards
Snell

Jens de Smit

unread,
May 14, 2009, 4:25:57 AM5/14/09
to minix3
On May 13, 8:51 pm, snell <snell1...@gmail.com> wrote:
> hey thanks,
>
> I cannot find pagetable.h file which is included in the exec.c of vm

It's in servers/vm/i386, since it's platform-specific.

> and where exactly is the paging implemented??

In the VM server. Virtual memory for processes is mapped into physical
memory on a per-page basis with help of the MMU's page tables.

Regards,

Jens

Jens de Smit

unread,
May 14, 2009, 4:28:46 AM5/14/09
to minix3
> 3) there is no alloc in pm .... does that mean the memory allocation
> for the main memory is also done in vm.

malloc() is a library call that is executed inside a process itself,
doing some local bookkeeping to mark certain memory regions as "in
use". Only when there is not enough unallocated memory on the process'
heap, malloc() will call brk() or sbrk() to increase the process' data
segment size.

Regards,

Jens
Reply all
Reply to author
Forward
0 new messages