Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Feb 2005 10:12:43 +0200
From:      Andriy Tkachuk <andrit@ukr.net>
To:        freebsd-threads@freebsd.org
Subject:   Re: pthreads & dynamic memory in fbsd vs. the same in linux
Message-ID:  <200502111012.44034.andrit@ukr.net>
In-Reply-To: <420BB1FF.11156.68F6CEC@localhost>
References:  <346a8022050210054670390298@mail.gmail.com> <420BB1FF.11156.68F6CEC@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
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


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502111012.44034.andrit>