🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.arch
Article #11002

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

#11002
From: David Wright
Date: Mon, 28 Dec 1992 16:09
21 lines
1612 bytes
In article <1477@pacsoft.com> mike@pacsoft.com (Mike Stefanik) writes:
>In an article, 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.
>
>What do you mean by this?  My understanding is that nothing is physically
>being done by the call -- it simply sets the byte offset in the file table.
>Is the copying of sizeof(off_t) bytes from user space to kernel space
>what makes it "incredibly slow", in your opinion?

While it's true that there is not necessarily any I/O initiated by the
call, fseek() generally invokes the lseek() system call, so you do
have that overhead.

In addition, fseek() is generally moronic about checking whether the
new file pointer is within the current buffer.  That is to say, it
doesn't check.  So if you, say, try to read a file backwards, one byte
at a time, you'll do as many reads as there are bytes in the file.

  -- David Wright, Hitachi Computer Products (America), Inc.
     wright@hicomb.hi.com
Technical Details
Message-ID: <1hnqdeINN15a@duca.hi.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!news.hi.com!duca.hi.com!not-for-mail
References: <fW0DHHa@quack.sac.ca.us> <1992Dec24.112422.12434@titan.inmos.co.uk> <1477@pacsoft.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!noc.near.net!news.hi.com!duca.hi.com!not-for-mail
From: wright@duca.hi.com (David Wright)
Newsgroups: comp.arch
Subject: Re: UNIX fseek time (was Re: Comparison of Alpha, MIPS and PA-RISC-II wanted)
Date: 28 Dec 1992 16:09:02 -0000
Organization: Hitachi Computer Products, OSSD division
Lines: 23
Message-ID: <1hnqdeINN15a@duca.hi.com>
References: <fW0DHHa@quack.sac.ca.us> <1992Dec24.112422.12434@titan.inmos.co.uk> <1477@pacsoft.com>
NNTP-Posting-Host: duca.hi.com
Summary: it depends