Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.

Slides:



Advertisements
Similar presentations
Chapter 10: File-System Interface
Advertisements

1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
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.
04/05/2010CSCI 315 Operating Systems Design1 Virtual Memory Wrap-up; 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.
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 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
File System Implementation
File Concept l Contiguous logical address space l Types: Data: numeric, character, binary Program: source, object (load image) Documents.
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.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
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.
Lecture 9: File Systems. Lecture 9 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents Files & File System Interface Directories & their Organization.
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.
Page 111/15/2015 CSE 30341: Operating Systems Principles Chapter 11: File System Implementation  Overview  Allocation methods: Contiguous, Linked, Indexed,
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
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.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Silberschatz and Galvin  Operating System Concepts Module 10: File-System Interface File Concept Access :Methods Directory Structure Protection.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
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.
W4118 Operating Systems Instructor: Junfeng Yang.
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
Module 10: File-System Interface
Chapter 11: File-System Interface
Chapter 11: File System Implementation
Chapter 11: File System Implementation
Chapter 11: File System Implementation
Chapter 10: File-System Interface
Chapter 11: File System Implementation
Module 10: File-System Interface
Presentation transcript:

Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design

File System Abstraction Physical RealityFile System Abstraction Block orientedByte oriented Phys. Sector #Named files No protectionUser protection CorruptionRobust to machine failures CSE 331 Operating Systems Design File System Components Disk Management –Scheduling, Allocation, Free Space Man. Naming- Directory Structure (Flat, Hierarchical) Protection, Authentication, Reliability

File Concept Contiguous logical address space Types: – Data (numeric, character, binary) – Program CSE 331 Operating Systems Design

File Structure None - sequence of words, bytes Simple record structure – Fixed length – Variable length Complex Structures – Formatted document – Relocatable load file Can simulate last two with first method by inserting appropriate control characters. Who decides: – Operating system – Program UNIX approach – no structure CSE 331 Operating Systems Design

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. Protection – controls who can do reading, writing, executing. Time, date, and user identification – data for protection, security, and usage monitoring. Where are these information kept? File Header (PCB structure for Files) CSE 331 Operating Systems Design

File Operations Create Write Read Reposition within file – file seek Delete Truncate Open(F i ) – search the directory structure on disk for entry F i, and move the content of entry to memory. Close (F i ) – move the content of entry F i in memory to directory structure on disk. CSE 331 Operating Systems Design

User vs System View User view – Collection of bytes (UNIX) – Collection of records (IBM) System View (inside OS) – Collection of blocks Block is the logical transfer unit Sector is the physical transfer unit block size >= sector size ie. UNIX block size= 4KB How to translate user to system view? Give me bytes 2-12 CSE 331 Operating Systems Design

File Access Patterns – Sequential Access: Give me next X bytes.. – Random Access: Give me bytes i-j – Content-based Access: Find 100 bytes starting with “xxx” Many file systems do not provide #3 – DBs are built on FS for this purpose CSE 331 Operating Systems Design

Sequential-access File CSE 331 Operating Systems Design

Simulation of Sequential Access on a Direct-access File CSE 331 Operating Systems Design

How are files typically used? Most files are small (eg..login,.c) Large files use most of the disk space File System needs to be efficient – for small files as many of them – for large files as most of the I/O due to them CSE 331 Operating Systems Design

Disk Management 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. CSE 331 Operating Systems Design

Common Data Structures – File Header – one for each file – Bitmap to represent free space on disk (one bit per block) Blocks are numbered in Cylinder major order Track 0 surface 0 sector 0,1,... Surface 1, sector Track 1 surface 1, sector 0... CSE 331 Operating Systems Design

Allocation Methods How disk blocks are allocated for files? Contiguous allocation Linked allocation Indexed allocation CSE 331 Operating Systems Design

Contiguous Allocation Each file occupies a set of contiguous blocks on the disk. – Simple – only starting location (block #) and length (number of blocks) are required for access. – Search bitmap to locate space for file – Create (allocate max. Size) CSE 331 Operating Systems Design

Contiguous Allocation of Disk Space CSE 331 Operating Systems Design Fast Seq. Access Easy Random access. –External fragmentation –Files cannot grow.

Extent-Based Systems Some newer file systems (i.e. Veritas File System) use a modified contiguous allocation scheme. Extent-based file systems allocate disk blocks in extents. An extent is a contiguous block of disks. Extents are allocated for files. A file consists of one or more extents. CSE 331 Operating Systems Design

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

Linked Allocation CSE 331 Operating Systems Design

Linked Allocation (Cont.) Simple – need only starting address no waste of space for free space management Can grow files dynamically –Slow sequential access (seek time between blocks) –No random access –Unreliable CSE 331 Operating Systems Design

File-Allocation Table CSE 331 Operating Systems Design

Indexed Allocation Brings all pointers together into the index block. Logical view. index table CSE 331 Operating Systems Design

Example of Indexed Allocation CSE 331 Operating Systems Design

Indexed Allocation (Cont.) Random access is fast Easy grow without external fragmentation –Need index table. Overhead of index block. –Hard to grow files bigger than table size –Still lots of seeks CSE 331 Operating Systems Design

Indexed Allocation – Mapping (Cont.)  outer-index index table file CSE 331 Operating Systems Design

Combined Scheme: UNIX (4K bytes per block) CSE 331 Operating Systems Design 10 direct blocks 3 indirect blocks

Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  0  block[i] free 1  block[i] occupied CSE 331 Operating Systems Design

Free-Space Management (Cont.) Bit map requires extra space. Example: block size = 2 12 bytes disk size = 2 30 bytes (1 gigabyte) n = 2 30 /2 12 = 2 18 bits (or 32K bytes) Easy to get contiguous files Linked list (free list) – Cannot get contiguous space easily – No waste of space CSE 331 Operating Systems Design

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 CSE 331 Operating Systems Design

Linked Free Space List on Disk CSE 331 Operating Systems Design

Directory Structure A collection of nodes containing information about all files. (Pointers to file headers) F 1 F 2 F 3 F 4 F n Directory Files Both the directory structure and the files reside on disk. Backups of these two structures are kept. CSE 331 Operating Systems Design File headers

A Typical File-system Organization CSE 331 Operating Systems Design

Operations Performed on Device Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system CSE 331 Operating Systems Design

Organize the Directory (Logically) to Obtain Efficiency – locating a file quickly. Naming – convenient to users. – Two users can have same name for different files. – The same file can have several different names. Grouping – logical grouping of files by properties, (e.g., all Java programs, all games, …) CSE 331 Operating Systems Design

Single-Level Directory A single directory for all users. Naming problem Grouping problem CSE 331 Operating Systems Design

Two-Level Directory Separate directory for each user. Path name Can have the same file name for different user Efficient searching No grouping capability CSE 331 Operating Systems Design

Tree-Structured Directories CSE 331 Operating Systems Design

Tree-Structured Directories (Cont.) Efficient searching Grouping Capability Current directory (working directory) – cd /spell/mail/prog – type list CSE 331 Operating Systems Design

Tree-Structured Directories (Cont.) Absolute or relative path name Creating a new file is done in current directory. Delete a file rm Creating a new subdirectory is done in current directory. mkdir Example: if in current directory /mail mkdir count mail progcopyprtexpcount Deleting “mail”  deleting the entire subtree rooted by “mail”. CSE 331 Operating Systems Design

Where to put the Current “File Position” Field CSE 331 Operating Systems Design Address of the next byte to be read or written – i-node – Process table

CSE 331 Operating Systems Design

Efficiency and Performance Efficiency dependent on: – disk allocation and directory algorithms – types of data kept in file’s directory entry Performance – disk cache – separate section of main memory for frequently used blocks – free-behind and read-ahead – techniques to optimize sequential access – improve PC performance by dedicating section of memory as virtual disk, or RAM disk. CSE 331 Operating Systems Design