lkml.org 
[lkml]   [1999]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch] shm bug introduced with pagecache in 2.3.11
On Sat, 20 Nov 1999, Manfred Spraul wrote:

> I give it up:
> I've attached 2 more ideas, but one of them is a bit slow, and the other
> one requires cmpxchg (ie only 486 and above).

Interesting. Here's what I'm doing (it's subtle, but cute and efficient
-- 1 instruction and an untaken branch for both readers and writers):

count is initially set to a BIAS (I'm using 0x01000000). Readers
decrement count by 1 and see a positive value if successful. Writers
decrement by the BIAS and see a result of zero when acquired.

This makes the recovery case a bit more challenging, but easily solved
with a second value used to decide who is the next writer (and thus
responsible for maintaining the bias while waiting).

-ben


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:1.028 / U:0.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site