CPSC 461: Copyright © 2002 Katrin Becker 1998-2002 Last Modified May 20, 2000 01:52 PM

Blocking and Buffering

The Bridge Between The Logical and The Physical

Block: smallest amount of data that can be read from or written to secondary storage at one time. Often generalized to mean any chunk of data that can be treated as a unit (for reading, writing, organizing). We will distinguish between disk blocks (physical) and program defined blocks (logical).
 
- can't always ensure that logical and physical blocks match (often don't even want to).
- should make sure they compliment each other
- logical blocks should not be split between physical blocks
- it's often more efficient to waste a little physical space in order to achieve a better match
eg. logical blocks = 10 bytes; physical blocks = 32 bytes; so fit 3/p.b. (waste 2 bytes per physical block)
Blocking: the process of grouping several components into one block
Clustering: grouping file components according to access behaviour
Considerations affecting block size:
  1. size of available main memory
  2. space reserved for programs (and their internal data space) that use the files
  3. size of one component of the block
  4. characteristics of the external storage device used
  5.  
Buffering: Software interface that reconciles blocked components of the file with the program that accesses information as single components. A buffering interface is of one of two types: blocking routine or deblocking routine.
Blocking Routine: stores components from the program into a buffer (in main memory)
Deblocking Routine: accesses one block from the file (,places it in memory) and sends one component at a time to the program.
Sample Deblocking Process:
  1. If buffer not empty, go to step 6
  2. CPU issues input request
  3. I/O channel signals device controller for device specified in the input request
  4. device controller locates requested information and starts reading bytes from the device and sends them to the buffer in main memory.
  5. I/O channel waits until the buffer is full, then signals the CPU that I/O operation is complete, Location indicator for the buffer sent to 1.
  6. next component to which the location indicator points is sent to the program
  7. increment location indicator
  8. CPU continues execution of program
 
Logical Write: writing one component to the block-sized buffer
Physical Write: writing one block to the external file
Double Buffering: having two buffers so one can be filled while the other is being processed
Processor Bound: A process where more time is taken to process a block than is taken to read or write the block. In such a case, the entire process can only be made faster by increasing the efficiency of the processing part.
Buffers

: takes instruction from O/S, but once it starts it runs independently; it'll tell someone when it's done

disk controller : I/O processor checks w/ disk controller if it's ready; then asks to position r/w heads; when ready, I/O processor passes bytes to disk or vice-versa

buffer management:


Back
CPSC 461: Copyright © 2002 Katrin Becker 1998-2002 Last Modified May 20, 2000 01:52 PM