Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 76883 invoked from network); 13 Feb 2008 06:59:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2008 06:59:09 -0000 Received: (qmail 2082 invoked by uid 500); 13 Feb 2008 06:59:01 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 1734 invoked by uid 500); 13 Feb 2008 06:59:00 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 1725 invoked by uid 99); 13 Feb 2008 06:59:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Feb 2008 22:59:00 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aleksey.shipilev@gmail.com designates 72.14.252.153 as permitted sender) Received: from [72.14.252.153] (HELO po-out-1718.google.com) (72.14.252.153) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2008 06:58:27 +0000 Received: by po-out-1718.google.com with SMTP id b23so3664915poe.0 for ; Tue, 12 Feb 2008 22:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=A1NzGaTJc+9T3c2+kRBGfDiqDXIWx+WwEjvdywFCAOA=; b=peAmdapLShPKXz3fyZbO0WlDltfWv+sbgLRPRh9qQNjkIws9KPTRj4N7ahhFWbzRtu94MEJeRaxlk1wTRmipVpak8ZwbjrETrlenvcd00WdXMTKsDTF2UQOGNhsThrsyQdEtuCK38OX7OLHhOeeyg6ocsI8RpFSPcMK0CgRObFM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=df5P2relUR2JWdD3lQ8L/R7EkBA6fssLhYD8Wdsm54ktp51uKzD1AheFZKWPdc3lwMybTWZ5ScuFCFNC8jzCVBQQhWsELNgVh3D6vyvxavraXTNZv8zWhWItYNtIJjw8GZQF31mHb99bHGhmJFEl8IpYAuo/GywKM5VWeqJZQ0U= Received: by 10.141.141.3 with SMTP id t3mr1238571rvn.72.1202885915458; Tue, 12 Feb 2008 22:58:35 -0800 (PST) Received: by 10.140.141.1 with HTTP; Tue, 12 Feb 2008 22:58:35 -0800 (PST) Message-ID: <4bebff790802122258jb5e08b1uf3c668aeadb90849@mail.gmail.com> Date: Wed, 13 Feb 2008 09:58:35 +0300 From: "Aleksey Shipilev" To: dev@harmony.apache.org Subject: Re: [drlvm][startup][performance] Implementing futex'es In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4bebff790802121512x58533dabg9e426d440e798166@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Alexei, I've also heard that currently pthread mutexes are built on base of futexes for sake of performance. I don't know what's going on in EnterCriticalSection on Windows though. That's interesting... I'll measure the performance with some microbenchmark :) Thanks, Aleksey. On Feb 13, 2008 3:38 AM, Alexei Fedotov wrote: > Hello Aleksey, > Is not the current mutex implementation no less efficient than futex? > I've heard that mutexes try to spin before switching to kernel, and > Windows critical sections do the same trick. > > Thanks! > > > On Feb 13, 2008 2:12 AM, Aleksey Shipilev wrote: > > Hi, Alexei, all, > > > > Just another idea for startup optimizations pops out of our talk with > > Egor Pasko. :) > > > > As you probably know there are many places in VM and JIT that use > > locking for safety reasons. Most of this locking is driven by mutexes, > > that is, the kernel calls. That's a good option in case of contention, > > because such locking will need arbitration (e.g. "who will take the > > mutex next"?) from kernel side. But what if that locking is not > > contended? Even then we will make the kernel call for trying to catch > > the mutex. > > > > Linux has long ago implemented such thing as "fast user-space mutex", > > "futex" [1]. Generally it is simple memory region that could be > > incremented/decremented atomically. In case of contention futex, of > > course, will resort to kernel-side mutex. > > > > That mean we could save precious time using futexes instead of > > mutexes: we definitely will save on kernel call time. > > > > AFAIK, current implementation of porting layer has no support for > > futexes even on Linux side. And so we might try to implement them for > > Windows part and use the Linux-provided futex'es on Linux part. Then > > after the implementation of hyfutex_lock/unlock we might try to > > migrate performance-significant locks to futexes one-by-one. Profilers > > are good directions, maybe anywhere else too. > > > > What do you think? > > > > Thanks, > > Aleksey, > > ESSD, Intel > > > > [1] http://en.wikipedia.org/wiki/Futex > > > > > > -- > With best regards, > Alexei >