Disk structure and access time
The hard disk as GATE models it: platters, surfaces, tracks, sectors and cylinders; capacity and the size of a sector address; converting between a (cylinder, surface, sector) address and a sector number; rotation, seek and transfer time; and why a contiguous file is read hundreds of times faster than the same sectors scattered.
Why it exists
A disk is where programs, files and databases live, and it is millions of times slower than memory. Reading one byte takes the same time as reading a whole track, because almost all of the time goes into moving the arm and waiting for the platter to turn. So GATE asks two kinds of questions: bookkeeping (how big is the disk, how many bits name a sector, which sector number is the address ⟨c, h, s⟩, in which cylinder does a file end) and timing (how long does it take to read one sector, a file of sectors, a file scattered over the disk). This page gives the model, the formulas and the traps. How the operating system orders the requests is on the disk scheduling page.
Prerequisites
The disk is the bottom level of the memory hierarchy: the largest, cheapest and slowest level.
Precise definitions
Structure. A disk has one or more platters on a common spindle that turns at a fixed speed in revolutions per minute (rpm). Each platter has two surfaces (a recording surface is one side). Each surface is divided into concentric tracks, each track into sectors, the smallest unit that can be read or written. One head per surface, all mounted on one arm, moves together; the tracks that the heads are over at one arm position form a cylinder.
- tracks on one surface number of cylinders ; surfaces ; sectors per track ; bytes per sector ;
- tracks on the disk ; sectors ;
A question that gives the capacity asks for one unknown from this product (for example the number of cylinders ).
Units. In GATE questions , , bytes for sizes, but a transfer rate such as " bytes per second" is decimal as written. Convert before you divide.
Addresses. A sector is named by the triple (cylinder, surface, sector), each field counted from . Its sector number (position in the whole sequence) depends on how files are laid out. GATE uses the cylinder-wise layout: fill a track, then the next surface of the same cylinder (no arm movement), then the next cylinder:
A sector can be named by one number, needing bits, or by the three fields, needing bits. The two are equal when , and are powers of two and the second is larger otherwise; read which one the question asks for.
Time to access a sector.
- seconds per revolution.
- Seek : moving the arm to the cylinder; usually given (an average, or a track-to-track time). For uniformly random requests the average distance is about one third of the number of tracks.
- Rotational latency: waiting for the sector to arrive under the head: between and , on average half a revolution, .
- Transfer: the wanted bytes pass under the head: , with data rate . One sector takes .
- Controller overhead, when the question gives it (for example "ten times the disk transfer time"), is added.
Reading a file. Scattered sectors pay seek + rotation + transfer every time: . A contiguous file pays one seek and one rotational wait, and then streams: (plus a track switch each time it crosses to the next track).
GATE model and real hardware. GATE model: a constant on every track, sector numbers from , the formulas above. Real hardware: outer tracks are longer and hold more sectors (zoned bit recording), so depends on the track and the sector number is no longer a simple formula; the legacy CHS address counts sectors from (so ); modern drives hide the geometry behind logical block addresses and remap bad sectors. Flash storage (SSD) has no arm and no rotation, so none of the timing formulas apply to it.
How it works
The tables below are filled one row at a time. Every number is computed by a script from exact arithmetic, not typed.
Capacity and the size of an address. Four disks; the tracks, sectors and capacity follow from the product, and the two ways of naming a sector need different numbers of bits (Disk Y: 19 bits as one number, 20 as three fields).
Capacity and the number of bits of a sector address: start
Computed by a script, not typed| disk | tracks | sectors | capacity | bits for a sector number | bits for (cylinder, surface, sector) |
|---|---|---|---|---|---|
| Disk X: 2000 cylinders, 8 surfaces, 400 sectors per track, 512 bytes per sector | |||||
| Disk Y: 1000 cylinders, 10 surfaces, 50 sectors per track, 512 bytes per sector | |||||
| Disk Z: 8192 cylinders, 12 surfaces, 128 sectors per track, 4096 bytes per sector | |||||
| Disk W: 64 cylinders, 4 surfaces, 32 sectors per track, 1024 bytes per sector |
Step 0
Capacity = cylinders × surfaces × sectors per track × bytes per sector. The number of tracks on ONE surface equals the number of cylinders. Both address sizes are rounded up to whole bits.
From ⟨cylinder, surface, sector⟩ to a sector number. One cylinder of Disk Y holds sectors, so each step in the cylinder field adds 500, each step in the surface field adds 50 and each step in the sector field adds 1.
From (cylinder, surface, sector) to a sector number on Disk Y: start
Computed by a script, not typed| address ⟨c, h, s⟩ | formula | sector number |
|---|---|---|
| ⟨0, 0, 0⟩ | ||
| ⟨0, 0, 49⟩ | ||
| ⟨0, 1, 0⟩ | ||
| ⟨0, 9, 49⟩ | ||
| ⟨1, 0, 0⟩ | ||
| ⟨37, 6, 12⟩ | ||
| ⟨999, 9, 49⟩ |
Step 0
Disk Y has 1000 cylinders, 10 surfaces and 50 sectors per track; every number starts at 0 (so the last sector is ⟨999, 9, 49⟩ = 499999).
And back. Two integer divisions: by the sectors per cylinder (the quotient is the cylinder), then the rest by the sectors per track (the quotient is the surface, the rest the sector).
From a sector number back to (cylinder, surface, sector) on Disk Y: start
Computed by a script, not typed| sector number | cylinder: divide by sectors per cylinder (500) | surface and sector: divide the rest by 50 | address |
|---|---|---|---|
| 0 | |||
| 49 | |||
| 50 | |||
| 499 | |||
| 500 | |||
| 123456 | |||
| 499999 |
Step 0
Integer division with remainder, twice; the reverse of the previous table.
Rotation and access time. The faster the spindle, the shorter the revolution and the wait; the transfer of one sector is tiny next to the seek and the wait.
Rotation and access time at four spindle speeds (400 sectors of 512 bytes per track, average seek 8 ms): start
Computed by a script, not typed| spindle speed | one revolution | average rotational latency | one sector | data rate under the head | access time of one random sector |
|---|---|---|---|---|---|
| 5400 rpm | |||||
| 7200 rpm | |||||
| 10000 rpm | |||||
| 15000 rpm |
Step 0
Average latency is HALF a revolution. Data rate = bytes on a track per revolution. Millisecond values are rounded for printing; the arithmetic is exact.
Reading a file. The same 800-sector file, scattered or contiguous. Paying the seek and the wait once instead of 800 times makes the contiguous read over 300 times faster; and a layout that ignores the rotation when it changes tracks loses a whole revolution each time.
Reading a file of 800 sectors from Disk X (7200 rpm, 400 sectors per track, average seek 8 ms): start
Computed by a script, not typed| layout | time | how |
|---|---|---|
| 800 sectors, each at a random place | ||
| 800 sectors contiguous, perfect skew, free track switch | ||
| 800 sectors contiguous, perfect skew, 1 ms per track switch | ||
| 800 sectors contiguous, NO skew, 1 ms per track switch | ||
| 100 sectors contiguous inside one track |
Step 0
Contiguous layout is dramatically faster than scattered sectors: the seek and the rotational wait are paid once, not 800 times. Skew means each track's sector 0 is placed a little later than the previous track's.
Worked examples
EX 1Capacity, address bits, and a missing parameter
EasyTwo disks, and the number of cylinders of a third disk of known capacity.
#include <stdio.h>
static int bits(long n) {
int b = 0;
while ((1L << b) < n) b++;
return b;
}
int main(void) {
long geo[2][4] = {{2000, 8, 400, 512}, {1000, 10, 50, 512}}; /* cylinders, surfaces, sectors per track, bytes per sector */
for (int i = 0; i < 2; i++) {
long c = geo[i][0], h = geo[i][1], s = geo[i][2], b = geo[i][3];
long sectors = c * h * s;
printf("disk %d: %ld tracks, %ld sectors, capacity %ld bytes (%.3f MiB)\n", i + 1, c * h, sectors, sectors * b, sectors * b / 1048576.0);
printf(" sector number: %d bits; fields: %d + %d + %d = %d bits\n", bits(sectors), bits(c), bits(h), bits(s), bits(c) + bits(h) + bits(s));
}
/* a disk of 64 GiB with 16 surfaces, 2048 sectors per track of 512 bytes: how many cylinders? */
long capacity = 64L << 30, h = 16, s = 2048, b = 512;
printf("64 GiB disk: cylinders = %ld\n", capacity / (h * s * b));
return 0;
}disk 1: 16000 tracks, 6400000 sectors, capacity 3276800000 bytes (3125.000 MiB)
sector number: 23 bits; fields: 11 + 3 + 9 = 23 bits
disk 2: 10000 tracks, 500000 sectors, capacity 256000000 bytes (244.141 MiB)
sector number: 19 bits; fields: 10 + 4 + 6 = 20 bits
64 GiB disk: cylinders = 4096Reading it. Disk 1: tracks, million sectors, bytes bytes. A single sector number needs bits. Disk 2 has sectors: bits as one number, but bits as three fields, because none of , , is a power of two. For the third disk, gives .
EX 2Sector number, address, and the last sector of a file
MediumOn Disk Y (1000 cylinders, 10 surfaces, 50 sectors per track): convert in both directions, check the formula for every sector, and find where a contiguous file of 20000 KB ends if it starts at ⟨120, 7, 30⟩.
#include <stdio.h>
#define CYL 1000L
#define SURF 10L
#define SECT 50L
static long to_number(long c, long h, long s) { return (c * SURF + h) * SECT + s; }
int main(void) {
printf("<37,6,12> is sector %ld\n", to_number(37, 6, 12));
long n = 123456;
printf("sector %ld is <%ld,%ld,%ld>\n", n, n / (SURF * SECT), (n / SECT) % SURF, n % SECT);
/* every address in cylinder-major order must get the next number, and the inverse must give the address back */
long expect = 0, bad = 0;
for (long c = 0; c < CYL; c++)
for (long h = 0; h < SURF; h++)
for (long s = 0; s < SECT; s++) {
long m = to_number(c, h, s);
if (m != expect) bad++;
if (m / (SURF * SECT) != c || (m / SECT) % SURF != h || m % SECT != s) bad++;
expect++;
}
printf("checked %ld sectors, %ld mismatches\n", expect, bad);
/* a file of 20000 KB (sectors of 512 bytes) stored contiguously from <120,7,30> */
long sectors = 20000L * 1024 / 512;
long first = to_number(120, 7, 30), last = first + sectors - 1;
printf("file: %ld sectors, from number %ld to %ld, last sector <%ld,%ld,%ld>\n", sectors, first, last, last / (SURF * SECT), (last / SECT) % SURF, last % SECT);
return 0;
}<37,6,12> is sector 18812
sector 123456 is <246,9,6>
checked 500000 sectors, 0 mismatches
file: 40000 sectors, from number 60380 to 100379, last sector <200,7,29>Reading it. . For : rest , then rest , so . The loop confirms the formula for all sectors. The file has sectors; the first is number and the last is , which is rest , then rest : . The question usually asks only for the cylinder, 200: the file covers cylinders and a bit.
EX 3Time to read one sector, and a whole file
MediumA 10000 rpm disk with an average seek time of 6 ms and 200 sectors of 512 bytes per track. How long does one random sector take, and how long does a file of 300 sectors take if it is scattered, or stored contiguously?
#include <stdio.h>
int main(void) {
double rpm = 10000, seek = 6.0, spt = 200; /* ms */
double rev = 60000.0 / rpm, latency = rev / 2, sector = rev / spt;
printf("revolution %.3f ms, average latency %.3f ms, one sector %.3f ms\n", rev, latency, sector);
printf("one random sector: %.3f ms\n", seek + latency + sector);
double n = 300;
printf("300 sectors scattered: %.3f ms\n", n * (seek + latency + sector));
printf("300 sectors contiguous, free track switches: %.3f ms\n", seek + latency + n * sector);
printf("ratio %.1f\n", n * (seek + latency + sector) / (seek + latency + n * sector));
return 0;
}revolution 6.000 ms, average latency 3.000 ms, one sector 0.030 ms
one random sector: 9.030 ms
300 sectors scattered: 2709.000 ms
300 sectors contiguous, free track switches: 18.000 ms
ratio 150.5Reading it. One revolution takes ms; the average wait is 3 ms and one sector passes in ms, so a random sector costs ms: the transfer is a third of a percent of it. Scattered, 300 sectors cost ms. Contiguous, the seek and the wait are paid once: ms (the file crosses one track boundary; with free track switches the time is the same).
EX 4A transfer rate, a seek that is a multiple of the latency, and the controller
GATE levelA disk turns at 10000 rpm and transfers at bytes per second. The average seek time is three times the average rotational delay, and the controller needs five times the disk's transfer time. Find the average time to read a 512-byte sector.
#include <stdio.h>
int main(void) {
double rev = 60.0 / 10000; /* seconds */
double latency = rev / 2;
double seek = 3 * latency;
double transfer = 512 / 40e6;
double controller = 5 * transfer;
printf("latency %.4f ms, seek %.4f ms, disk transfer %.6f ms, controller %.6f ms\n", latency * 1e3, seek * 1e3, transfer * 1e3, controller * 1e3);
printf("average time %.4f ms\n", (seek + latency + transfer + controller) * 1e3);
return 0;
}latency 3.0000 ms, seek 9.0000 ms, disk transfer 0.012800 ms, controller 0.064000 ms
average time 12.0768 msReading it. The data rate is given directly, so the transfer is (no need for the sectors per track). The average latency is half of ms ms, the seek ms, the controller . Total ms. A "rounded to one decimal place" answer is 12.1 ms. Always check which quantities are given (seek, rate) and which must be derived from the rpm.
EX 5Which statement is true?
GATE levelThe average rotational latency is half a revolution. True, if the wanted sector is equally likely to be anywhere on the track. Doubling the number of platters doubles the capacity and the data rate of a track read. The capacity doubles; the data rate of one track does not change (only one head reads at a time). Doubling the rpm halves the rotational latency and the transfer time but leaves the seek unchanged. True. Reading 100 consecutive sectors of a track costs about the same as reading 100 random sectors. False: the random case pays 100 seeks and 100 waits. Capacity does not depend on the rpm. True; the rpm only sets the time.
Cheat box
Cheat box
- Capacity . Tracks . Cylinders tracks per surface.
- Sector number ; back: , , (all from 0).
- Bits: one number ; three fields .
- . (average). Sector time . Data rate .
- . Scattered: . Contiguous: seek and wait once, then sector times.
- Sizes are powers of two (); a quoted transfer rate in is decimal.
Traps and GATE patterns
Connections
Across subjects
Within this subject
The disk is the slowest level of the memory hierarchy; its cost per access is what caches and buffer pools exist to hide. The operating system chooses the order of requests to cut the seek part in disk scheduling, lays files out contiguously or in blocks in file allocation, and the data then moves by DMA. A database computes how many blocks a file or an index occupies from the block size and the record size in file organisation, because every block touched is one disk access of the kind computed here.
PYQs
15 previous year questions from your book. I re-solved each one myself (15 by running or simulating, 0 by reasoning only); the book's key is shown next to my answer. All PYQs
Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer rate of 50 × 106 bytes /sec. If the average seek time of the disk is twice the average rotational delay and the controller's transfer time is 10 times the disk transfer time, the average time (in milliseconds) to read or write a 512-byte sector of the disk is .
Consider a disk pack with a seek time of 4 milliseconds and rotational speed of 10000 rotations per minute (RPM). It has 600 sectors per track and each sector can store 512 bytes of data. Consider a file stored in the disk. The file contains 2000 sectors Assume that every sector access necessitates a seek, And the average rotational latency for accessing each sector is half of the time for one complete rotation. The total time (in milliseconds) needed to read the entire file is
Consider a hard disk with 16 recording surfaces (0- 15) having 16384 cylinders (0-16383) and each Computer Organization and Architecture cylinder contains 64 sectors (0-63). Data storage capacity in each sector is 512 bytes. Data are organized cylinder-wise and addressing format is <cylinder no., surface no., sector no>. A file of size 42797 KB is stored in the disk and the starting disk location of the file is < 1200, 9, 40>. What is the cylinder number of the last sector of the file, if it is stored in a contiguous manner?
- (a)1281
- (b)1282
- (c)1283
- (d)1284
An application loads 100 libraries at start-up. Loading each library requires exactly one disk access. The seek time of the disk to a random location is given as 10 ms . Rotational speed of disk is 6000 rpm . If all 100 libraries are loaded from random locations on the disk, how long does it take to load all libraries? (The time to transfer data from the disk block once the head has been positioned at the start of the block may be neglected.)
- (a)0.50 s
- (b)1.50 s
- (c)1.25 s
- (d)1.00 s
Consider the disk drive with the following specifications: 16 surfaces, 512 tracks/surface, 512 sectors/track, 1 KB/sector, rotation speed 3000 rpm. The disk is operated in cycle stealing mode whereby whenever one byte is ready it is sent to memory, similarly, for writing, the disk interface reads a 4-byte word from the memory in each DMA cycle. Memory cycle time is 40 nsec The maximum percentage of time that the CPU gets blocked during DMA operation is
- (a)10
- (b)25
- (c)40
- (d)50
Consider a hard disk with a rotational speed of 15000 rpm. The time to move the read/write head from a track to its adjacent track is 1 millisecond. Initially, the head is on track 0. The number of sectors per track is 400, and the sector size is 1024 bytes. It is necessary to transfer data from 10 randomly located sectors in each of the following tracks in the order: 5, 12, and 7. The total time for the data transfer (in milliseconds) from the hard disk is ______. (rounded off to one decimal place)
Consider a disk with the following specifications: rotation speed of 6000 RPM, average seek time of 5 milliseconds, 500 sectors/track, 512-byte sectors. A file has content stored in 3000 sectors located randomly on the disk. Assuming average rotational latency, the total time (in seconds, rounded off to 2 decimal places) to read the entire file from the disk is ______
Consider a 512 GB hard disk with 32 storage surfaces. There are 4096 sectors per track and each sector holds 1024 bytes of data. The number of cylinders in the hard disk is ______
Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a transfer rate of 50 × 106bytes/sec. If the average seek time of the disk is twice the average rotational delay and the controller's transfer time is 10 times the disk transfer time, the average time (in milliseconds) to read or write a 512- byte sector of the disk is ______
Consider a disk pack with a seek time of 4 milliseconds and rotational speed of 10000 rotations per minute (RPM). It has 600 sectors per track and each sector can store 512 bytes of data. Consider a file stored in the disk. The file contains 2000 sectors. Assume that every sector access necessitates a seek, and the average rotational latency for accessing each sector is half of the time for one complete rotation. The total time (in milliseconds) needed to read the entire file is ______
Consider a hard disk with 16 recording surfaces (0– 15) having 16384 cylinders (0–16383) and each cylinder contains 64 sectors (0–63). Each sector stores 512 bytes. Data are organized cylinder-wise and the addressing format is (cylinder no., surface no., sector no.). A file of size 42797 KB is stored starting at disk location (1200, 9, 40). What is the cylinder number of the last sector of the file, if it is stored contiguously?
An application loads 100 libraries at startup. Loading each library requires exactly one disk access. The seek time of the disk to a random location is given as 10 ms. Rotational speed of disk is 6000 rpm. If all 100 libraries are loaded from random locations on the disk, how long does it take to load all libraries? (The time to transfer data from the disk block once the head has been positioned at the start of the block may be neglected.)
- (a)0.50s
- (b)1.50s
- (c)1.25s
- (d)1.00 s
A hard disk has 63 sectors per track, 10 platters each with 2 recording surfaces and 1000 cylinders. The address of a sector is given as a triple (c,h,s), where c is the cylinder number, h is the surface number and s is the sector number. Thus, the 0th sector is addressed as ⟨0,0,0⟩, the 1st sector as ⟨0,0,1⟩, and so on. The address ⟨400,16,29⟩ corresponds to sector number:
- (a)505035
- (b)505036
- (c)505037
- (d)505038 OPERATING SYSTEMS
A hard disk has 63 sectors per track, 10 platters each with 2 recording surfaces and 1000 cylinders. The address of a sector is given as a triple (c,h,s), where c is the cylinder number, h is the surface number and s is the sector number. Thus, the 0th sector is addressed as ⟨0,0,0⟩, the 1st sector as ⟨0,0,1⟩, and so on. The address of 1039th sector is
- (a)⟨0,15,31⟩
- (b)⟨0,16,30⟩
- (c)⟨0,16,31⟩
- (d)⟨0,17,31⟩
Consider a disk pack with 16 surfaces, 128 tracks per surface and 256 sectors per track. 512 bytes of data are stored in a bit serial manner in a sector. The capacity of the disk pack and the number of bits required to specify a particular sector in the disk pack are respectively:
- (a)256 Mbyte, 19 bits
- (b)256 Mbyte, 28 bits
- (c)512 Mbyte, 20 bits
- (d)64 Gbyte, 28 bits
Self-check
Question 1
A disk has 16 surfaces, 1024 cylinders, 64 sectors per track and 1 KB sectors. Its capacity, and the number of bits of a sector number?
Show answerHide
bytes, 1 GB. There are sectors, so 20 bits.
Question 2
On a disk with 8 surfaces and 100 sectors per track, which address ⟨c, h, s⟩ is sector number 5000?
Show answerHide
One cylinder holds sectors: rest ; rest . The address is ⟨6, 2, 0⟩.
Question 3
The average rotational latency of a 12000 rpm disk?
Show answerHide
A revolution takes ms, so the average latency is 2.5 ms.
Question 4
A 10000 rpm disk has an average seek of 6 ms and 200 sectors per track. Average time of one random sector?
Show answerHide
Revolution 6 ms, latency 3 ms, sector time ms: ms.
Question 5
The same disk: a file of 300 sectors stored contiguously (free track switches)?
Show answerHide
One seek, one wait, then 300 sector times: ms.
Revision card
One-screen revision
- Capacity ; cylinders tracks per surface; sizes in powers of two.
- and back by two divisions; bits: one number or three fields.
- ; average latency ; sector ; seek latency transfer.
- Scattered file: full accesses. Contiguous: seek and wait once.
- GATE model: constant , numbers from 0; real disks use zones and logical block addresses.
References
- ·Hamacher, Vranesic, Zaky, Computer Organization, 5th ed., Chapter 5 Basic Processing / Memory (magnetic disks)
- ·Silberschatz, Galvin, Gagne, Operating System Concepts, Chapter 11 Mass-Storage Structure (disk structure, disk performance)
- ·Patterson and Hennessy, Computer Organization and Design, Storage chapter (disk performance)
Verification
Every number in the four tables is produced by scripts/gen-coa-disk-traces.py from scripts/coa_disk.py (exact fractions) and recomputed in TypeScript by tests/coa-disk-traces.test.ts; the three C programs are compiled and run by npm run verify:c (their output is written by scripts/fill-c-output.py, not typed). scripts/enum-checks/coa_disk.py checks the address formulas against an enumeration of every address of seven small disks, the bit counts against bit_length, the average rotational latency by averaging over arrival phases, a contiguous read by a timeline simulation (with and without skew) and the cylinder of the last sector of a file by an odometer on 300 random files; it also confirms that the mean seek distance of random requests is about one third of the tracks. GATE model versus real hardware: the page uses a constant number of sectors per track and sector numbers starting at 0, as GATE questions do; real disks use zoned recording and the sector field of the legacy CHS address starts at 1. Seek-time figures are averages given in the question, not derived. Textbook chapter titles are from memory. SECOND PASS (2026-11-02, done by the assistant, not a human check): every Self-check question was solved before the printed answer was read and all agreed; the definitions, worked examples, cheat box and traps were read claim by claim and the numbers re-derived by hand (long C programs were not re-read line by line: they are compiled and compared by npm run verify:c, and their printed outputs were checked against the prose). No defect found. Status raised to self-checked; verified needs a textbook or human check.
last verified: never
My notes (saved in this browser)