Thursday, June 08, 2006

Buffer Management API

The buffer management API, or the buffer management system, is an API that allows computer programs to interact with the operating system to transfer data from the hard disk to RAM and vice versa.

Hard Disk

Notes and clips about the workings of a hard disk drive.

Hard disk platter
  • A spindle mounts several platters
  • Made of aluminum or glass substrate
  • A typical bit on a hard disk platter (in 2006) is about 200-250 nanometers wide (in the radial direction of the platter) and extends about 25-30 nanometers in the down-track direction (the circumferential direction on the platter), corresponding to about 100 billion bits (Gigabits) per square inch of disk area.

What is a hard drive head crash?

When the disk read-and-write head hits the disk surface (rotating platter), a head crash (catastrophic) can result. (

Typically, tiny particles of dirt pave the way for crash as dirt can make the head "bounce" against the disk which can in turn destroy the thin magnetic coating on the disk (WP).

The photo above (courtesty Wikipedia and Decrepit old fool) shows a crashed hard drive

What is the spinning rate of the modern hard drives?

Most commonly hard drives spin at the rates of 5,000 to 15,000 revolutions per minute (or rpm). A CD in a 52x CD ROM drive can be rotated at 10,350 rpm (WP). A drive spinning at 7,200 RPM is travelling at 74 mph. Once a hard drive crashes, chances increase that the drive will crash again due to the particles scraped by the first crash.
How does a typical hard drive work? (WP)
  • Hard disk platters spin on a spindle at a constant RPM.
  • Read-write heads move along and between the platters on a common arm.
  • There is one head for each platter and each platter has a number of tracks striped on it which allow the hard disk drive to move the arm to.
  • The arm moves the heads across the platters as they spin which allows each head to access pretty much the entire surface of the area.
  • Data on a hard disk is arranged in blocks.
What is an air bearing?
Just nanometers above the hard disk surface is a cushion of air on which the read-write heads of the hard disk fly. This cushion of air is known as an air bearing.

What steps need to be taken before a block of data can be accessed on a hard disk?
  1. the hard disk head needs to be moved to the desired track on the disk platter
  2. then the spindle rotates the sector to be read
  3. then the data is transferred from the beginning to the end of the sector
Number 1 and 2 take the most time in data access operations.

What is seeking?
Seeking is the process of reading from and writing to a hard disk drive. The time taken by the arm waiting for the spindle to rotate to the desired sector and the needed track on the hard disk platter is called the seeking speed.

What is a scan?
Scan is the process of reading a contiguous section of data from the hard disk drive. A Scan operation is much faster than seeks which requires access to various locations on the hard disk.

What is the difference between seek time and wait time?
Seek time is the time required to move the disk head to the needed track whereas wait time is used to refer to the time taken by the spindle to spin to the sector start. When we execute the OPTIMIZE TABLE command, MySQL creates contiguous blocks on hard disk to allow for scan operations (much faster than seek operations) using a process known as defragmenting.