*BSD News Article 48775


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!vtc.tacom.army.mil!ulowell.uml.edu!europa.chnt.gtegsc.com!howland.reston.ans.net!news.sprintlink.net!news.primenet.com!jdw
From: jdw@primenet.com (Jeff Wheelhouse)
Newsgroups: comp.unix.programmer,comp.unix.bsd.bsdi.misc
Subject: open() regular file nonblocking
Date: 19 Aug 1995 08:15:58 GMT
Organization: Primenet (602)395-1010
Lines: 19
Message-ID: <4146ju$fup@nnrp3.primenet.com>
NNTP-Posting-Host: usr1.primenet.com
X-Newsreader: TIN [version 1.2 PL2]
Xref: euryale.cc.adfa.oz.au comp.unix.programmer:27666 comp.unix.bsd.bsdi.misc:571

I have a very, very busy disk (sectors per second 500+ continuously).  I
also have a program that runs on this disk and opens (for reading only) 
and closes a lot of existing files (say, 20 per second).  Unfortunately,
because of the drive activity, the open() call blocks for up to half
a second on each file, turning my 20-per-second into 2-per-second.  Is
there any way I can issue an open() and have it return _right_ _away_,
regardless of anything, so I can process other things and get back to this
file once its available?  The system is BSDI.  O_NONBLOCK is apparently 
not the correct answer; it seems to only handle "special" blocking 
conditions, not something as mundane as the drive having 30 other requests
to service first.

If there isn't any way to background open, is there any way I can issue 
some other background (or nonblocking) operation say a second or so
beforehand, so by the time I get to the open(), it will be in cache?

Thanks,
Jeff