[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-kernel
Subject: Re: [Patch] shm bug introduced with pagecache in 2.3.11
From: arjan () fenrus ! demon ! nl (Arjan van de Ven)
Date: 1999-11-20 0:51:23
[Download RAW message or body]
In article <Pine.LNX.4.10.9911191120530.1216-100000@penguin.transmeta.com> you wrote:
> Well, the more I look at a read-write semaphore, the more I like it: it
> Is anybody willing to take a stab at creating a read-write semaphore?
The book "UNIX Systems for Modern Architectures" by Curt Schimmel discusses
read-write semaphores on page 234, he also has a prototype implementation,
based on "normal" semaphores.
The book suggests a per semaphore lock for internal variables.
The struct mr_lock looks like this (pseudo C)
struct mr_lock {
semap_t m_lock; /* protects the structure mr_lock */
int m_rdcnt; /* # of active readers */
int m_wrcnt; /* # of active writers, 0 or 1 */
int m_rdwcnt; /* # of waiting reader */
int m_wrcnt; /* # of waiting writers */
waitqueue m_rdwait; /* waitqueue of waiting readers */
waitqueue m_wrwait; /* waitqueue of waiting writers */
}
Do you think an implementation based on this (and the other examples from
the book) is acceptable? Since the implementation uses already available
primitives, no assembly or other architecture-specific stuff is required.
Greetings,
Arjan van de Ven
-
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/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic