From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id D7E79BC69 for ; Tue, 18 Dec 2007 17:22:19 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.24,180,1196636400"; d="scan'208";a="6979636" Received: from estephe.inria.fr (HELO [128.93.11.95]) ([128.93.11.95]) by mail3-relais-sop.national.inria.fr with ESMTP; 18 Dec 2007 17:22:19 +0100 Message-ID: <4767F3BB.2030309@inria.fr> Date: Tue, 18 Dec 2007 17:22:19 +0100 From: Xavier Leroy User-Agent: Thunderbird 1.5.0.7 (X11/20060915) MIME-Version: 1.0 To: Edgar Friendly Cc: caml-list Subject: Re: [Caml-list] Problems spawning threads References: <4767582A.6020202@gmail.com> In-Reply-To: <4767582A.6020202@gmail.com> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ccopts:01 ulimit:01 unreasonable:01 ocamlc:01 2.5:98 threads:01 threads:01 stack:01 stack:01 caml-list:01 posix:01 posix:01 fyi:02 optimization:03 stacks:03 > 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 threads. FYI, my 64-bit Linux installation has no problems with size = 10000... - Xavier Leroy