[comp.sys.hp] Strange HP/UX 7.0 read ahead

syd@dsinc.DSI.COM (Syd Weinstein) (03/26/91)

While running some tests today on various systems, I came
across HP/UX 7.03 (I think).  All BSD type file systems do block
read ahead, where you read block n and they pre-read blocks n+1 and n+2.

Not HP/UX, it reads n+1 and n+3, why?
-- 
=====================================================================
Sydney S. Weinstein, CDP, CCP                   Elm Coordinator
Datacomp Systems, Inc.                          Voice: (215) 947-9900
syd@DSI.COM or dsinc!syd                        FAX:   (215) 938-0235

balon@hpcupt1.cup.hp.com (Tom Balon) (03/28/91)

> While running some tests today on various systems, I came
> across HP/UX 7.03 (I think).  All BSD type file systems do block
> read ahead, where you read block n and they pre-read blocks n+1 and n+2.
> 
> Not HP/UX, it reads n+1 and n+3, why?


	When a user opens a file and begins to read sequentially, the file 
	system will read block n then n+2. Here's how it works.

	File system 
	-----------
	 Request block N from disk
	 Request block N+2 from disk ( asynchronously )
	 Process waits for N (blocked)

	 Request N+1 from disk
	 Request N+3 from disk ( async )
	 Wait for N+1 (block)

	 Get N+2 ( This block is now in the buffer cache  ! )
	 Request N+4 ( async )

	 Get N+3 ( This block is now in the buffer cache  ! )
	 Request N+5 ( async )

	As you can see the next block will be in the buffer cache and we
	post a read for the N+2 at this time since a request for N+1 was
	posted asynchronously on the last iteration.  If you were to look 
	at the driver queue for this pattern of requests you would see 
	something like this:

	Queue
	head -> (N), (N+2), (N+1), (N+3), (N+4), (N+5), ......

	Hope this helps.
						Regards,
						   Tom