10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System 10.1 File Concept 10.2 Access Methods 10.3 Directory Structure.

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.
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 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
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.
11.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Chapter 10: File System.
04/02/2004CSCI 315 Operating Systems Design1 File System Interface.
File-System Interface CS 3100 File-System Interface1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Chapter 10: File-System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
Chapter 10: File-System Interface
1 Chapter 10: File- System Interface. 2 File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection.
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System Objectives To discuss file-system design tradeoffs, including.
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 10: File-System.
Chapter 10: File-System 10.1 File Concept 10.2 Access Methods
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
Chapter 10 File System Interface
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 10 Operating Systems.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Chap 10 File-System Interface. Objectives To explain the function of file systems To describe the interfaces to file systems To discuss file-system design.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 AE4B33OSS Chapter 10: File-System Interface File Concept Access Methods Directory.
11.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
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.
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.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
XE33OSA Chapter 10: File-System Interface. 10.2XE33OSA Silberschatz, Galvin and Gagne ©2005 Chapter 10: File-System Interface File Concept Access Methods.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition 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.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 11: File-System Interface.
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 and Galvin  Operating System Concepts Module 10: File-System Interface File Concept Access :Methods Directory Structure Protection.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 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.
Chapter 10: File-System Interface Hung Q. Ngo KyungHee University Spring 2009
Chapter 10: File-System Interface. 10.2CSCI Operating Systems Chapter 10: File-System Interface File Concept Access Methods Directory Structure.
Chapter 10: File-System Interface File Concept Contiguous logical address space Types: Data  numeric  character  binary Program.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
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.
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 Adapted to COP4610 by Robert van Engelen.
10.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 10: File-System Interface.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 11: File-System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems File System Interface.
CSE Operating System Principles File Systems.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
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.
Lecture 9 : chapter 9 and 10 file system
Unit V File-System.
Operating System File System Monday, August 11, 2008.
Chapter 10: File System.
Chapter 10: File-System Interface
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Presentation transcript:

10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System 10.1 File Concept 10.2 Access Methods 10.3 Directory Structure 10.4 File-System Mounting 10.5 File Sharing 10.6 Protection

10.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Objectives To explain the function of file systems To describe the interfaces to file systems To discuss file-system design tradeoffs, including access methods, file sharing, file locking, and directory structures To discuss the semantics of sharing files among multiple processes, users, and computers To explore file-system protection

10.3 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 10.1 File Concept The operating system abstracts from the physical properties of its storage to define a logical storage unit, the file. Files are mapped by the OS onto physical, usually nonvolatile, devices. Use Ultra-Editor to examine contents of a file File types: Data, free form or formatted  numeric  character  binary Program  source  object

10.4 Silberschatz, Galvin and Gagne ©2005 Operating System Principles File Structure None - sequence of words, bytes Simple record structure Lines and Pages Fixed length Variable length Complex Structures Formatted document Relocatable load file Executable Who decides: Operating system Program

10.5 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 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 file types Location – pointer to the 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 secondary storage, like a disk

10.6 Silberschatz, Galvin and Gagne ©2005 Operating System Principles File Operations File is an abstract data type with the following basic operations create write  The system must keep a writer pointer. File info in the directory also updated read  The system must keep a read pointer. reposition within file (known as file seek) delete truncate Other operations append, rename, copy, get/set file attributes

10.7 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Open and Close Files Most file operations involve searching the directory for a file 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 The OS normally maintains two-level open-file tables, per-process and system-wide

10.8 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Open and Close 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: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it Disk location of the file: cache of data access information Access rights: per-process access mode information

10.9 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Open File Locking Provided by some operating systems and file systems Mediates access to a file, like process synchronization shared lock and exclusive lock Mandatory or advisory: Mandatory – access is denied depending on locks held and requested (Windows) Advisory – processes can find status of locks and decide what to do (Unix)

10.10 Silberschatz, Galvin and Gagne ©2005 Operating System Principles File Locking Example – Java API import java.io.*; import java.nio.channels.*; public class LockingExample { public static final boolean EXCLUSIVE = false; public static final boolean SHARED = true; public static void main(String arsg[]) throws IOException { FileLock sharedLock = null; FileLock exclusiveLock = null; try { RandomAccessFile raf = new RandomAccessFile("file.txt", "rw"); // get the channel for the file FileChannel ch = raf.getChannel(); // this locks the first half of the file - exclusive exclusiveLock = ch.lock(0, raf.length()/2, EXCLUSIVE); /** Now modify the data... */ // release the lock exclusiveLock.release();

10.11 Silberschatz, Galvin and Gagne ©2005 Operating System Principles File Locking Example – Java API (cont) // this locks the second half of the file - shared sharedLock = ch.lock(raf.length()/2+1, raf.length(), SHARED); /** Now read the data... */ // release the lock sharedLock.release(); } catch (java.io.IOException ioe) { System.err.println(ioe); }finally { if (exclusiveLock != null) exclusiveLock.release(); if (sharedLock != null) sharedLock.release(); }

10.12 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Common File Types Skip: p.365 第 2 段及第 3 段 Skip: , Unix: use magic number to indicate roughly file types

10.13 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 10.2 Access Methods Sequential Access (based on tape model) read next write next reset to the beginning no read after last write Direct Access (or relative access) read n write n position to n read next write next rewrite n (n = relative block number)

10.14 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Simulation of sequential access on a direct-access file Some systems support only one of sequential access and direct access for files. Simulation of direct access on a sequential-access file is inefficient and clumsy

10.15 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Example of Index and Relative Files Other Access Methods

10.16 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 10.3 Directory Structure A disk may have several partitions. A partition may be with a file system. Several partitions, maybe from many disks, could form a volume that holds a file system. A collection of nodes containing information about all files 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 on tapes

10.17 Silberschatz, Galvin and Gagne ©2005 Operating System Principles A Typical File-system Organization

10.18 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Operations Performed on Directory Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system for backup (to tape)

10.19 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 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, …

10.20 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Single-Level Directory A single directory for all users Naming problem Grouping problem

10.21 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Two-Level Directory Separate directory for each user Can have the same file name for different user Isolation or Allow access to other’s files? If allowed, then use path name Efficient searching Use environment variable: search path No grouping capability

10.22 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Tree-Structured Directories

10.23 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Tree-Structured Directories Efficient searching Grouping Capability Current directory (working directory) cd /spell/mail/prog type list Absolute or relative path name Creating a new file is done in current directory Delete a file rm Delete a directory MS-DOS will not delete a directory unless it is empty Unix provides an option to delete all files and sub-directories under a directory

10.24 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Tree-Structured Directories Creating a new subdirectory is done in current directory mkdir Example: if current directory is /mail mkdir count mail progcopyprtexpcount In Unix “rm –f mail”  deleting the entire subtree rooted by “mail”

10.25 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Acyclic-Graph Directories Use link to have shared subdirectories and files Another approach: duplicate all information about subdirectories and files in both sharing directories. But it is hard to maintain consistency when a shared file is modified.

10.26 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Acyclic-Graph Directories New directory entry type Link – another name (pointer) to an existing file Resolve the link – follow pointer to locate the file Two different names (aliasing) A file could have multiple absolute path names. Traverse problem. If dict deletes all  dangling pointer. Solutions: Just wait for users to find out. It is used with symbolic links: Preserve the file until all references to it are deleted. Unix uses this approach for hard links by keeping a reference count in the file information block. Acyclic-graph could be maintained by prohibiting multiple references to directories SKIP: