🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #11009

Re: UNIX fseek time (was Re: Comparison of Alpha, MIPS and PA-RISC-II wanted)

#11009
From: Paul Campbell
Date: Mon, 28 Dec 1992 22:07
30 lines
2086 bytes
In article <1992Dec24.151500.11047@cis.uab.edu> hyatt@cis.uab.edu (Robert Hyatt) writes:
-In article <1992Dec24.112422.12434@titan.inmos.co.uk> conor@lion.inmos.co.uk (Conor O'Neill) writes:

->But, given that 'fseek' is incredibly slow on most Unix systems,
->one could almost assume that Unix doesn't support random-access files.


-As to it being slow, I haven't noticed it being any slower than most any
-system call.... there IS a lot of work to cross the kernel boundary and
-then get back.  fseek() doens't do much work, just computes where the

Actually I thought he was being facetious ..... however fseek() may indeed 
sometimes be slow because if you have recently been writing the stdio
package may flush it's (user mode) buffers (by write()ing them) before the
actual lseek() gets done. All you are really doing here is trading off
fseek() latency for fwrite() (or putc()) latency. In fact if you are
doing lots of random writing stdio is NOT what you want to use for exactly
this reason - or at least turn off the buffering since it isn't helping
you.

The system call lseek() simply changes a pointer in a kernel data structure,
the next read/write causes that new address to be accessed. (A smart system
might force the block the lseek() points at to be asynchronously prefetched).

	Paul
-- 
Paul Campbell    UUCP: ..!mtxinu!taniwha!paul     AppleLink: CAMPBELL.P
"Finally after much thought he tied a dollar bill to the top of the tree, it
seemed to fit - after all it was the premier capitalist holiday, besides after
the 'fall' of communism a star didn't seem appropriate anymore ..."
Technical Details
Message-ID: <1366@taniwha.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!ucbvax!mtxinu!taniwha!paul
References: <fW0DHHa@quack.sac.ca.us> <1992Dec24.112422.12434@titan.inmos.co.uk> <1992Dec24.151500.11047@cis.uab.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!ucbvax!mtxinu!taniwha!paul
From: paul@taniwha.UUCP (Paul Campbell)
Newsgroups: comp.arch
Subject: Re: UNIX fseek time (was Re: Comparison of Alpha, MIPS and PA-RISC-II wanted)
Message-ID: <1366@taniwha.UUCP>
Date: 28 Dec 92 22:07:30 GMT
References: <fW0DHHa@quack.sac.ca.us> <1992Dec24.112422.12434@titan.inmos.co.uk> <1992Dec24.151500.11047@cis.uab.edu>
Organization: Taniwha Systems Design
Lines: 30