Browse thread
Problems spawning threads
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Zheng Li <li@p...> |
| Subject: | Re: Problems spawning threads |
Hi, Edgar Friendly <thelema314@gmail.com> writes: > 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. OCaml native code compiler uses system thread which is heavy, so you shouldn't expect a large number of them running in parallel. In my box, 300+ threads will usually run out of virtual memory. n=16 works and n=17 doesn't, probably means the n=16 version finishes earlier so you haven't got chance to create enough threads to eat up your memory, while n=17 version last longer so that the limit is reached. You may try to add some printf to the thread creation function to monitor the upper bound. I don't know any workaround, in the absence of VM threads being able to compile to native code (I asked a question on the topic once in the beginner's list). Using user-land cooperative threads is probably considered as cheating here. -- Zheng Li http://www.pps.jussieu.fr/~li