Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Konstantin Tcholokachvili <tcholoka@gmail.com>
To: Goswin von Brederlow <goswin-v-b@web.de>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Ocaml implementation and low level details
Date: Thu, 28 Jan 2010 22:16:18 +0100	[thread overview]
Message-ID: <ecafee001001281316v40587318s47d97479b39dbae@mail.gmail.com> (raw)
In-Reply-To: <878wbim12i.fsf@frosties.localdomain>

Thank for all your replies, after reading different messages, it seems
that D language fits most of my needs/taste unless I find another ML
based language suitable for kernel coding.

The thing I like about Ocaml is it's ability of type inference and
it's speed, that's why I considered it.

I guess that as JoCaml is based on Ocaml it has the same issues for
kernel coding.

Konstantin Tcholokachvili

2010/1/28, Goswin von Brederlow <goswin-v-b@web.de>:
> Richard Jones <rich@annexia.org> writes:
>
>> On Thu, Jan 28, 2010 at 01:42:15PM +0100, Konstantin Tcholokachvili wrote:
>>> I am writing an operating system kernel and I am considering the idea of
>>> rewritting it in Ocaml or make a wrapper.
>>> As I don't  know how Ocaml is implemented in detail so I have the
>>> following
>>> question:
>>> If want to code in Ocaml without using the garbage collector, will I be
>>> able
>>> to use my own multithreading implementation or will I be limited by
>>> Ocaml's
>>> global lock?
>>
>> You're probably better off not using the current runtime, but instead
>> implementing enough of the runtime based on the functions that the
>> code generator needs.  But reading the rest of the thread it sounds
>> like you really need to look deeply at the current implementation
>> first before you are in a position to make any decision (luckily the
>> runtime of OCaml is not hard to understand, and is mostly written in
>> C).  Asking if one can code in OCaml "without using the garbage
>> collector" doesn't really make any sense as a question, since at least
>> the minor heap is a fundamental concept in the language.  And the
>> "global lock" just prevents reentrancy in the current implementation
>> of the GC -- you can easily use one minor heap per thread, although
>> that is likely to just push the problem elsewhere.
>>
>> Rich.
>
> A heap per thread makes inter thread communication more difficult. On
> the other hand it allows multi core support and keeps the GC work per
> thread small. Still, you can't have interrupts that allocate memory
> while the GC runs and such. So you need at least some part that is
> outside the GC.
>
> I've played with the idea of using ocaml (or variant thereof) for a
> kernel too. My idea was to write a minimal mikrokernel in a restricted
> subset of ocaml and then allow ocaml with GC for the drivers and
> modules. Each driver/module would be a seperate process with its own
> stack and heap and use little memory. So the GC work wouldn't mean long
> interruptions even if compacting.
>
> For the core I was thinking that maybe one could cut out heap alocation
> and instead use stack allocation with some manual allocation for special
> cases for the core. That would mean a number of changes though:
>
> - use in-place algorithms (mutables) for a lot of things
> - no deep recursive datatypes as return values
> - allocate the maximum size for variant types for returns
> - allocate space for the return value on the caller stack
>
> No heap allocation means no GC required. On the other hand a stack value
> must never escape the function it is allocated in. Tracking that would
> be a huge change in the compiler.
>
> Overall I was afraid the result would be more changed things than
> remaining ocaml. So it never wnet further than some thought
> epxperiments. But maybe this gives someone some ideas.
>
> MfG
>         Goswin
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


      reply	other threads:[~2010-01-28 21:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-28 12:42 Konstantin Tcholokachvili
2010-01-28 12:55 ` [Caml-list] " Samuel Thibault
     [not found]   ` <ecafee001001280510t10cde708h7e2d258629cb0f9c@mail.gmail.com>
2010-01-28 13:12     ` Konstantin Tcholokachvili
2010-01-28 13:18     ` Samuel Thibault
2010-01-28 13:35       ` Konstantin Tcholokachvili
2010-01-28 13:45         ` Samuel Thibault
2010-01-28 17:28           ` Konstantin Tcholokachvili
2010-01-28 17:47             ` Basile STARYNKEVITCH
2010-01-28 18:39 ` Richard Jones
2010-01-28 20:22   ` Goswin von Brederlow
2010-01-28 21:16     ` Konstantin Tcholokachvili [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=ecafee001001281316v40587318s47d97479b39dbae@mail.gmail.com \
    --to=tcholoka@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=goswin-v-b@web.de \
    /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