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

File Systems and Disk Operations: Structures, Access Methods, and Allocation Schemes, Slides of Operating Systems

An in-depth exploration of various file system concepts, including file structures, access methods, and allocation schemes. Topics covered include sequential and direct access, contiguous, linked, and indexed allocation, and free-space management. Additionally, the document discusses efficiency, performance, and recovery techniques.

Typology: Slides

2012/2013

Uploaded on 04/24/2013

banamala
banamala 🇮🇳

4.4

(19)

120 documents

1 / 104

Toggle sidebar

Related documents


Partial preview of the text

Download File Systems and Disk Operations: Structures, Access Methods, and Allocation Schemes and more Slides Operating Systems in PDF only on Docsity! FILE-SYSTEM INTERFACE File Concept Access Methods Directory Structure File System Mounting File Sharing Protection Docsity.com File Concept • Contiguous logical address space • Types: – Data • numeric • character • binary – Program Docsity.com File Attributes • Name – only information kept in human- readable form. • Type – needed for systems that support different types. • Location – pointer to file location on device. • Size – current file size. Docsity.com File Attributes • Protection – controls who can do reading, writing, executing. • Time, date, and user identification – data for protection, security, and usage monitoring. • Information about files are kept in the directory structure, which is maintained on the disk. Docsity.com File Operations • Create • Write • Read • Reposition within file – file seek • Delete Docsity.com Access Methods • Sequential Access: – read next – write next – reset – no read after last write – (rewrite) Docsity.com Access Methods • Direct Access: read n write n position to n read next write next rewrite n n = relative block number Docsity.com Sequential-access File .. current position beginning end <e rewind I~ read or write => ® Docsity.com Directory Structure • A collection of nodes containing information about all files. F 1 F 2 F 3 F 4 F n Directory Files On disk: directory structure & files Backups of these two structures are kept on tapes. Docsity.com partition A < partition B < ara files directory files > disk 1 partition C < directory files > disk 2 aw > disk 3 Docsity.com Information in a Device Directory • Name • Type • Address • Current length • Maximum length • Date last accessed (for archival) • Date last updated (for dump) • Owner ID (who pays) • Protection information (discuss later) Docsity.com Single-Level Directory • A single directory for all users. Naming problem Grouping problem Docsity.com Two-Level Directory • Separate directory for each user. • Path name • Can have the same file name for different user • Efficient searching • No grouping (only two levels!) Docsity.com Tree-Structured Directories root | spell bin |programs' stat | mail | dist hex |reorder e | mail } \ > d . 66 D prog | copy | prt eorder i t O— sé gee e ¥ 8 wo a a Sh & Tree-Structured Directories (Cont.) • Creating a new subdirectory is done in current directory. mkdir <dir-name> • Example: if in current directory /mail mkdir count mail prog copy prt exp count Deleting “mail”  deleting the entire subtree rooted by “mail”. Docsity.com Acyclic-Graph Directories ¢ Have shared subdirectories and files root dict spell a list all w_ |count od ~ count| words list ¥ > list rade | iad Docsity.com Acyclic-Graph Directories (Cont.) • Two different names (aliasing) • If dict deletes list  dangling pointer. • Solutions: – Backpointers, so we can delete all pointers. Variable size records a problem. – Backpointers using a daisy chain organization. – Entry-hold-count solution. Docsity.com File System Mounting • A file system must be mounted before it can be accessed. • A unmounted file system (i.e., Fig. 11-11(b)) is mounted at a mount point. Docsity.com (a) Existing. (b) Unmounted Partition jane prog doc (b) Docsity.com Mount Point Docsity.com Access Lists and Groups • Mode of access: read, write, execute • Three classes of users RWX a) owner access 7  1 1 1 b) group access 6  1 1 0 c) public access 1  0 0 1 • Root creates a group (unique name), say G, and add some users to the group. • For a particular file (say game) or subdirectory, define an appropriate access. owner group public chmod 761 game Attach a group to a file: $ chgrp G game Docsity.com Windows Access Control List Mgmt earned eral) Security | Summary. Sruup ur user sores fF Adminisirators (FBG LAPTOP Ad: pbg (CThpba) {PSYSTEM #BUsers (POGLAFTOR\Ussrs) Pemissions tor Guest Full Contral Modlity Pead 8 Execute Read Write Saecial Permissions Remove Deny For special permissions ar foradwanced settings. click Advanced. Cancel Docsity.com Sample UNIX Directory Listing Lr w-rw-r-- idrwx------ drwxrwXxr-x drwxrwXx--- Lrw-r--r-- LE WXf-XP-X dw x--X--x idrwx------ drwxrwxrwx staff staff staff student staff staff faculty staff staff Sep 3 08:30 Jul 8 09.33 Jul 8 09:35 Aug 3 14:13 Feb 24 2003 Feb 24 2003 Jul 31 10:31 Aug 29 06:52 Jul 8 09:35 intro.ps private/ doc/ student-proj program.c program lib/ mail/ test/ Layered File Sy application programs logical file system { file-organization module ‘ basic file system ‘ 1/O control ‘ devices Docsity.com file permissions file dates (create, access, write) file owner, group, ACL file size file data blocks or pointers to file data blocks Docsity.com In-Memory File System Structures • The following figure illustrates the necessary file system structures provided by the operating systems. Docsity.com fs oe file-system interface ¥ VES interface | | ¥ local file system local file system remote file system type 1 type 2 type 1 Pm as 7 a network _Docsi y.com Directory Implementation • Linear list of file names with pointer to the data blocks. – simple to program – time-consuming to execute • Hash Table: linear list with hash data structure. – decreases directory search time – collisions – situations where two file names hash to the same location – fixed size Docsity.com Allocation Methods • An allocation method refers to how disk blocks are allocated for files: – Contiguous allocation – Linked allocation – Indexed allocation Docsity.com Linked Allocation • Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk. pointer block = Docsity.com Linked Allocation (Cont.) • Simple – need only starting address • Free-space management system – no waste of space • No random access • Can get awful performance Docsity.com Linked Allocation (Cont.) • Mapping Block to be accessed is the Qth block in the linked chain of blocks representing the file. Displacement into block = R + 1 File-allocation table (FAT) – disk-space allocation used by MS-DOS and OS/2. LA/511 Q R Docsity.com Indexed Allocation • Brings all pointers together into the index block. • Logical view. index table Docsity.com directory file jeep index block 19 Docsity.com Indexed Allocation (Cont.) • Need index table • Random access • Dynamic access without external fragmentation, but have overhead of index block. Docsity.com Indexed Allocation – Mapping (Cont.) • Two-level index (maximum file size is 5123) Q1 = displacement into outer-index R1 is used as follows: Q2 = displacement into block of index table R2 displacement into block of file: LA/(512x511) Q1 R1 R1 /512 Q2 R2 Docsity.com Indexed Allocation — Mapping (Cont.) [-—_] outer-index | index table file Docsity.com Combined Scheme:UNIX (1KB/block) 10 KB 1 KB blocks 256 KB 256*256*1KB = 64 MB Docsity.com Free-Space Management (Cont.) • Bit map requires extra space. Example: block size = 212 bytes disk size = 230 bytes (1 gigabyte) n = 230/212 = 218 bits (or 32K bytes) • Easy to get contiguous files • Linked list (free list) – Cannot get contiguous space easily – No waste of space • Grouping • Counting Docsity.com Linked Free Space List on Disk free-space list head —4 Docsity.com Free-Space Management (Cont.) • Need to protect: – Pointer to free list – Bit map • Must be kept on disk • Copy in memory and disk may differ. • Cannot allow for block[i] to have a situation where bit[i] = 1 in memory and bit[i] = 0 on disk. – Solution: • Set bit[i] = 0 in disk. • Allocate block[i] • Set bit[i] = 0 in memory Docsity.com I/O using Se read( ) and write( ) page cache \ buffer cache | file system che Docsity.com Unified Buffer Cache • A unified buffer cache uses the same page cache to cache both memory-mapped pages and ordinary file system I/O. Docsity.com memory-mapped I/O read{ ) I/O using and write( ) @ \ ZL buffer cache | file system Docsity.com Log Structured File Systems • The transactions in the log are asynchronously written to the file system. When the file system is modified, the transaction is removed from the log. • If the file system crashes, all remaining transactions in the log must still be performed. Docsity.com MASS-STORAGE SYSTEMS Disk Structure Disk Scheduling Disk Management Docsity.com Overview of Mass Storage Structure • Magnetic disks provide bulk of secondary storage of modern computers – Drives rotate at 60 to 200 times per second – Transfer rate is rate at which data flow between drive and computer – Positioning time (random-access time) is time to move disk arm to desired cylinder (seek time) and time for desired sector to rotate under the disk head (rotational latency) – Head crash results from disk head making contact with the disk surface • That’s considered not good Docsity.com Mass Storage Structure (Cont.) • Magnetic tape – Was early secondary-storage medium – Relatively permanent and holds large quantities of data – Access time slow – Random access ~1000 times slower than disk – Mainly used for backup, storage of infrequently-used data, transfer medium between systems – Kept in spool and wound or rewound past read-write head – Once data under head, transfer rates comparable to disk – 20-200GB typical storage – Common technologies are 4mm, 8mm, 19mm, LTO-2 and SDLT Docsity.com Disk Structure • Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. • The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially. – Sector 0 is the first sector of the first track on the outermost cylinder. – Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost. Docsity.com Disk Attachment • Host-attached storage accessed through I/O ports talking to I/O busses • SCSI itself is a bus, up to 16 devices on one cable, SCSI initiator requests operation and SCSI targets perform tasks – Each target can have up to 8 logical units (disks attached to device controller • FC is high-speed serial architecture – Can be switched fabric with 24-bit address space – the basis of storage area networks (SANs) in which many hosts attach to many storage units – Can be arbitrated loop (FC-AL) of 126 devices Docsity.com Disk Scheduling • The OS is responsible for using hardware efficiently . • For the disk drives  fast access time and disk bandwidth. • Access time has two major components – Seek time: time for the disk are to move the heads to the cylinder containing the desired sector. – Rotational latency: the additional time waiting for the disk to rotate the desired sector to the disk head. Docsity.com Disk Scheduling • Minimize seek time • Seek time  seek distance • Disk bandwidth = (total number of bytes transferred) ( total time between the first request for service and the completion of the last transfer) Docsity.com Disk Scheduling (Cont.) • Several algorithms exist to schedule the servicing of disk I/O requests. We illustrate them with a request queue (Consider valid cylinders to be 0-199) 98, 183, 37, 122, 14, 124, 65, 67 Head pointer: 53 Docsity.com SSTF (Cont. queue = 98, 183, 37, 122, 14, 124, 65, 67 head starts at 53 0 14 37 536567 98 122124 18319 | I SCAN • Starts at one end of the disk – moves toward the other end, servicing requests until it gets to the other end of the disk – head movement is reversed and servicing continues. • Sometimes called the elevator algorithm. – Goes up, then goes down • Illustration shows total head movement of 208 cylinders. Docsity.com 0 | 14 | SCAN (Cont.) queue = 98, 183, 37, 122, 14, 124, 65, 67 head starts at 53 37 536567 98 122124 | |_I | Ll 183199 locsity.ca im C-LOOK • Version of C-SCAN • Arm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk. Docsity.com C-LOOK (Cont.) queue 98, 183, 37, 122, 14, 124, 65, 67 head starts at 53 O 14 3/7 536567 98 122124 183199 ® Docsity ca Selecting a Disk-Scheduling Algorithm • SSTF is common and has a natural appeal • SCAN and C-SCAN perform better for systems that place a heavy load on the disk. • Performance depends on the number and types of requests. Docsity.com
Docsity logo



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