Chapter 10: File-System Interface

Slides:



Advertisements
Similar presentations
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
Advertisements

Chapter 10: File-System Interface
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Chapter 10: File-System Interface
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Dr. Kalpakis CMSC 421, Operating Systems. Fall File-System Interface.
1 File Management (a). 2 File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection.
Chapter 11: File System Implementation
04/02/2004CSCI 315 Operating Systems Design1 File System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
Chapter 12: File System Implementation
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
Chapter 10: File-System Interface
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
File System Implementation
File Concept §Contiguous logical address space §Types: l Data: Numeric Character Binary l Program.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
Chapter 10 File System Interface
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Chapter 11: File System Implementation Hung Q. Ngo KyungHee University Spring 2009
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure File-System.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Chapter 10: File-System Interface 10.1 Silberschatz, Galvin and Gagne ©2011 Operating System Concepts – 8 th Edition 2014.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
Page 110/19/2015 CSE 30341: Operating Systems Principles Chapter 10: File-System Interface  Objectives:  To explain the function of file systems  To.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
File-System. Overview File system is the visible aspect of an OS. It provides mechanism for on-line storage of and access to both data and programs of.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 11: File-System Interface Modified.
10.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 10: File-System Interface.
Dr. T. Doom 11.1 CEG 433/633 - Operating Systems I Chapter 11: File-System Implementation File structure –Logical storage unit –Collection of related information.
Silberschatz and Galvin  Operating System Concepts File-System Implementation File-System Structure Allocation Methods Free-Space Management.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 11: File-System Interface File Concept Access Methods Directory Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
10.1 CSE Department MAITSandeep Tayal 10 :File-System Implementation File-System Structure Allocation Methods Free-Space Management Directory Implementation.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 11 File-System Implementation Slide 1 Chapter 11: File-System Implementation.
Page 112/7/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  File system structure – layered, block based.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lecture 18: File-System Interface (Ch 10)
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
It consists of two parts: collection of files – stores related data directory structure – organizes & provides information Some file systems may have.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Allocation Methods An allocation method refers to how disk blocks are allocated for files: Contiguous allocation Linked allocation Indexed allocation.
Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems File System Interface.
CSE Operating System Principles File Systems.
Lecture : chapter 9 and 10 file system 1. File Concept A file is a collection of related information defined by its creator. Contiguous logical address.
File-System Implementation
Chapter 11: File System Implementation
Chapter 11: File System Implementation
Directory Structure A collection of nodes containing information about all files Directory Files F 1 F 2 F 3 F 4 F n Both the directory structure and the.
Chapter 10: File-System Interface
Chapter 11: File System Implementation
Presentation transcript:

Chapter 10: File-System Interface

Chapter 10: File-System Interface File Concept Access Methods Directory Structure File-System Mounting

File Concept A file is a named collection of related information that is recorded on secondary storage. Data can NOT be written to secondary storage unless they are within a file.

File Structure A file has a certain defined structure which depends on its types: A text file is a sequence of characters organized into lines. A source file is a sequence of subroutines and function. An object file is a sequence of bytes organized into blocks understandable by the system’s linker. An executable file is a series of code sections that the loader can bring into memory and execute.

File Attributes Name – only information kept in human-readable form Identifier – unique tag (number) identifies file within file system Type – needed for systems that support different types Location – pointer to file location on device Size – current file size 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

File Operations File is an abstract data type Create Write Read Reposition within file Delete Truncate Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory Close (Fi) – move the content of entry Fi in memory to directory structure on disk

Open Files Several pieces of data are needed to manage open files: File pointer: pointer to last read/write location, per process that has the file open File-open count: the counter tracks the number of opens and closes, and reaches zero on the last close. The system can then remove the entry. Disk location of the file: the info needed to locate the file on disk. Access rights: per-process access mode information so OS can allow or deny subsequent I/O request

File Types – Name, Extension

Access Methods Sequential Access read next write next reset no read after last write (rewrite) Direct Access read n write n position to n rewrite n n = relative block number

Sequential-access File Information in the file is processed in order, one after the other.

Simulation of Sequential Access on Direct-access File cp: current position

Example of Index and Relative Files The index contains pointers to the various blocks. To find a record in the file, we first search the index and then use the pointer to access the file directly and to find the desired record.

Disk Structure Disk can be subdivided into partitions Disks or partitions can be redundant arrays of independent disks (RAID) protected against failure Disk or partition can be used raw – without a file system, or formatted with a file system Partitions also known as minidisks, slices Entity containing file system known as a volume Each volume containing file system also tracks that file system’s info in device directory or volume table of contents

A Typical File-system Organization Each volume that contains a file system must also contain information about the files in the system. This information is kept in entries in a device directory which records name, location, size and type.

Operations Performed on Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system

Tree-Structured Directories Absolute path: begins at the root and follows a path down to the specified file. root/spell/mail/prt/first Relative path: defines a path from the current directory. prt/first given root/spell/mail as current path.

Tree-Structured Directories (Cont) Efficient searching Grouping Capability Current directory (working directory) pwd cd /spell/mail/prog

Tree-Structured Directories (Cont) Creating a new file is done in current directory Delete a file rm <file-name> 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” Option1: do not delete a directory unless it is empty, such as MS-DOS Option2: delete all files in that directory, such as UNIX rm command with r option

Acyclic-Graph Directories Have shared subdirectories and files Only one file exists. Any changes made by one person are immediately visible to the other.

Acyclic-Graph Directories (Cont.) New directory entry type Link – another name (pointer) to an existing file Resolve the link – follow pointer to locate the file

File System Mounting A file system must be mounted before it can be accessed A unmounted file systemis mounted at a mount point, the location within the file structure where the file system is to be attached. An empty directory.

(a) Existing. (b) Unmounted Partition

Mount Point

Chapter 11: File System Implementation

Chapter 11: File System Implementation File-System Structure File-System Implementation Directory Implementation Allocation Methods Free-Space Management

File-System Structure File structure Logical storage unit Collection of related information File system organized into layers File system resides on secondary storage (disks) Provides efficient and convenient access to disk by allowing data to be stored, located retrieved easily File control block – storage structure consisting of information about a file Device driver controls the physical device

Layered File System

File-System Implementation Boot control block contains info needed by system to boot OS from that volume Volume control block contains volume details Directory structure organizes the files Per-file File Control Block (FCB) contains many details about the file

A Typical File Control Block

In-Memory File System Structures the necessary file system structures provided by the OS refers to opening a file refers to reading a file

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

Allocation Methods An allocation method refers to how disk blocks are allocated for files: Contiguous allocation Linked allocation Indexed allocation

Contiguous Allocation of Disk Space Each file occupies a set of contiguous blocks on the disk Simple – only starting location (block #) and length (number of blocks) are required Random access Wasteful of space (dynamic storage-allocation problem) Files cannot grow

Linked Allocation Each file is a linked list of disk blocks: blocks may be scattered anywhere on the disk. pointer block =

Linked Allocation Simple – need only starting address Free-space management system – no waste of space No random access

File-Allocation Table File-allocation table (FAT) – disk-space allocation used by MS-DOS and OS/2. Each block is indexed by block number.

Indexed Allocation Brings all pointers together into the index block Logical view index table

Example of Indexed Allocation Need index table Random access Dynamic access without external fragmentation, but have overhead of index block

Indexed Allocation – Mapping (Cont.)  outer-index index table file

Combined Scheme: UNIX UFS (4K bytes per block)

Free-Space Management Bit vector (n blocks) 1 2 n-1 … 0  block[i] free 1  block[i] occupied bit[i] =  Block number calculation (number of bits per word) * (number of 0-value words) + offset of first 1 bit

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

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] = 1 in disk Allocate block[i] Set bit[i] = 1 in memory

Linked Free Space List on Disk

End of Chapter 11