CHAPTER 11: FILE-SYSTEM INTERFACE File Concept File Concept File Access File Access Directory Structure Directory Structure File System Mounting File System.

Slides:



Advertisements
Similar presentations
File-System Interface
Advertisements

Chapter 10: File-System Interface
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.
1 File Management (a). 2 File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection.
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.
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 File-System Interface.
04/05/2010CSCI 315 Operating Systems Design1 Virtual Memory Wrap-up; File System Interface.
Chapter 10: File-System Interface
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  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
A. Frank - P. Weisberg Operating Systems File-System Interface.
File Concept l Contiguous logical address space l Types: Data: numeric, character, binary Program: source, object (load image) Documents.
Os111 Chapter 11 File-System Interface. os112 Outline File Concept Access Methods Directory Structure File System Mounting File Sharing Protection.
03/30/2007CSCI 315 Operating Systems Design1 Virtual Memory cont’d.; File System Interface.
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
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 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.
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
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.
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.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
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.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
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.
CENG334 Introduction to Operating Systems Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL:
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.
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 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems.
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10: File-System Interface.
Module 10: File-System Interface
Chapter 11: File-System Interface
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
Module 10: File-System Interface
Lecture 4: File-System Interface
Presentation transcript:

CHAPTER 11: FILE-SYSTEM INTERFACE File Concept File Concept File Access File Access Directory Structure Directory Structure File System Mounting File System Mounting File Sharing File Sharing File Protection File Protection

FILE CONCEPT Introduction Introduction File attributes File attributes File types File types File structures File structures File operations File operations

File concept What is a file What is a file  A file is named collection of related information that is recorded on secondary storage. Content types: Content types:  Data  numeric  alphabetic  alphanumeric  binary  Program  source programs  Object forms

File concept: Attributes File attributes Name: The symbolic file name in human-readable form Name: The symbolic file name in human-readable form Identifier: to identify the file within the file system (Internal) Identifier: to identify the file within the file system (Internal) Type: to support different types. Type: to support different types. Location: the location on the secondary storage device. Location: the location on the secondary storage device. Size: the current size (and/or its maximum size) Size: the current size (and/or its maximum size) Protection: who can do reading, writing, executing, and so on. Protection: who can do reading, writing, executing, and so on. Time, date, and user identification: This information may be kept for creation, last modification, and usage monitoring. Time, date, and user identification: This information may be kept for creation, last modification, and usage monitoring. Typically, the directory entry consists of the file ’ s name and its unique identifier. The identifier in turn locates the other file attributes. One of the file attributes is the location of file.

File concept : Types If an OS recognizes the type of a file, it can then operate on the file in reasonable ways. If an OS recognizes the type of a file, it can then operate on the file in reasonable ways. Some common file types (See the next slide) Some common file types (See the next slide) The TOPS-20 OS: If the user tries to execute an object program whose source file has been modified (or edited) since the object file was produced, the source file will be recompiled automatically. The TOPS-20 OS: If the user tries to execute an object program whose source file has been modified (or edited) since the object file was produced, the source file will be recompiled automatically. The Apple Macintosh OS: Each file has a type and also has a creator attribute containing the name of the program that created it. The Apple Macintosh OS: Each file has a type and also has a creator attribute containing the name of the program that created it. The Linux: File types are just hints. How to determine a file type on the Linux. The Linux: File types are just hints. How to determine a file type on the Linux.

File concept: Types

File concept: Structure File structures File structures  None - sequence of words, bytes  Simple record structure  Lines, Fixed length, Variable length  Complex Structures  Formatted document  Relocatable load file  Can be implemented by inserting appropriate control characters. Who decides: Operating system and Program Who decides: Operating system and Program Conclusion: Too few structures make programming inconvenient, whereas too many cause OS bloat and programmer confusion. Conclusion: Too few structures make programming inconvenient, whereas too many cause OS bloat and programmer confusion.

File concept: Operations Create: to allocate the file space and allocate the directory entry Create: to allocate the file space and allocate the directory entry Read/Write/Seek: to find the directory entry and keep a read/write pointer or seek to a new position. Read/Write/Seek: to find the directory entry and keep a read/write pointer or seek to a new position. Delete: to find the directory entry and release all file space and erase the directory entry Delete: to find the directory entry and release all file space and erase the directory entry Truncate: to find the directory entry and release some file space Truncate: to find the directory entry and release some file space Open(F) – to search the directory structure on disk for entry F, and copy the directory entry into the open-file table and allocate a file descriptor. Open(F) – to search the directory structure on disk for entry F, and copy the directory entry into the open-file table and allocate a file descriptor. Close (F) – to copy the directory entry in the open-file table to the directory structure on disk and free the file descriptor Close (F) – to copy the directory entry in the open-file table to the directory structure on disk and free the file descriptor

File concept: Operations File tables File tables  Single user: Per-process file table  secondary storage  Multiple-users: Per-process file table  system- wide table  secondary storage  Several pieces of information are associated with an open file File pointerFile pointer File open countFile open count Disk location of the fileDisk location of the file Access rightsAccess rights

FILE ACCESS Sequential Access Sequential Access read next write next reset Direct Access Direct Access read n write/rewrite n position to n read next write next n = relative block number To simulate sequential access by direct access is easy To simulate sequential access by direct access is easy (To simulate direct access by sequential access is NOT easy) (To simulate direct access by sequential access is NOT easy)

File access: Sequential-access

File access: Direct-access

File access: Other access Index file Index file Master index Master index  index file  file data (ISAM: Indexed Sequential-Access Method from IBM)

File access: Other access

DIRECTORY STRUCTURE Disks  partitions/minidisks/volumes  FS  Directories  Files Disks  partitions/minidisks/volumes  FS  Directories  Files The directory is used to organize files (and directories) The directory is used to organize files (and directories) The directory can be viewed as a symbol table that translates file names into their directory entries. The directory can be viewed as a symbol table that translates file names into their directory entries. The operations on directories The operations on directories  Search a file  Create a file  Delete a file  List a directory  Rename a file  Traverse the file system

Directory structure A Typical File-system Organization

Directory structure: Criteria Efficiency – locating a file quickly. Efficiency – locating a file quickly. Naming – convenient to users. 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 Grouping – logical grouping of files by properties  all Java programs  all games  …

Directory structures Single-level directory Single-level directory Two-level directory Two-level directory Tree-structured directory Tree-structured directory Acyclic graph directory Acyclic graph directory General graph directory General graph directory

Directory structure: Single-Level Directory A single directory for all users. A single directory for all users. Naming problem Grouping problem

Directory structure: Two-Level Directory Separate directory for each user. Separate directory for each user.   MFD/UFD/FileName (Path name)   Can have the same file name for different user   Efficient searching   No grouping capability

Directory structure: Tree-Structured Directories

Efficient searching Efficient searching Grouping Capability Grouping Capability Current directory (working directory) Current directory (working directory)  cd /spell/mail/prog  type list Absolute or relative path name Absolute or relative path name Creating a new file is done in current directory. Creating a new file is done in current directory. Delete a file Delete a file rm rm Creating a new subdirectory is done in current directory. Creating a new subdirectory is done in current directory. mkdir mkdir Example: if in current directory /mail mkdir count

Directory structure: Acyclic-graph directories

Tree-structured directory + sharing  Acyclic-Graph Directories Tree-structured directory + sharing  Acyclic-Graph Directories Linux ln: Linux ln:  hard link  soft link Potential problems Potential problems  To traverse the FS  To delete a file (for symbolic link and hard link)

Directory structure: General graph directory

Potential problems Potential problems  To traverse the FS (maybe looping forever)  To determine when a file can be deleted.  Garbage collection

FILE SYSTEM MOUNTING A file system must be mounted before it can be accessed. A file system must be mounted before it can be accessed. A unmounted file system (I.e. Fig (b)) is mounted at a mount point. A unmounted file system (I.e. Fig (b)) is mounted at a mount point.

(a) Existing. (b) Unmounted Partition

File System Mounting /etc/fstab /etc/fstab 1. Device 2. Mount point 3. File system type 4. Mount options 5. For dump 6. For fsck  Mount/umount, swapon/swapoff  /proc

FILE SHARING For multi-user OS For multi-user OS  Sharing of files on multi-user systems is desirable.  Sharing may be done through a protection scheme. File sharing over the network File sharing over the network  FTP  WWW  NFS

File Sharing: Remote file systems The C/S Model The C/S Model  The server:  To declare that a resource is available to clients  To specify exactly which resource and exactly which clients.  The client:  To access the remote files.  The protocol:  Authentication  Operations.

File Sharing: Remote file systems How to use NFS How to use NFS  Startup nfs  /etc/rc.d/init.d/nfs  setup or ntsysv  /etc/exports  Mount NFS  mount server_machine:/exported_fs mount_point  /etc/fstab

File Sharing: Remote file systems Distributed Information Systems Distributed Information Systems  To provide a unified access to the information needed for remote computing.  DNS: domain name to IP address  Yellow pages: to centralize storage of user name, hostnames, printer information, and the like.  Yellow pages  NIS  NIS+ (Sun Microsystems)  Domains  Active directory (Microsoft)   LDAP (Lightweight directory-access protocol)

File Sharing: Remote file systems Failure Modes Failure Modes  For one machine, to use RAID (Redundant Arrays of Inexpensive Disks) to prevent data loss  For networked machines,  Stateful mode: Too many problems can cause operation to fail.Too many problems can cause operation to fail. not good enough.not good enough.  Stateless The protocol carries all the information needed to locate the appropriate file and perform the requested operation on a file.The protocol carries all the information needed to locate the appropriate file and perform the requested operation on a file.

File Sharing : Consistency semantics Consistency semantics: Consistency semantics:  specifies the the semantics of multiple users accessing a shared file simultaneously.  In particular, these semantics should specify when modifications of data by one user are observable by other users. UNIX semantics UNIX semantics  Writes to an open file by a user are visible immediately to other users that have this file open at the same time  One mode of sharing allows users to share the pointer of current location into the file

File Sharing : Consistency semantics AFS (Andrew File System) Semantics AFS (Andrew File System) Semantics  Writes to an open file by a user are not visible immediately to other users that have the same file open simultaneously.  Once a file is closed, the changes made to it are visible only in sessions starting later. Already open instances of the file do not reflect these changes. Immutable-shared file semantics Immutable-shared file semantics  Once a file is declared as shared by its creator, it cannot be modified.  An immutable file has two key properties. Its name may not be reused and its contents may not be altered.

FILE PROTECTION File owner/creator should be able to control: File owner/creator should be able to control:  what can be done  by whom  No access  some controlled access  full access Types of access Types of access  Read  Write  Execute  Append  Delete  List

File protection Access control lists Access control lists Mode of access: read, write, execute Mode of access: read, write, execute Three classes of users Three classes of usersRWX a) owner access 7  RWX b) group access 6  RWX c) public access1  Ask manager to create a group (unique name), say G, and add some users to the group. Ask manager to create a group (unique name), say G, and add some users to the group. For a particular file (say game) or subdirectory, define an appropriate access. For a particular file (say game) or subdirectory, define an appropriate access.

File protection Chmod Chmod Find Find Ls, cd, mkdir, cat, more, less, cmp, diff, sort, merge, tee, touch, Ls, cd, mkdir, cat, more, less, cmp, diff, sort, merge, tee, touch,

Homework 3, 6, 7, 10, 11 3, 6, 7, 10, 11