Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Native threads under Debian 3.0r0
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-04 (13:01)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] Native threads under Debian 3.0r0
On Wed, 04 Sep 2002, Jacques Garrigue wrote:
> In bytecode "something_to_do" is used, and checked pretty often:
> at every function call and every loop iteration.


> However, this would mean too much overhead for native code, so switching
> is only checked when the GC is called.

Actually, calling the GC manually does not make any difference. The only
thing that helps is calling "Thread.yield" in the infinite loop.

> To make it work even on slowly allocating programs, the young generation
> is declared "full" every once in a while, but there must still be some
> allocation for it to happen.

I see. So if the GC doesn't really have to do any work, it will also
not switch threads even when called manually.

> So the answer is: a native code thread should be allocating some data,
> otherwise it cannot be interrupted. The problem does not exist for
> bytecode.

The main consideration is obviously native code performance. OTOH, some
people might want to guarantee that their threads never get stuck. I
don't know what solution would be useful for them. Maybe some runtime
or command-line switch that trades efficiency against such scheduling

Markus Mottl

Markus Mottl                                   
Austrian Research Institute
for Artificial Intelligence        
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: