II. Notes on Data Structuring * - Cornell University
II. Notes on Data Structuring * - Cornell University
II. Notes on Data Structuring * - Cornell University
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
NOTES ON DATA STRUCTURING 141<br />
indicated, since backing store transfers can be very inefficient if the unit of<br />
transfer is too small. The <strong>on</strong>ly (dubious) disadvantage of blocking is that<br />
it inhibits effective sharing of the tails of stacks.<br />
The <strong>on</strong>ly remaining problem is to choose a size of block suitable for all<br />
purposes. It must obviously be large enough to accommodate the largest<br />
item of any sequence. In fact, it should be large enough to accommodate at<br />
least ten typical items; otherwise the space left over at the end of a block<br />
which is not large enough to accommodate the next item may reach signifi-<br />
cant proporti<strong>on</strong>s. Also, if the sequence is to be held partially or wholly <strong>on</strong><br />
backing store, the block should be l<strong>on</strong>g enough to ensure that not too much<br />
space is wasted <strong>on</strong> interblock gaps, and the frequency of transfers is low<br />
enough to ensure that not too much time is spent in start-stop, latency, or<br />
head movement delays.<br />
On the other hand, if the block size is too large, the space wasted at the<br />
beginning of the first block and/or the end of the last block will become<br />
significant; thus the block size should be small enough to ensure that the<br />
typical sequence occupies at least ten blocks.<br />
In the presence of so many c<strong>on</strong>flicting c<strong>on</strong>siderati<strong>on</strong>s, it is not easy to<br />
select a standard block size for sequences of differing length and item size,<br />
and all forms of backing store, with different methods of access. However,<br />
an acceptable compromise can often be made, and <strong>on</strong> present-day computer<br />
designs, a block size of between 128 and 1024 words will often be a suitable<br />
choice. Probably in most cases the size chosen is not critical within a factor<br />
of two either way.<br />
8.2.4. Backing Store Representati<strong>on</strong><br />
In processing a sequence, a program normally requires access to <strong>on</strong>e of its<br />
ends, and all the material in the middle and other end is unused for relatively<br />
l<strong>on</strong>g periods of time. If main storage is at all scarce, it is very profitable to<br />
transfer this material to backing store, so that the space it occupies in main<br />
store may be used for other purposes. In the case of input and output<br />
sequences, which have a lifetime greater than the program which reads or<br />
writes them, the use of backing store for l<strong>on</strong>g-term storage is almost<br />
obligatory.<br />
When using backing store, efficiency of processing and representati<strong>on</strong><br />
demands that transfers should occur in blocks of reas<strong>on</strong>able size. The block<br />
which c<strong>on</strong>tains an active end of a sequence is always held in main store; and<br />
to permit overlap of input/output with computing, the previous block (<strong>on</strong><br />
writing) or the next block (<strong>on</strong> reading) also remains allocated during the<br />
transfer operati<strong>on</strong>. 'This is known as double-buffering. It is possible to hold<br />
even more buffers in store to smooth out variati<strong>on</strong>s in the speed of processing<br />
and the speed of transfer; but the program designer must not fall into the