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
Problems spawning threads
[ 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] Problems spawning threads
> Interestingly enough, the administrator reports that the code works with
> size=16, but fails for size=17.  Any ideas what's going on or how to fix
> it?  Hopefully I'll have some confirmation soon that the (probably
> useless) ccopts and other optimization options don't affect the error.
> We also checked ulimit settings - his max user processes and stack size
> are both higher than mine. (-u 4095, -s 160000k)

Such big stacks could be the source of the problem.  Assuming the
underlying POSIX thread implementation uses the "s" limit to determine
how much virtual memory space to allocate for the stack of each thread
(not an unreasonable assumption), 16 threads would eat up 2.5 Gb of
virtual address space, dangerously close to what's typically available
on a 32-bit architecture.

For this benchmark, you want much smaller stacks.  Or better yet, run
it with "ocamlc -vmthread": for silly benchmarks like this, it will
run much faster than the ocamlopt-generated code that uses POSIX

FYI, my 64-bit Linux installation has no problems with size = 10000...

- Xavier Leroy