From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA07402 for caml-redistribution; Thu, 11 Feb 1999 09:50:53 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA15575 for ; Thu, 11 Feb 1999 04:52:39 +0100 (MET) Received: from mail001.mediacity.com (mail001.mediacity.com [205.216.172.9]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id EAA14965 for ; Thu, 11 Feb 1999 04:52:36 +0100 (MET) Received: (qmail 13908 invoked from network); 11 Feb 1999 03:53:53 -0000 Received: from cm-208-166-50-223.cableco-op.ispchannel.com (HELO ispchannel.com) (208.166.50.223) by mail001.mediacity.com with SMTP; 11 Feb 1999 03:53:53 -0000 Sender: weis Message-ID: <36C253FE.80EE0260@ispchannel.com> Date: Thu, 11 Feb 1999 03:52:30 +0000 From: Mark Hayden X-Mailer: Mozilla 4.5 [en] (X11; U; Linux 2.2.1 i586) X-Accept-Language: en MIME-Version: 1.0 To: "Sussillo, David" CC: "'caml-list@inria.fr'" Subject: Re: memory management, allocation and collection in kernel mode. References: <36C1E9EF@smtp.ftintl.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit It is not clear to me exactly what you are asking about, however, I can tell that it is possible to run Ocaml code in the Linux kernel. I got an Ocaml program to run as a dynamically loadable kernel module without too many problems. As far as memory management is concerned, the approach I took was to intercept the calls to malloc() that Ocaml made to add new heap segments. --Mark "Sussillo, David" wrote: > > Hello, > > Est ce qu'il ya quelqun qui sait ce que j'ai besoin de changer dans le " > OCaml memory management system " pour que le "program" funcion bien dans > le "kernel" mode? > > ------------------------------ > > 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? (Linux on a PII). Linux has a physically mapped kernel > space because it doesn' make much sense for a kernel to manage it's own > virtual memory, so it just ignores the whole problem by ignoring virtual > addressing. What that means is one has to deal with a physical > addressing scheme if one wants to run in kernel/system mode. > > I've not looke at the OCaml sources at all, but I would assume that the > memory management routines are assuming that whatever process they are > running in is running in user mode. At this point I don't understand the > ramifications of this fact. > > As far as I can tell, there are a couple of alternatives: > a . The allocation and GC routines might not even think about the > difference between user mode and system mode at all since memory is > segmented and each process is running in it's own address space. However, > if one was to run these routines in the kernel, then it would be > important to 'gel' with the way memory is allocated in a kernel, at the > very least, an offset of something like 0xffff0000. > b. The allocation and GC rountines take full advantage of running > in their own address space (and segment) and put memory all over the > place. In which case, one would be hard pressed to figure out how to > make it work the memory management machinery work in kernel mode. > > So then there are a few questions: > 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. > > > 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. > > Thanks, > -dave