Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Dec 1998 14:30:34 -0800 (PST)
From:      Marc Slemko <marcs@znep.com>
To:        Alfred Perlstein <bright@hotjobs.com>
Cc:        "Richard Seaman, Jr." <lists@tar.com>, "hackers@freebsd.org" <hackers@FreeBSD.ORG>
Subject:   Re: pread/pwrite
Message-ID:  <Pine.BSF.4.05.9812101428300.463-100000@alive.znep.com>
In-Reply-To: <Pine.BSF.4.05.9812101727250.27793-100000@bright.fx.genx.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 10 Dec 1998, Alfred Perlstein wrote:

> On Thu, 10 Dec 1998, Marc Slemko wrote:
> 
> > On Thu, 10 Dec 1998, Richard Seaman, Jr. wrote:
> > 
> > > I don't know if there is any interest in X/Open pread, pwrite 
> > > calls.  Essentially, they implement atomic seek/write and
> > > atomic seek/read calls.  They are more useful in threaded
> > > apps where you would need a file lock between a seek/write
> > > or seek/read, but even in single threaded apps can allow
> > > you to avoid a syscall.
> > > 
> > > Attached is an implementation.  If there is interest, and
> > > if the implementation meets with approval, I'll submit
> > > a PR.  Or, perhaps someone would want to commit it directly.
> > > 
> > > I welcome any comments.
> > 
> > (not necessarily addressed specifically at pread/pwrite, but it does
> > apply to it because of how it is used...)
> > 
> > Where is the locking if multiple threads are reading and/or writing
> > from or to the same descriptor at the same time?  If you have x
> > threads reading from a descriptor opened from a file on disk, do
> > x-1 of them have to wait until the first one finishes before they can
> > do anything?
> > 
> > What about with mixed reading/writing?
> 
> >From looking at the diffs what I think what he implemented was a
> seek+(write|read) in one syscall.
> 
> Meaning you do not have to lock an fd when seeking and then writing since

No, I'm talking about how the kernel handles it.  It needs to do various
amounts of locking in various areas.  When there are kernel threads that
people are writing multithreaded programs to use, this matters a lot.

Yes, pwrite and pread are good to have.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9812101428300.463-100000>