On Wed, 23 Jan 2002, guy keren wrote:
>
> On Wed, 23 Jan 2002, Shlomi Fish wrote:
>
> > No, I do want that. If thread A1 has access to the resource, then thread
> > B2 cannot access it either, if he wishes. However, thread A2, assuming it
> > does not need access to this resource at the moment will continue to run
> > as usual.
>
> then, assuming your threads are _kernel_ threads, calling 'flock' from
> one thread would NOT block the other threads inthe same process. thus, i
> don't see why the flock() solution did not work for you. perhaps you used
> a single lock to handle _all_ your resources?
>
Actually, I checked it and now it is working. The problem I encountered
was that several readers seem to starve the writers. Especially the second
writer out of two.
Should I port my FCFS RWLock to the Linux kernel?
Regards,
Shlomi Fish
> please clear this up again and more.
>
I hope I did. It seems flock() is thread-enabled, so one may choose to use
it. But like I said, there seems to be a starvation problem. I suppose one
can write a more elaborate lock by putting the arbitration in a dedicated
process, and letting it inform the other processes and threads of the time
their priviliges were granted by some IPC mechanism.
Regards,
Shlomi Fish
> --
> guy
>
> "For world domination - press 1,
> or dial 0, and please hold, for the creator." -- nob o. dy
>
----------------------------------------------------------------------
Shlomi Fish [EMAIL PROTECTED]
Home Page: http://t2.technion.ac.il/~shlomif/
Home E-mail: [EMAIL PROTECTED]
"Let's suppose you have a table with 2^n cups..."
"Wait a second - is n a natural number?"
=================================================================
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]