From owner-svn-src-user@FreeBSD.ORG Fri Nov 12 13:19:43 2010 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AA845106566C; Fri, 12 Nov 2010 13:19:43 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 42B868FC13; Fri, 12 Nov 2010 13:19:43 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 4C91B35A874; Fri, 12 Nov 2010 14:19:42 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id 376261732E; Fri, 12 Nov 2010 14:19:42 +0100 (CET) Date: Fri, 12 Nov 2010 14:19:42 +0100 From: Jilles Tjoelker To: David Xu Message-ID: <20101112131941.GA57806@stack.nl> References: <201011100127.oAA1Rmrh069656@svn.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201011100127.oAA1Rmrh069656@svn.freebsd.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: Re: svn commit: r215071 - in user/davidxu/libthr: include lib/libc lib/libc/gen lib/libc/stdio lib/libthr lib/libthr/thread X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Nov 2010 13:19:43 -0000 On Wed, Nov 10, 2010 at 01:27:48AM +0000, David Xu wrote: > Author: davidxu > Date: Wed Nov 10 01:27:48 2010 > New Revision: 215071 > URL: http://svn.freebsd.org/changeset/base/215071 > Log: > Convert pthread_mutex_t and pthread_cond_t to structure based instead of > pointer type, this allows us to support process-shared. Very nice. Apart from supporting process-shared, this also helps avoid the "array of synchronization objects" anti-pattern (false sharing). It is not so bad for the old struct pthread_mutex which is 64 bytes on i386, but in other cases one cache line may contain parts of multiple unrelated synchronization objects. In this regard, it would be better for stdio to allocate struct { FILE file; pthread_mutex_t lock; } rather than separate FILEs and locks. Like the sem_t change, this changes the ABI in a way symver can only partially deal with (think plugins with pthread_mutex_t in struct in public header file). However, I think the change should be made regardless. -- Jilles Tjoelker