Re: light weight user level semaphores

From: George Talbot (gtalbot@lucent.com)
Date: Thu Apr 19 2001 - 08:59:13 EST


On Tue, 17 Apr 2001 12:48:48 -0700 (PDT) Linus Torvalds wrote:

[deletia]

> /*
> * a fast semaphore is a 128-byte opaque thing,
> * aligned on a 128-byte boundary. This is partly
> * to minimize false sharing in the L1 (we assume
> * that 128-byte cache-lines are going to be fairly
> * common), but also to allow the kernel to hide
> * data there
> */
> struct fast_semaphore {
> unsigned int opaque[32];
> } __attribute__((aligned, 64));
>
> struct fast_semaphore *FS_create(char *ID);
> int FS_down(struct fast_semaphore *, unsigned long timeout);
> void FS_up(struct fast_semaphore *);

[deletia]

These are counting semaphores, right? If so, would this make sense?

        struct fast_semaphore *FS_create(char *ID, int initial_count);

        [FS_down/FS_up the same]

        int FS_get_count(struct fast_semaphore *);

The FS_get_count() is less useful, but being able to pass the initial
count to the semaphore is pretty important.

--George


-
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/



This archive was generated by hypermail 2b29 : Mon Apr 23 2001 - 21:00:31 EST