On Sun, 6 May 2001, guy keren wrote:

> > I don't think its an option I have for the current implementation - it's
> > file IO, and should be much slower, right ?
>
> well, i'm not sure that usage of locks performs any file I/O (after all,
> all the locks data is kept in memory, not on disk, as this is NOT
> persistent data). however, looking at the kernel's sources, it seems that
> at least the implementation of mandatory locks would be less efficient
> then that of semaphores. the locks on a file are kept as a linked list,
> and sometimes get traversed - thus, if you have many locks active on a
> single file, that'll be less efficient then using semaphores.
>
> as for advisory locks (handled using the flock() syscall) - there is also
> a linked list of locks kept on a file. however, if you'll only use
> exclusive locks, there could be only one lock in this list at any given
> time. and there is no file I/O during those operations.

Thanks.
I'll think about, but I don't think I'll change from semaphores just yet.
I don't like the idea of creating temp files for locks, and I can't lock
against an existing file, since I sometimes need to create several
different locks in the same application, and w/o creating files, this
mechanism would need to be way too complicated.

Oded



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to