FILE SYSTEM IMPLEMENTATION12.1 File-System StructureHard disks have two important properties that make them suitable forsecondary storage of files in file systems: (1) Blocks of data can be rewrittenin place, and (2) they are direct access, allowing any block of data to beaccessed with only ( relatively ) minor movements of the disk heads androtational latency. ( See Chapter 12 )Disks are usually accessed in physical blocks, rather than a byte at a time.Block sizes may range from 512 bytes to 4K or larger.File systems organize storage on disk drives, and can be viewed as a layereddesign:oAt the lowest layer are the physical devices, consisting of themagnetic media, motors & controls, and the electronics connected tothem and controlling them. Modern disk put more and more of theelectronic controls directly on the disk drive itself, leaving relativelylittle work for the disk controller card to perform.oI/O Controlconsists ofdevice drivers, special software programs( often written in assembly ) which communicate with the devices byreading and writing special codes directly to and from memoryaddresses corresponding to the controller card's registers. Eachcontroller card ( device ) on a system has a different set of addresses( registers, a.k.a.ports) that it listens to, and a unique set ofcommand codes and results codes that it understands.oThebasic file systemlevel works directly with the device drivers interms of retrieving and storing raw blocks of data, without anyconsideration for what is in each block. Depending on the system,blocks may be referred to with a single block number, ( e.g. block #234234 ), or with head-sector-cylinder combinations.oThefile organization moduleknows about files and their logicalblocks, and how they map to physical blocks on the disk. In additionto translating from logical to physical blocks, the file organizationmodule also maintains the list of free blocks, and allocates free blocksto files as needed.oThelogical file systemdeals with all of the meta data associated witha file ( UID, GID, mode, dates, etc ), i.e. everything about the fileexcept the data itself. This level manages the directory structure andthe mapping of file names tofile control blocks, FCBs, whichcontain all of the meta data as well as block number information forfinding the data on the disk.The layered approach to file systems means that much of the code can beused uniformly for a wide variety of different file systems, and only certain