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: | Edgar Friendly <thelema314@g...> |
| Subject: | Re: [Caml-list] Re: Problems spawning threads |
Zheng Li wrote: > 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. > My laptop does a just fine job making and using 503 native threads with 512M ram (and lots of big programs already filling that up). I don't believe that their (likely beefier) benchmarking system hits a VM limit mine doesn't. > 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. > The code should create 503 threads and 503 channels hooked together in a ring, and *then* it starts a message (a simple counter) going around the ring until it's counted high enough (normal test goes to 20,000,000 iirc), and then the last task to get the message prints its position. None of the threads finish while thread creation continues. E.