Unformatted text preview:

File SystemsFile System FunctionsFiles and (Magnetic) DisksPowerPoint PresentationFiles and DisksCommon Access MethodsPerformance EfficiencyFile System CachingSlide 9Buffering in the File SystemCaching and BufferingFile System Data StructuresDisk Allocation TechniquesContiguous AllocationLinked AllocationIndexedIndexed – EvaluationDisk AccessSlide 19Disk SchedulingFile System Case StudyReferencesOutlineUNIX-like File SystemsCharacteristics of UNIX-like File SystemsUNIX File StorageSlide 27Slide 28UNIX File SharingFile Locks, in UNIXFile I/O - ReadFile I/O - WriteEvolution of UNIX File SystemBerkeley Fast File SystemDisk Format in Early UFSPerformance LimitationsSummary:Limitations of Early UNIX File SystemsBerkeley FFS EnhancementsFFS EnhancementsOther functional enhancementsCylinder GroupsIncreased Block SizeStorage AllocationDisk Space AllocationPlacement IssuesPerformanceQuestionsSlide 48Slide 49File SystemsReview of File Systems and Disk ManagementFile System FunctionsDisk Management: allocate disk blocks to files Naming (device independence): how to map user file names into physical addresses Protection: security and sharing of files, as needed Reliability: protection against crashes •disk crash loses permanent info on disk; •system crash can lose info in kernel buffers that hasn't been written to disk yet. Performance/Efficiency: try to reduce amount of time spent in I/OFiles and (Magnetic) Disks•The disk is composed of sectors, tracks, surfaces, cylinders – this is the physical view of secondary storage•The OS maintains a file system to hide messy disk details from applications.•The file system provides an abstract view of the disk as a collection of logical blocks instead of sectors.from Operating Sytems, by William Stallings, Prentice HallFiles and Disks•A sector is the physical unit of data transfer between memory and disk; a block is the logical unit of data transfer, as managed by the file system. A block is a sector multiple. (UNIX block size = 4-8KB, usually) •The user views a file as a sequential stream of bytes (in UNIX and similar systems) or as a collection of fields/records (in database systems).•When the user program reads or writes data the file system will fetch/write the block that contains those bytes.Common Access Methods•Sequential access: get_nextMost file systems support this. For example, a C++ program will always maintain a pointer to the next byte to be read (or written) in an open file •Random or direct access: seek to a particular location in the file – may be identified by byte or record number or some field value (in indexed files).Performance Efficiency•Caching and buffering•Minimize storage fragmentation – small, unusable blocks of free disk space•Minimize file fragmentation, splitting a file into multiple blocks so that a seek may occur between any two blocks–Objective: optimize locality – store related information close togetherFile System Caching•The disk cache is a set of blocks (buffers) that are set aside in kernel space. Copies of recently accessed file blocks are kept here to reduce the number of disk accesses•Same concept as cache memory, which reduces the number of main memory references. •Blocks in the disk cache may be file data, or file system metadata (i-nodes, directory blocks, etc.)Disk StorageMain MemoryVarious levels ofhardware cachesDisk CacheThe memory hierarchyBuffering in the File System•Buffers are temporary storage located between a process and the disk.•Buffered input: Read one or more blocks from disk to memory – return to user as requested.•For sequential reading, buffering can (ideally) keep ahead of the user process, reducing the number of delays to wait for input. •Buffered output: Save writes until a full block has been written, then dump to disk.Caching and Buffering•Buffering and caching have somewhat different purposes, but both reduce disk accesses, improve execution performance.•The same kernel memory locations can serve both purposes (buffers or caches).File System Data Structures•Free-space list: represents the free disk blocks. May be stored as a bit map. •File mapping structure used to associate file blocks with disk blocks (where is the file stored?) –File Allocation Tables (FAT) –indexed structures (e.g. UNIX inodes)Disk Allocation Techniques•Contiguous•Linked•IndexedContiguous Allocation•Allocate disk space as a set of contiguous blocks (sequential) •File map structure has address of first block, number of blocks •Advantage: fast access (both sequential and random) •Disadvantages: fragmented disk space; problems when file growsLinked Allocation•Allocated disk blocks may be anywhere on disk. •File map contains address of first block; subsequent links stored directly in the blocks (block 0 contains the address of block 1, block 1 contains address of block 2, etc.) •Advantages: –file can grow dynamically so no disk fragmentation;–sequential access is reasonable (requires a seek between blocks which isn’t needed in contiguous) but not as good as for contiguous allocation.•Disadvantages: random access is impractical -Indexed•Allocation is similar to linked methods:–Allocate space as file grows, in some fixed block size –Allocation unit = one or more sectors•Each process has its own file map (or index): a block of pointers to the individual blocks of the file – similar to a page table. •Sequential and random access take roughly the same amount of time.Indexed – Evaluation•Disk utilization is good, no fragmentation •May require a separate seek for each block, so access times are slower than for sequential allocation (but faster than for linked allocation).•Usual approach: try to store file blocks sequentially if possible, but use index for access.•The UNIX inode structure is an example of a multilevel index.Disk Access•A disk access has three components:–Seek: locates the cylinder (track)–Rotational delay: locates the sector–Transfer: transfer data btw. memory and disk•Seek: most time-consuming factor –data transfer times are less significant. •Moving large amounts of data in a single operation reduces the seek overhead.Disk Scheduling•Disk scheduling algorithms optimize throughput by reducing the total seek time needed to satisfy a set of requests. •Useful primarily in server systems or other environments where request queues develop–SSTF: shortest seek time first.


View Full Document

UAH CS 690 - File System Functions

Download File System Functions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view File System Functions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view File System Functions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?