File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Chapter 10: File-System Interface
Chapter 11: File System Implementation
File System Implementation
File System Implementation
Chapter 11: Implementing File Systems
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.
04/05/2004CSCI 315 Operating Systems Design1 File System Implementation.
File System Implementation
04/07/2010CSCI 315 Operating Systems Design1 File System Implementation.
File Concept §Contiguous logical address space §Types: l Data: Numeric Character Binary l Program.
Dr. Kalpakis CMSC 421, Operating Systems File System Implementation.
ICS Principles of Operating Systems Lectures 14 and 15 - FileSystem Interface and Implementation Prof. Nalini Venkatasubramanian
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Chapter 11: File System Implementation Hung Q. Ngo KyungHee University Spring 2009
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 11: File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
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.
Free Space Management.
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.
XE33OSA Chapter 11: File System Implementation. 11.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 11: File System Implementation Chapter 11: File.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: 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.
Ridge Xu 12.1 Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation Directory Implementation.
Chapter 11: Implementing File Systems Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 11: Implementing File Systems Chapter.
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.
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.
Operating Systems CMPSC 473 I/O Management (3) December 07, Lecture 24 Instructor: Bhuvan Urgaonkar.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 11: File System Implementation Chapter.
Fall 2000M.B. Ibáñez Lecture 24 File-System III File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 11-1: File Systems Implementation Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
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.
ICS Principles of Operating Systems Lectures 14 and 15 - FileSystem Interface and Implementation Prof. Nalini Venkatasubramanian
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
File System Implementation
Chapter 12: File System Implementation
File-System Implementation
Chapter 11: File System Implementation
File System Implementation
Chapter 11: File System Implementation
Chapter 11: File System Implementation
Chapter 11: File System Implementation
Outline Allocation Free space management Memory mapped files
Overview: File system implementation (cont)
File-System Structure
Chapter 14: File-System Implementation
Chapter 11: File System Implementation
File System Implementation
Presentation transcript:

File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File system organized into layers. §File control block – storage structure consisting of information about a file.

File System Mounting §A file system must be mounted before it is available to use. l The OS is given the name of the device and the location within the file structure at which to attach the file system. l The OS verifies that the device contains a valid file system. l The OS notes in its directory structure that a file system is mounted at the specified mount point.

Allocation Methods §Three major methods of allocating disk space are in wide use: l Contiguous l Linked l Indexed

Contiguous Allocation §Each file occupies a set of contiguous blocks on the disk. §Simple – only the starting location (block #) and its length (number of blocks) are required. §Random access is fairly easy. §Wasteful of space (dynamic storage allocation problem).

Contiguous Allocation (cont) §Files cannot grow. §Mapping from logical to physical. l Block to be accessed = Q + starting address l Displacement into block = R LA/512 Q R

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

Linked Allocation (cont) §Allocate as needed, link together; e.g., file starts at block 9

Linked Allocation (cont) §Simple – needs only a starting address. §Free space management system – no waste of space. §No random access.

Linked Allocation (cont) §Mapping l Block to be accessed is the Qth block in the linked list of blocks representing the file. l Displacement into block = R + 1 §File allocation table (FAT) – disk space allocation used by MSDOS and OS/2 l Contains one entry for each disk block. l Use much like the linked list; contains pointers. LA/511 Q R

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

Example of Indexed Allocation

Indexed Allocation (cont) §Need index table. §Random access is possible. §Dynamic access without external fragmentation, but have overhead of index block.

Indexed Allocation (cont) §Mapping from logical to physical in a file of maximum size of 256K words and block size of 512 words. We need only 1 block for index table. l Q = displacement into index table l R = displacement into block LA/512 Q R

Indexed Allocation – Mapping §Mapping from logical to physical in a file of unbounded length (block size of 512 words). §Linked scheme – Link blocks of index table (no limit on size).

Indexed Allocation – Mapping (cont) l Q 1 = block of index table l R 1 is used as follows: l Q 2 = displacement into block of index table l R 2 = displacement into block of file LA / (512 x 511) Q1Q1 R1R1 R 1 / 512 Q2Q2 R2R2

Indexed Allocation – Mapping (cont) §Two-level index (maximum file size is ) l Q 1 = displacement into outer index l R 1 is used as follows: l Q 2 = displacement into block of index table l R 2 = displacement into block of file LA / (512 x 512) Q1Q1 R1R1 R 1 / 512 Q2Q2 R2R2

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

Combined Scheme: UNIX (4K bytes per block)

Free Space Management §Bit vector (n blocks) §Block number calculation … 012n-1 bit[i] = 0  block[i] free 1  block[i] occupied (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 = 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

Free Space Management (cont) §Linked list (free list) l Cannot get contiguous space easily. l No waste of space. §Grouping l Store the addresses of n free blocks into the first free block. §Counting l Maintain address of block and the number of contiguous blocks that are free.

Free Space Management (cont) §Need to protect: l Pointer to free list l 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. l Solution: Set bit[i] = 1 in disk. Allocate block[i] Set bit[i] = 1 in memory

Directory Implementation §Linear list of file names with pointer to the data blocks. l Simple to program. l Time-consuming to execute. §Hash Table – linear list with hash data structure. l Decreases directory search time. l Collisions – situations where two file names hash to the same location. l Fixed size of hash table is a problem.

Efficiency and Performance §Efficiency dependent on: l Disk allocation and directory algorithms. l Types of data kept in file’s directory entry. §Performance l Disk cache – separate section of main memory for frequently used blocks. l Free-behind and read-ahead – techniques to optimize sequential access. l Improve PC performance by dedicating section of memory as virtual disk, or RAM disk.

Various Disk-Caching Locations

Recovery §Consistency checker – compares data in directory structure with data blocks on disk and tries to fix inconsistencies. §Use system programs to back up data from disk to another storage device (floppy disk, magnetic tape). §Recover lost file or disk by restoring data from backup.