Re: semaphores and noatomic flag

Daniel Phillips (phillips@bonn-fries.net)
Tue, 5 Jun 2001 12:37:53 +0200


> -----Original Message-----
> From: linux-kernel-owner@vger.kernel.org
> [mailto:linux-kernel-owner@vger.kernel.org]On Behalf Of Mihai Moise
>
> up(semaphore 1) /* wake up client */
> down(semaphore 0) /* put iself to sleep */
>
> The problem is that the two system calls make the whole process twice
> as slow as it needs to be, and they are both needed because the semop
> system call is implemented in an atomic manner. If the semop system
> call had an IPC_NOATOMIC flag, then the each process would only have
> to do one call,
>
> semop(up semaphore 0 & down semaphore 1, IPC_NOATOMIC)
>
> which would be interpreted in the kernel as the sequence of two
> system calls I have written previously.

On Tuesday 05 June 2001 08:28, Anil Kumar wrote:
> Will it not be a very specialized case rather than being general call
> type?

The concept is general and useful, though I don't think its expression
here is correct. A similar feature used in dynix was described earlier
in some detail by Paul Cassella:

http://marc.theaimsgroup.com/?l=linux-kernel&m=97742705300697&w=2
(Re: [RFC] Semaphores used for daemon wakeup)

The idea is to atomically release one serializer and grab another. We
have quite a few flavors of lock so square that and you have the number
of primitives you'd need for a complete set.

To sell the idea you'd have to come up with a few places where the new
primitives would make the kernel run better, then you'd have to
implement it or find someone with the necessary scheduler hacking
skills to do it for you. The last part is the tricky one. ;-)

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