From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23463 invoked by alias); 17 Mar 2007 11:36:43 -0000 Received: (qmail 23430 invoked by uid 48); 17 Mar 2007 11:36:31 -0000 Date: Sat, 17 Mar 2007 11:36:00 -0000 From: "bart dot vanassche at gmail dot com" To: glibc-bugs@sources.redhat.com Message-ID: <20070317113630.4209.bart.vanassche@gmail.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug nptl/4209] New: Performance issue: NPTL semaphores work slower than linuxthreads semaphores X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00055.txt.bz2 Some applications use semaphores for ensuring mutual exclusion, the purpose mutexes are best suited for. By comparing the performance of such an application with linuxthreads versus NPTL I discovered that under NPTL semaphores work slower than under linuxthreads. This behavior occurs at least on ppc32 and i386. The measurements I performed show that mutexes are about 30% faster under NPTL than under linuxthreads, and that semaphores are about 70% slower: $ uname -a Linux pc-100 2.6.18.6 #8 Sun Feb 4 11:17:43 CET 2007 i686 athlon i386 GNU/Linux $ /lib/libc.so.6 GNU C Library stable release version 2.5 (20061011), by Roland McGrath et al. Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Configured for i686-suse-linux. Compiled by GNU CC version 4.1.2 20061115 (prerelease) (SUSE Linux). Compiled on a Linux 2.6.18 system on 2006-11-26. Available extensions: crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson GNU libio by Per Bothner NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk NoVersion patch for broken glibc 2.0 binaries Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B Thread-local storage support included. For bug reporting instructions, please see: . $ /home/bart/glibc236/lib/libc.so.6 GNU C Library stable release version 2.3.6, by Roland McGrath et al. Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Compiled by GNU CC version 4.1.2 20061115 (prerelease) (SUSE Linux). Compiled on a Linux >>2.6.18.6<< system on 2007-03-17. Available extensions: GNU libio by Per Bothner crypt add-on version 2.1 by Michael Glad and others linuxthreads-0.10 by Xavier Leroy BIND-8.2.3-T5B libthread_db work sponsored by Alpha Processor Inc NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Thread-local storage support included. For bug reporting instructions, please see: . $ ./perf NPTL mutex Elapsed: 408611 us; per iteration: 40 ns. semaphore Elapsed: 1901436 us; per iteration: 190 ns. $ LD_LIBRARY_PATH=/home/bart/glibc236/lib: /home/bart/glibc236/lib/ld-linux.so.2 ./glibc236-perf linuxthreads mutex Elapsed: 538978 us; per iteration: 53 ns. semaphore Elapsed: 1097891 us; per iteration: 109 ns. -- Summary: Performance issue: NPTL semaphores work slower than linuxthreads semaphores Product: glibc Version: 2.4 Status: NEW Severity: normal Priority: P2 Component: nptl AssignedTo: drepper at redhat dot com ReportedBy: bart dot vanassche at gmail dot com CC: glibc-bugs at sources dot redhat dot com GCC build triplet: i686-suse-linux-gnu GCC host triplet: i686-suse-linux-gnu GCC target triplet: i686-suse-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=4209 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.