Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Understanding Disk Structure: Layers, Geometry, and Filesystems, Study notes of Operating Systems

An in-depth exploration of the structure and organization of disks, including their geometry, sparing, defragmentation, and filesystems. It covers topics such as tracks, sectors, virtual geometry, page caching, and disk scheduling. The document also discusses the importance of disks as a bottleneck in modern systems and various disk scheduling strategies.

Typology: Study notes

2012/2013

Uploaded on 04/23/2013

ashalata
ashalata 🇮🇳

3.8

(15)

112 documents

1 / 30

Toggle sidebar

Related documents


Partial preview of the text

Download Understanding Disk Structure: Layers, Geometry, and Filesystems and more Study notes Operating Systems in PDF only on Docsity! So far, we've studied devices and major/minor numbers. This is a single-layer model. Disks have a multi-layer I/O model. Drivers talk to each other. I/O and disks I/O and disks Tuesday, December 01, 2009 1:49 PM Disks_and_Layers Page 1 Docsity.com Geometry Sparing and defragmentation The physical media. Operations: write/read Paging Scheduling The raw device. The concept of a file. The concept of a directory. The filesystem device. A modern disk is a set of layers: Up the long ladder… Thursday, November 17, 2011 11:19 AM Disks_and_Layers Page 2 Docsity.com Disks Thursday, December 02, 2004 5:39 PM Disks_and_Layers Page 5 Docsity.com "geometry" is a baldfaced lie. Inside a disk: 1,000,000 lines of C code. Modern disks Sparing: replacing one sector with another Variable-sector maps: more sectors on outside than inside. Lots of internal tricks that are not visible to the OS: Bad block: scratched disk platter or equivalent. Spare table: a special track or tracks used to replace bad blocks. Sparing: recovering (automatically) from disk errors Disk geometry Thursday, December 02, 2004 5:39 PM Disks_and_Layers Page 6 Docsity.com It is physically impossible to have the same number of sectors for every track. Outer tracks have more media than inner tracks. Thus there are more sectors at the edge than in the middle! Virtual geometry Virtual geometry Thursday, December 02, 2004 5:39 PM Disks_and_Layers Page 7 Docsity.com Disks can only read and write blocks at a time. ○ Processes often write parts of blocks to files. ○ How to mediate? ○ Very subtle point: "page" =~ 8192 bytes How big is a "page" of the filesystem? "sector" =~ 512 bytes How much of the disk can be read at a time? Several blocking factors Ambiguity: Answer: make memory images of files. This is called "the disk paging subsystem". Disk paging Thursday, December 02, 2004 5:39 PM Disks_and_Layers Page 10 Docsity.com The paging subsystem When one opens a file, allocate the file pages from a "page pool" of available kernel pages. ○ Read current page of file into page pool Perform change to page in page pool.  When convenient, "flush" changes from page pool to file.  Do this as late as possible. When a process writes to the file,○ A kernel array A fixed-length resource. Allocated at boot time. Page pool is The paging subsystem Thursday, November 17, 2011 10:57 AM Disks_and_Layers Page 11 Docsity.com Answer: disk image of page cache for files is never up to date. ○ directory blocks file blocks inodes: where files are located Page pool contains "dirty copies" of○ A "dirty page" is out of sync between memory and disk. ○ To turn a machine off, must synchronize page pool to disk image (command: sync) ○ unix delegates page pool flushes to a separate process in user space: "update". ○ Flushes do not happen when file is closed!○ Absolutely no way that a normal process can assure that its data is flushed to disk! ○ Big mystery: why can't one just turn the power off on a UNIX machine: A big mystery Thursday, November 17, 2011 10:59 AM Disks_and_Layers Page 12 Docsity.com Done by kernel/scheduler○ Thing to swap: process memory. ○ Variable size: determined at exec time. ○ Swapping: process space. • Done by drivers○ Thing to swap: kernel page pool. ○ Fixed size: determined at boot time. ○ File paging: kernel space.• File paging is not analogous to swapping: Page pool notes Thursday, December 02, 2004 5:39 PM Disks_and_Layers Page 15 Docsity.com If processors are so fast, why is my computer so sloooow? Answer: disk is largest bottleneck in a modern system. Disk scheduling Seek: put head in the right track.  Read or write: read or write a sector of the track.  Two phases to a disk read or write○ Rotational delay: how long we have to wait for the sector to be under the head.  Arm movement: how long do we have to wait for the arm to be at the appropriate track?  Two components to "seek"○ Basic problem: disk geometry: Disk scheduling Thursday, December 02, 2004 5:39 PM Disks_and_Layers Page 16 Docsity.com In a multiprocessing system, processes contend for the same disk to read/write different data. The order in which seeks are made greatly determines throughput. Question: how should one schedule/prioritize/order requests from autonomous processes so that throughput is optimal? Better question: what is "optimal"? Disk scheduling issues: Disk scheduling issues Thursday, November 17, 2011 11:03 AM Disks_and_Layers Page 17 Docsity.com Thursday, November 15, 2012 5:10 PM Disks_and_Layers Page 20 Docsity.com In the preceding, we studied how blocks are written to disk. Now, we will impart meaning to the blocks and build something new: a filesystem. Imparting meaning Imparting meaning Tuesday, November 22, 2011 2:03 PM Disks_and_Layers Page 21 Docsity.com So far, we have one meaning for disk data: blocks. We will build up the concept of files in layers. Layers and meanings: Imparts a new form of meaning. That is not known at lower layers. Each layer Meaning: a physical location L on the disk contains data. First layer: the raw disk Meaning: maps logical block N -> physical location L Second layer: the raw device Meaning: make a file out of a sequence of blocks. Give the file a unique number in the filesystem. Third layer: the filesystem Meaning: gives numbered files human-readable names. Fourth layer: directories: Layers and meanings Thursday, November 17, 2011 11:04 AM Disks_and_Layers Page 22 Docsity.com The logical structure of a linux file Logically, a null-terminated linked list. Inode determines file properties. Blocks determine file contents. Minimum file size is one block, incremented in one block increments. The logical structure of a linux file Thursday, November 15, 2012 2:13 PM Disks_and_Layers Page 25 Docsity.com Inode table is logically an array. Each inode points to a linked list of blocks that is the file. The logical structure of the inode table Thursday, November 15, 2012 2:38 PM Disks_and_Layers Page 26 Docsity.com The logical structure of a directory The logical structure of a directory Thursday, November 15, 2012 2:16 PM Disks_and_Layers Page 27 Docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved