Minimizing the Number of Disc Accesses
Posted on 2003-03-07
I am facing a quandary of late of no easy solution, or so it would appear, and was wandering whether anybody could assist me. I wish to know how to query an operating system or some other unholy thing as to a computer's page size. To make sure we all mean the same by saying "page", I took the liberty of quoting the following from Introduction to Algorithms (heavier than the bible, twice as useful) by Thomas H. Cormen, Charles E. Leiserson and Ronald L. Rivest, page 382:
"The read/write arm can position the head at different distances from the center of the disk. When the head is stationary, the surface that passes underneath it is called a _track_. The information stored on each track is often divided into a fixed number of equal sized _pages_; for a typical disk, a page might be 2048 bits in length. The basic unit of information storage and retrieval is usually a page of information - that is, disk reads and write are usually of entire pages."
Some applications, such as B-Trees, which wish to minimize the number of disk accesses, use page sized nodes. My question actually consists of 3 sub questions:
a) How am I to query whatever blasphemous thing governs my computer as to my computer's page size? (Using C, obviously.)
b) Is there a better way of working with pages than the ubiquitous fread and fwrite?
c) Could I, perchance, have the computer allot me an entire disk track ("It's mine, all mine!") so as to minimize disk entries, or is there a way to transcend matter altogether?
d) Why are you even bothering to read my fourth sub question when I specifically told you that there were only three? I’m greatly offended.
My sincerest thanks,