disk

¡Supera tus tareas y exámenes ahora con Quizwiz!

volume control block

- (per volume) contains: - volume (or partition) details, such as the number of blocks in the partition - the size of the block - a free-block count and free-block pointers, and a free-FCB count and FCB pointers. - stored on disk

allocation performance analysis

- depends on file access type - contiguous great for sequential and random - linked good for sequential and not random - indexed more complex - single block access could require 2 index block reads than data block read - clustering can help improve help improve throughout, reduce CPU overhead

file sharing

- desired on multi-user systems - sharing done through a protection scheme

SCAN (elevator) Disk Scheduling Algorithm

- disk arm starts at one end and moves toward the other, servicing requests as it reaches each cylinder until it gets to other end - if uniform distribution of requests, the largest density of requests is at the other end (since the other was most recently serviced)

disk structure

- disk can be subdivided into partitions, raw or formatted

Disk structure

- disk drives addressed as one-dimensional array of logical blocks - 1D array is sequentially mapped into sectors of disk - Sector 0: first sector of first track on outermost cylinder - mapping proceeds in order through that track, then through rest of tracks in that cylinder, then through rest of cylinders from outermost to innermost

blocks

- each block has one or more sectors - the usual size of sectors is 512 bytes - I/O transfers between memory and disk are performed in units of blocks

clustering

- solution for pointer problem of linked allocation - collect blocks into multiples, called clusters, and to allocate clusters rather than blocks - pointers then use a much smaller percentage of the file's disk space

compacting

- solution to external fragmentation - copy an entire file system onto another disk, then copy the files back onto the original disk by allocating contiguous space from this one large hole - this is costly in terms of time

free space list

- with indexed allocation, an entire index block must be allocated, even if only one or two pointers will be non-null

file operations (the minimal set of 6)

1. Create 2. Write - at WRITE POINTER location 3. Read - at READ POINTER location 4. Reposition within file (seek) 5. Delete 6. Truncate

general graph directory

how to guarantee no cycles? - only allow links to files not in subdirectories - garbage collection - cycle detection algorithm whenever a link is added

relative block number

index relative to beginning of file

sequential access method

info from file is processed in order - most common access method (diagram in slides)

simulating sequential access on a direct access file

keep a variable cp that defines current position

mount point

location within the file structure where the file system is to be attached - similar to root directory

contiguous allocation mapping from logical to physical

logical address/512: Q: quotient, R: remainder block to be accessed = Q + starting address displacement into block = R

logical to physical mapping for linked allocation

logical address/512: Quotient: Q, Remainder: R block to be accessed is the Qth block in the linked chain of blocks displacement into block = R + 1

mandatory file-locking mechanism

once a process requires an exclusive lock, OS will prevent any other process from accessing locked file

advisory file-locking mechanism

processes find statuses of locks and decide what to do

sector sparing

replace bad sector logically with spare sector

shared lock

similar to read lock, several processes can acquire lock concurrently

exclusive lock

similar to write lock, only one process can acquire lock at a time

logical blocks

smallest unit of transfer

system-wide open-file table

- contains a copy of the FCB of each open file - stored in memory

per-process open-file table

- contains a pointer to the appropriate entry in the system-wide open-file table - stored in memory

mount table

- contains information about each mounted volume - stored in memory

single-level directory

- single directory for all users - naming problem (all files must have unique names) - grouping problem (diagram in slides)

Constant angular velocity

disk rotation speed stays constant, density of bits decrease from inner tracks to outer tracks to keep data rate constant

file control block

- (FCB) (an inode in UNIX file systems) contains information about the file, including ownership, permissions, and location of the file contents - has a unique identifier number to allow association with a directory entry - per file - on disk

boot control block

- (per volume) can contain information needed by the system to boot an operating system from that volume - if the disk does not contain an operating system, this block can be empty - typically the first block of a volume. - stored on disk

C-SCAN Disk Scheduling Algorithm

- Circular SCAN, provides more uniform wait time than SCAN - head moves from one end of disk to the other - when it reaches other end, immediately returns to beginning of disk w/o servicing requests along the way - treats cylinders as circular list

How does the OS use a disk to hold files?

- OS needs to record its own data structures on disk STEPS: 1. PARTITION disk into one or more groups of cylinders, each treated as a logical disk 2. LOGICAL FORMATTING or "making a file system" - to increase efficiency, most file systems group blocks into CLUSTERS -- Disk I/O done in blocks -- File I/O done in clusters (groups of blocks)

Disk scheduling

- OS responsible for using hardware efficiently - disk drives need to have fast access time and disk bandwidth - MINIMIZE seek time - need to schedule I/O requests - many sources of disk I/O requests: OS, system processes, user processes - OS maintains queue of I/O requests

Selecting a disk scheduling algorithm

- SSTF: common, has natural appeal - SCAN/C-SCAN: perform better for systems that place a heavy load on the disk, less starvation - disk scheduling algorithm should be written as separate module of OS, allowing it to replaced w/ different algorithm if necessary - performance depends on # and type of requests - either SSTF or LOOK is reasonable for default

extent (modified contiguous allocation scheme)

- a contiguous block of space - used in a modified contiguous allocation scheme - a contiguous chunk of space is allocated initially; then, if that amount proves not to be large enough, another chunk of contiguous space (extent) is added

hash table directory implementation

- a linear list stores the directory entries, but a hash data structure is also used - major difficulties with a hash table are its generally fixed size and the dependence of the hash function on that size - we can use a chained-overflow hash table. Each hash entry can be a linked list instead of an individual value, and we can resolve collisions by adding the new entry to the linked list - still not that fast, but probably better than a linear list

file-allocation table (FAT)

- a section of disk at the beginning of each volume is set aside to contain the table - table has one entry for each disk block and is indexed by block number - directory entry contains the block number of the first block of the file - table entry indexed by that block number contains the block number of the next block in the file - This chain continues until it reaches the last block, which has a special end-of-file value as the table entry

acyclic-graph directory

- allows for sharing of subdirectories and files (i.e. a shared folder on a computer) - use backpointers - link: another name/pointer to existing file - resolve the link: follow pointer to locate file - or, duplicate all information

LOOK/C-LOOK Disk Scheduling Algorithm

- arm only goes as far as last request in each direction, then reverses direction immediately w/o going to the very end of disk

counting

- because space is frequently contiguously used and freed, with contiguous-allocation allocation, extents or clustering - keep address of first free block and count of following free blocks - free space list then has entries containing addresses and counts

other access methods

- can be built on top of base methods - generally involve creating an INDEX for the file - keep index in memory -- if too large, create index (in memory) of index (on disk)

Shortest-seek-time-first (SSTF) Disk Scheduling Algorithm

- chooses pending request closest to current head position - form of shortest job first (SJF) scheduling, may cause starvation - not optimal

indexed allocation

- each file has its own index block, which is an array of disk-block addresses - ith entry in the index block points to the ith block of the file - directory contains the address of the index block - to find and read the ith block, we use the pointer in the ith index-block entry - supports direct access, without suffering from external fragmentation, because any free block on the disk can satisfy a request for more space - pointer overhead of the index block is generally greater than the pointer overhead of linked allocation - With indexed allocation, an entire index block must be allocated, even if only one or two pointers will be non-null

linked allocation

- each file is a linked list of disk blocks; the disk blocks may be scattered anywhere on the disk - directory contains a pointer to the first and last blocks of the file - each block contains a pointer to the next block - problems: - space required for the pointers - the major problem is that it can be used effectively only for sequential-access files - Each access to a pointer requires a disk read, and some require a disk seek. Consequently, it is inefficient to support a direct-access capability for linked-allocation files

basic file system

- each physical block is identified by its numeric needs only to issue generic commands to the appropriate device driver to read and write physical blocks on the disk - disk address (for example, drive 1, cylinder 73, track 2, sector 10) - this layer also manages the memory buffers and caches that hold various file-system, directory, and data blocks - given command like "retrieve block 123" translates to device driver

tree-structured directory

- each process has a current directory - efficient searching - grouping capability

direct (relative) access method

- file is made up of fixed-length LOGICAL RECORDS that allows programs to read/write records rapidly in no particular order - random access to any file block

bit map or bit vector

- frequent way of implementing the free space list - Each block is represented by 1 bit. If the block is free, the bit is 1; if the block is allocated, the bit is 0. - main advantage of this approach is its relative simplicity and its efficiency in finding the first free block or n consecutive free blocks on the disk - bit vectors are inefficient unless the entire vector is kept in main memory

buffers

- hold file-system blocks when they are being read from disk or written to disk

First Come First Serve (FCFS) Disk Scheduling Algorithm

- intrinsically fair, but does not provide fastest service - head movement is not controlled, could be optimized further - look at diagrams in slideshow/book

file-organization module

- knows about files and their logical blocks, as well as physical blocks. - by knowing the type of file allocation used and the location of the file, the file-organization module can translate logical block addresses to physical block addresses

linear list directory implementation

- linear list of file names with pointers to the data blocks - simple to program but time-consuming to execute - to create a new file, we must first search the directory to be sure that no existing file has the same name, then add a new entry at the end of the directory. - real disadvantage of a linear list of directory entries is that finding a file requires a linear search - could try to improve by using a sorted list or a tree structure

linked list implementation of free space list

- link together all the free disk blocks, keeping a pointer to the first free block in a special location on the disk and caching it in memory - cannot get contiguous space easily - no waste of space - no need to traverse the entire list (if # of free blocks is recorded)

swap space management

- low level OS task - want to provide best throughput for virtual memory system - swap maps used to track swap space use

Disk management: initialization

- low-level/physical formatting - dividing a disk into sectors that the disk controller can read and write - each sector contains header, data area (usually 512 bytes), trailer

device drivers

- manage I/O devices at the I/O control layer - Given commands like "read drive1, cylinder 72, track 2, sector 10, into memory location 1060" outputs low-level hardware specific commands to hardware controller

logical file system

- manages metadata - manages the directory structure to provide the file-organization module with the information the latter needs, given a symbolic file name - maintains file structure via file-control blocks - protection

grouping

- modify linked list to store address of next n-1 blocks in first free block, plus a pointer to next block that contains free-block-pointers

why is logical to physical address translation difficult in practice (regarding disk structure)?

- most disks have defective sectors - number of sectors per track is not a constant via constant angular velocity

why layering is useful

- reduces complexity and redundancy - lower layers could be used by multiple file systems - logical layers can be implemented by any coding method, according to OS designer - BUT, adds overhead and can decrease performance

contiguous allocation

- requires that each file occupy a set of contiguous blocks on the disk - disk addresses define a linear ordering on the disk - the number of disk seeks required for accessing contiguously allocated files is minimal, as is seek time when a seek is finally needed - problems: - one difficulty is finding space for a new file - an example of the dynamic storage-allocation problem (8.3), which leads to external fragmentation

File System

- resides on secondary storage (disks) - provides user interface to storage, mapping logical to physical - provides efficient and convenient access to disk by allowing data to be stored, located retrieved easily - generally composed of many different levels

two-level directory

- separate directory for each user - path name - can have same file name for different user - efficient searching - no grouping capabilities (diagram in slides)

information associated with open file (4)

1. File pointer 2. File-open count: pointer to last r/w location, per process that has the file open 3. disk location of file 4. access rights

Disk management (3 main things)

1. Initialization 2. Boot 3. Bad-block recovery

operations performed on a directory (6)

1. search for file 2. create file 3. delete file 4. list directory 5. rename a file 6. traverse file system

positioning time (random access time) - 2 parts

1. seek time 2. rotational latency

logical to physical mapping in index allocation

Logical address/512 Q: displacement into index table R: displacement into block

open-file table

OS keeps table of info of about all open files

file-system mounting

a file system must be mounted before it is used

allocation problem

discussed in ch 12 - OS decides where the file should be placed

file is a(an) _______ data type

abstract

open file locking

allows a process to lock an open file so no other process can access it

access latency

average (random) access time = average seek time + average latency

average I/O time

average access time + (amount to transfer / transfer rate) + controller overhead

absolute path name

begins at root and follows a path down to the specific file

directory structure

collection of nodes containing information about all files

I/O control level

consists of device drivers and interrupt handlers to transfer information between the main memory and the disk system

file-open count

count associated with each file, how many processes have the file open - open() adds to count and close() decrements, when open count = 0 the file's entry is removed from open-file table

relative path name

defines path from current directory

rotational latency

time necessary for desired sector to rotate disk head

seek time

time necessary to move disk arm to cylinder

disk bandwidth

total number of bytes transferred / total time between first request for service and completion of last transfer

device directory / volume of table contents

within a volume, contains information about files in system


Conjuntos de estudio relacionados

Female reproductive system (definitions)

View Set