home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / arch / 11981 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.0 KB

  1. Path: sparky!uunet!spool.mu.edu!agate!ucbvax!mtxinu!taniwha!paul
  2. From: paul@taniwha.UUCP (Paul Campbell)
  3. Newsgroups: comp.arch
  4. Subject: Re: UNIX fseek time (was Re: Comparison of Alpha, MIPS and PA-RISC-II wanted)
  5. Message-ID: <1366@taniwha.UUCP>
  6. Date: 28 Dec 92 22:07:30 GMT
  7. References: <fW0DHHa@quack.sac.ca.us> <1992Dec24.112422.12434@titan.inmos.co.uk> <1992Dec24.151500.11047@cis.uab.edu>
  8. Organization: Taniwha Systems Design
  9. Lines: 30
  10.  
  11. In article <1992Dec24.151500.11047@cis.uab.edu> hyatt@cis.uab.edu (Robert Hyatt) writes:
  12. -In article <1992Dec24.112422.12434@titan.inmos.co.uk> conor@lion.inmos.co.uk (Conor O'Neill) writes:
  13.  
  14. ->But, given that 'fseek' is incredibly slow on most Unix systems,
  15. ->one could almost assume that Unix doesn't support random-access files.
  16.  
  17.  
  18. -As to it being slow, I haven't noticed it being any slower than most any
  19. -system call.... there IS a lot of work to cross the kernel boundary and
  20. -then get back.  fseek() doens't do much work, just computes where the
  21.  
  22. Actually I thought he was being facetious ..... however fseek() may indeed 
  23. sometimes be slow because if you have recently been writing the stdio
  24. package may flush it's (user mode) buffers (by write()ing them) before the
  25. actual lseek() gets done. All you are really doing here is trading off
  26. fseek() latency for fwrite() (or putc()) latency. In fact if you are
  27. doing lots of random writing stdio is NOT what you want to use for exactly
  28. this reason - or at least turn off the buffering since it isn't helping
  29. you.
  30.  
  31. The system call lseek() simply changes a pointer in a kernel data structure,
  32. the next read/write causes that new address to be accessed. (A smart system
  33. might force the block the lseek() points at to be asynchronously prefetched).
  34.  
  35.     Paul
  36. -- 
  37. Paul Campbell    UUCP: ..!mtxinu!taniwha!paul     AppleLink: CAMPBELL.P
  38. "Finally after much thought he tied a dollar bill to the top of the tree, it
  39. seemed to fit - after all it was the premier capitalist holiday, besides after
  40. the 'fall' of communism a star didn't seem appropriate anymore ..."
  41.