[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Another Semaphore question.
- To: guy keren <choo(at-nospam)actcom.co.il>
- Subject: Re: Another Semaphore question.
- From: Oded Arbel <oded(at-nospam)geek.co.il>
- Date: Sun, 6 May 2001 11:18:28 +0000 (/etc/localtime)
- Cc: "Stanislav Malyshev a.k.a Frodo" <frodo(at-nospam)sharat.co.il>, Linux-IL Mailing list <linux-il(at-nospam)cs.huji.ac.il>
- In-Reply-To: <Pine.GSU.4.30_heb2.09.0105061141370.1060-100000@actcom.co.il>
- Sender: linux-il-bounce(at-nospam)cs.huji.ac.il
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 linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il