Version française
Home     About     Download     Resources     Contact us    
Browse thread
[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: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] native threads not parallel?
> I am having problems using native threads (under Solaris; don't know
> about other architectures): I can't get them to run in parallel on a
> dual-processor machine even though I turn off the master lock on the
> C-side around an external function that should execute in parallel.

The default thread library under Solaris is odd in the sense that, by
default, it doesn't take advantage of more than one processor.  (More
specifically, it creates only one "ligthweight process", i.e. kernel
thread, unless more are required for I/O purposes.)  Try to put the
following incantation somewhere in your code:

#include <thread.h>
#include <unistd.h>

   thr_setconcurrency(sysconf(_SC_NPROCESSORS_ONLN));

If that doesn't help, you might still want to look at how many LWPs
(not user threads) are active in your program, using whatever tools
Solaris provides for this purpose.  

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr