From owner-freebsd-threads@FreeBSD.ORG Fri Feb 11 08:12:47 2005 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 01D5016A4CE for ; Fri, 11 Feb 2005 08:12:47 +0000 (GMT) Received: from mail.emict.com (brig.emict.com [212.90.172.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id E3FF143D46 for ; Fri, 11 Feb 2005 08:12:45 +0000 (GMT) (envelope-from andrit@ukr.net) Received: from [10.0.0.232] (unknown [10.0.0.232]) by mail.emict.com (Postfix) with ESMTP id 31B059F0C for ; Fri, 11 Feb 2005 10:12:44 +0200 (EET) From: Andriy Tkachuk Organization: eMICT To: freebsd-threads@freebsd.org Date: Fri, 11 Feb 2005 10:12:43 +0200 User-Agent: KMail/1.7 References: <346a8022050210054670390298@mail.gmail.com> <420BB1FF.11156.68F6CEC@localhost> In-Reply-To: <420BB1FF.11156.68F6CEC@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200502111012.44034.andrit@ukr.net> Subject: Re: pthreads & dynamic memory in fbsd vs. the same in linux X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Feb 2005 08:12:47 -0000 interesting, that if linking program with libthr, the result differs considerably: > ldd a.out a.out: libthr.so.1 => /usr/lib/libthr.so.1 (0x28075000) libstdc++.so.4 => /usr/lib/libstdc++.so.4 (0x28086000) libm.so.3 => /lib/libm.so.3 (0x28158000) libc.so.5 => /lib/libc.so.5 (0x28171000) > ./a.out n 1000 thread 0 created thread 1 created ... thread 498 created thread 499 created 0.000499 0.000449 0.000444 0.000444 0.000444 0.000444 0.000443 0.000444 0.000444 0.000444 0.000443 0.000444 0.000445 0.000442 0.000445 0.000445 0.000451 0.000437 0.000435 0.000438 0.000436 0.002959 0.003094 0.003076 0.004007 0.003067 0.002999 0.003955 0.002957 0.002969 0.003130 0.003098 0.003129 0.003124 0.003087 0.003071 0.003119 0.003086 0.003084 0.007211 0.003150 0.003248 0.003009 0.002993 0.003248 0.003002 0.002987 0.003290 0.002930 0.002928 0.003340 0.002993 0.003004 0.114286 0.003101 0.003858 0.003046 0.003011 0.133232 0.002969 0.002981 0.143072 0.002976 0.002964 0.153103 0.002977 0.002962 0.163250 0.002979 0.002989 0.174207 0.003017 ... 0.003067 4.301836 0.002976 0.002963 0.003226 0.003058 0.003044 0.003381 0.002907 0.002906 4.331964 0.002978 0.002961 4.343086 0.003066 0.003872 0.003018 0.003093 0.003385 0.002978 0.002974 4.371841 0.002991 0.002975 4.381933 0.002934 0.002934 4.391890 0.002991 0.002942 4.403000 0.003000 0.003800 0.003110 0.003055 4.421850 0.002980 i.e. there is no stickness of threads, though the time is 10 times higher compared to > ./test2-linux n 1000 ... 0.000395 0.000394 0.000395 0.020426 0.010611 0.000409 0.000394 0.000393 0.000393 0.000394 0.000392 0.000395 0.000393 0.000393 0.000394 0.000396 0.000393 0.000395 0.000396 0.000395 0.000396 0.000394 0.000394 0.000393 0.000409 0.000393 0.000393 0.000394 0.000393 0.000406 0.000395 0.000395 0.000394 0.000396 0.000394 0.000395 0.000395 0.000395 0.000395 0.000394 0.000395 0.000393 ... > ldd test2-linux test2-linux: libpthread.so.0 => /lib/libpthread.so.0 (0x28065000) libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x2807c000) libm.so.6 => /lib/libm.so.6 (0x280bf000) libc.so.6 => /lib/libc.so.6 (0x280e1000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2804c000) On Thursday 10 February 2005 21:11, you wrote: > On 10 Feb 2005 at 16:04, Andriy Tkachuk wrote: > > > > It's interesting that the same program behaves differently > > > > when it is compiled in linux and run on my fbsd machine in > > > > linux_base-7.1_7 . > > Linux uses ptmalloc2 as its memory allocator, an extremely efficient > implementation whose performance under a heavily loaded multithreaded > system is impressive. FreeBSD does not. > > You can get ptmalloc2 from > http://www.nedprod.com/programs/Win32/ptmalloc2/. It would be nice if > FreeBSD were to adopt this allocator as the system default (it has a > BSD type license). > > Cheers, > Niall