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
Re: [Caml-list] native threads not parallel?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus@o...>
Subject: Re: [Caml-list] native threads not parallel?
On Sat, 22 Feb 2003, Jacques Garrigue wrote:
> About the problem Markus is describing, and if he is using
> Thread.create as you suggest, I may see a cause.  Seeing that the code
> for caml_thread_new in posix.c contains no enter_blocking_section, if
> you create a thread with Thread.create, it will immediately block
> trying to get the caml mutex. It will get it eventually from the main
> caml thread through a yield, but a clever scheduler will schedule this
> thread on the same processor (it starts just when the previous one
> stops). As Markus says, after a long time the scheduler may realize
> this choice was wrong and change the processor, but this is scheduler
> dependent.
> I may be utterly wrong in my inference, but if this is right, a better
> solution would be to explicitely start the thread with pthread_start
> from the C side.

Thanks, this seems to be a good explanation for the strange behaviour
of native threads under Solaris. Maybe another solution would be to
set different scheduler flags, but I haven't read up on this, since our
Solaris machines are going to be replaced by Linux ones at our place.

Markus Mottl

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