Messages in this thread | | | Subject | Re: [PATCH][RFC] Lightweight user-level semaphores | Date | Sun, 13 Jan 2002 15:13:30 +0000 (GMT) | From | Alan Cox <> |
| |
> Yep, that'd be fine. However, you then lose the neatness > of "lock==file descriptor", and need something other than > read/write for down/up.
If I have to have 2000 pages and 2000 file handles for 2000 locks I've kind of lost interest. read/write syscalls take offsets. I can pread/pwrite a lock in a set of locks. The only reason for using an fd I can see is so you can poll on a lock. All the other neatness issues are wrapped in the library support code anyway.
> I guess the alternative is to store them in a hash table > or tree but I don't know what that would do to the > contended case.
Read my old mail you need neither a hash table or a tree. You just need the required shadow object
offset = addr - vma->vm_start; offset /= sizeof(struct user_lock); lock = ((struct lock *)vma->vm_private_data)[offset];
Alan - 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/
| |