From: doligez@pa.dec.com
To: "Sussillo, David" <sussillo@ftintl.com>
Cc: "'caml-list@inria.fr'" <caml-list@inria.fr>
Subject: Re: memory management, allocation and collection in kernel mode.
Date: Sat, 13 Feb 1999 22:14:13 -0800 [thread overview]
Message-ID: <199902140614.AA17615@six.pa.dec.com> (raw)
In-Reply-To: Message of Wed, 10 Feb 99 11:51:00 PST from "Sussillo, David" <sussillo@ftintl.com> <36C1E9EF@smtp.ftintl.com>
>From: "Sussillo, David" <sussillo@ftintl.com>
>Does anybody have an idea what would need to change in the OCaml memory
>management system in order for an OCaml program to function properly in
>kernel mode?
My first answer would be nothing at all if the kernel has a malloc
function.
>1. Will someone point out to me where I might look in the compiler
>source for all of the memory management routines, allocataion and GC? I
>guess it's important to see how the compiler reasons about the memory
>requirements of OCaml structures, as well as the emitted code (or
>libraries?) that it using during runtime.
I guess you should start with the byte-code interpreter, and when
that's working, you can tackle the native code stuff. The files to
look for are all in byterun:
alloc.[ch]
compact.[ch]
freelist.[ch]
gc.h
gc_ctrl.[ch]
major_gc.[ch]
minor_gc.[ch]
mlvalues.h
roots.[ch]
stacks.[ch]
weak.[ch]
>2. If anyone has any insight into the memory management ramifications of
>running an OCaml program in kernel mode, might they elucidate? As I'm
>just starting out, I'm interested in both general and specific remarks.
The memory management should be easy if you have malloc. For the
native code system, you might have to do something for the stack.
Stefan Monnier made a very good remark:
>3 - le kernel n'est souvent pas priemptible (?), donc il faudra faire attention
> ` appeler explicitement le yield() de temps ` autre pour ne pas perdre trop
> d'interruptions et ne pas rendre la machine unresponsive. O'Caml utilise
> dij` un GC incrimental si je ne me trompe, donc c'est peut-jtre pas trop
> difficile (famous last words).
Translation: since kernel code is never preempted, you'll have to call
yield() from time to time.
Fortunately, that is exactly what the Macintosh version does for
cooperative multi-tasking. Look for "#if macintosh" in interp.c and
replace the call to rotatecursor_action() with yield(). That should
be enough. For native code, I don't have an easy answer.
-- Damien
prev parent reply other threads:[~1999-02-14 18:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-10 19:51 Sussillo, David
1999-02-10 23:47 ` Stefan Monnier
1999-02-11 3:52 ` Mark Hayden
1999-02-14 6:14 ` doligez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199902140614.AA17615@six.pa.dec.com \
--to=doligez@pa.dec.com \
--cc=caml-list@inria.fr \
--cc=sussillo@ftintl.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox