Operating System: Chap10 File System Interface. National Tsing-Hua University 2016, Fall Semester

Similar documents
Part Four - Storage Management. Chapter 10: File-System Interface

Chapter 11: File-System Interface

Lecture 10 File Systems - Interface (chapter 10)

CS3600 SYSTEMS AND NETWORKS

Chapter 7: File-System

Chapter 9: File System Interface

File Concept Access Methods Directory and Disk Structure File-System Mounting File Sharing Protection

Chapter 11: File-System Interface

Chapter 10: File System. Operating System Concepts 9 th Edition

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

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

Chapter 11: File-System Interface. Operating System Concepts 9 th Edition

Chapter 11: File-System Interface

Chapter 10: File-System Interface. Operating System Concepts 8 th Edition

Chapter 10: File System

Chapter 10: File-System Interface

Chapter 10: File-System Interface. Operating System Concepts with Java 8 th Edition

Chapter 10: File-System Interface

Chapter 11: File-System Interface. File Concept. File Structure

Chapter 10: File-System Interface

Chapter 11: File-System Interface. File Concept. File Structure

Chapter 11: File System Interface

I.-C. Lin, Assistant Professor. Textbook: Operating System Concepts 8ed CHAPTER 10: FILE SYSTEM

Chapter 11: File-System Interface

Chapter 11: File-System Interface. Long-term Information Storage. File Structure. File Structure. File Concept. File Attributes

Chapter 11: File-System Interface

CSE325 Principles of Operating Systems. File Systems. David P. Duggan. March 21, 2013

File Systems: Interface and Implementation

File Systems: Interface and Implementation

CS720 - Operating Systems

Chapter 6 Storage Management File-System Interface 11.1

DATA STRUCTURES USING C

File Systems: Interface and Implementation

UNIT V SECONDARY STORAGE MANAGEMENT

File System: Interface and Implmentation

CMSC421: Principles of Operating Systems

Virtual Memory cont d.; File System Interface. 03/30/2007 CSCI 315 Operating Systems Design 1

File-System Interface

F 4. Both the directory structure and the files reside on disk Backups of these two structures are kept on tapes

Chapter 11: File System Interface Capítulo 10 no livro adotado!

File Systems. CS 4410 Operating Systems

File Management By : Kaushik Vaghani

File-System Interface. File Structure. File Concept. File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection

Files and File Systems

There is a general need for long-term and shared data storage: Files meet these requirements The file manager or file system within the OS

Principles of Operating Systems

A file system is a clearly-defined method that the computer's operating system uses to store, catalog, and retrieve files.

TDDB68 Concurrent Programming and Operating Systems. Lecture: File systems

ICS Principles of Operating Systems

Chapter 11: File System Implementation. Objectives

V. File System. SGG9: chapter 11. Files, directories, sharing FS layers, partitions, allocations, free space. TDIU11: Operating Systems

CS370 Operating Systems

Operating Systems: Lecture 12. File-System Interface and Implementation

Storage, part 1. Michael Brockway. November 3, 2015

Advanced Operating Systems. File Systems Lecture 9

File Systems. CS170 Fall 2018

CHAPTER 10 AND 11 - FILE SYSTEM & IMPLEMENTING FILE- SYSTEMS

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

File System Interface: Overview. Objective. File Concept UNIT-IV FILE SYSTEMS

File System (FS) Highlights

File-System. File Concept. File Types Name, Extension. File Attributes. File Operations. Access Methods. CS307 Operating Systems

Outlook. File-System Interface Allocation-Methods Free Space Management

Modulo V Sistema de Arquivos

CS370 Operating Systems

Thanks for the feedback! Chapter 8: Filesystem Implementation. File system operations. Acyclic-Graph Directories. General Graph Directory

File System Management

Chapter 8: Filesystem Implementation

What is a file system

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

CMSC421: Principles of Operating Systems

Operating Systems. Designed and Presented by Dr. Ayman Elshenawy Elsefy

Operating Systems. No. 9 ศร ณย อ นทโกส ม Sarun Intakosum

Chapter 11: File-System Interface

File Systems. CSE 2431: Introduction to Operating Systems Reading: Chap. 11, , 18.7, [OSC]

File System & Device Drive Mass Storage. File Attributes (Meta Data) File Operations. Directory Structure. Operations Performed on Directory

Chapter 11: Implementing File Systems

Sharing may be done through a protection scheme. Network File System (NFS) is a common distributed file-sharing method

Frequently asked questions from the previous class survey

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

File Layout and Directories

412 Notes: Filesystem

CSC 453 Operating Systems

File Systems. What do we need to know?

Announcements. is due Monday April 1 needs to include a paragraph write-up about the results of using the two different scheduling algorithms

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

Filesystem. Disclaimer: some slides are adopted from book authors slides with permission 1

Da-Wei Chang CSIE.NCKU. Professor Hao-Ren Ke, National Chiao Tung University Professor Hsung-Pin Chang, National Chung Hsing University

OPERATING SYSTEM. Chapter 12: File System Implementation

ELEC 377 Operating Systems. Week 8 Class 1

Chapter 11: Implementing File Systems

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

Files & I/O. Today. Comp 104: Operating Systems Concepts. Operating System An Abstract View. Files and Filestore Allocation

EI 338: Computer Systems Engineering (Operating Systems & Computer Architecture)

Fall 2017 :: CSE 306. File Systems Basics. Nima Honarmand

MODULE 4. FILE SYSTEM AND SECONDARY STORAGE

File System Interface. ICS332 Operating Systems

Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple proces

Project 3: An Introduction to File Systems. COP4610 Florida State University

Operating System: Chap13 I/O Systems. National Tsing-Hua University 2016, Fall Semester

Transcription:

Operating System: Chap10 File System Interface National Tsing-Hua University 2016, Fall Semester

Overview File Concept Access Methods Directory Structure File System Mounting File Sharing Protection Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 2

File Concept File: a logical storage unit created by OS v.s. physical storage unit in disk (sector, track) File attributes Identifier: non-human-readable name Name Type Location Size Protection Last-access time, Last-updated time sector track platter Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 3

File Operations File operations include Creating a file Writing a file Reading a file Repositioning within a file (i.e. file seek) Deleting a file Truncating a file Process: open-file table OS: system-wide table Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 4

Open-File Tables Per-process table Tracking all files opened by this process Current file pointer for each opened file Access rights and accounting information System-wide table Each entry in the per-process table points to this table Process-independent information such as disk location, access dates, file size Open count P1 PCB files P2 PCB files Open-file table a.txt b.txt z.txt Open-file table a.txt c.txt f.txt System open-file table a.txt b.txt c.txt f.txt z.txt Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 5

Open File Attributes Open-file attributes (metadata) File pointer (per-process) File open count (system table) Disk location (system table) Access rights (per-process) File types.exe,.com,.obj,.cc,.mov, etc Hint for OS to operate file in a reasonable way Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 6

Access Method Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 7

Access Methods Sequential access Read/write next (block) Reset: repositioning the file pointer to the beginning Skip/rewind n records Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 8

Access Methods Direct (relative) access Access an element at an arbitrary position in a sequence File operations include the block # as parameter Often use random access to refer the access pattern from direct access Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 9

Index Access Methods Index: contains pointers to blocks of a file To find a record in a file: search the index file find the pointer use the pointer to directly access the record With a large file index could become too large Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 10

Review Slides ( I ) File vs. Sector, Track Open-file (in-memory) attributes Per-process, system-wide? File-access methods? Sequential access Direct access Index access Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 11

Directory Structure Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 12

Partition, Volume & Directory A partition (formatted or raw) raw partition (no file system): UNIX swap space, database Formatted partition with file system is called volume a partition can be a portion of a disk or group of multiple disks (distributed file system) Some storage devices (e.g.: floppy disk) does not and cannot have partition Directories are used by file system to store the information about the files in the partition Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 13

File-System Organization Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 14

Directory vs. File Directory: A collection of nodes containing information about all files Both the directory structure and the files reside on disk Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 15

Directory Operations Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 16

Single-Level Directory All files in one directory Filename has to be unique Poor efficiency in locating a file as number of files increases Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 17

Two-Level Directory a separate dir for each user path = user name + file name single-level dir problems still exists per user Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 18

Tree-Structured Directory Absolute path: starting from the root Relative path: starting from a directory current prt/first or /spell/mail/prt/first Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 19

Acyclic-Graph Directory Use links to share files or directories UNIX-like: symbolic link (ln -s /spell/count /dict/count) A file can have multiple absolute paths When does a file actually get deleted? deleting the link but not the file deleting the file but leaves the link dangling pointer deleting the file when reference counters is 0 Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 20

General-Graph Directory Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 21

General-Graph Directory May contain cycles Reference count does not work any more E.g. self-referencing file How can we deal with cycles? Garbage collection home First pass traverses the entire graph and marks accessible files or directories Second pass collect and free everything that is un-marked Poor performance on millions of files Use cycle-detection algorithm when a link is created Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 22 g1 / t1 g2 bin

Review Slides ( II ) Directory structure: pros & cons One-level directory Two-level directory Tree-structured directory Acyclic-graph directory General-graph directory Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 23

File-System Mounting & File Sharing Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 24

File System Mounting A file system must be mounted before it can be accessed Mount point: the root path that a FS will be mounted to Mount timing: boot time automatically at run-time manually at run-time Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 25

File System Mounting Example local / Partition B usr home Partition C jane john Partition A games /home/john/games Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 26

usr \ Linux command: mount -t type device dir mount t ext2 /dev/sda0 /mnt local mnt Mount Table students... home...... P2 P3 P4 usr home mnt P1 P2 P3 Root Info local Root Info students m usr m home m mnt Root Info local node file 1 node file 2 node.. students node file 1 node file 2 node.. Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 27

File Sharing on Multiple Users Each user: (userid, groupid) ID is associated with every ops/process/thread the user issues Each file has 3 sets of attributes owner, group, others Owner attributes describe the privileges for the owner of the file same for group/others attributes group/others attributes are set by owner or root Owner group1 Other users Group user group2 group3 Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 28

Access-Control List We can create an access-control list (ACL) for each user check requested file access against ACL problem: unlimited # of users 3 classes of users 3 ACL (RWX) for each file owner (e.g. 7 = RWX = 111) group (e.g. 6 = RWX = 110) public (others) (e.g. 4 = RWX = 100) chmod 664 intro.ps Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 29

File Protection File owner/creator should be able to control what can be done by whom Access control list (ACL) Files should be kept from physical damage (reliability): i.e. RAID improper access (protection): i.e. password Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 30

Review Slides ( III ) File system mounting point, timing? Access-control list? How does it function? Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 31

Reading Material & HW Chap 10 Problems 10.1: Consider a file system where a file can be deleted and its disk space reclaimed while links to that file still exist. What problems may occur if a new file is created in the same storage area or with the same absolute path name? How can these problems be avoided? 10.4: Provide examples of applications that typically access files according to sequential and random. 10.6: If the operating system knew that a certain application was going to access file data in a sequential manner, how could it exploit this information to improve performance? Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 32

Consistency Semantics When files are shared, ops from different users to the same file must be synchronized UNIX semantics write is visible to all other users opening the same file Open-file option: share the same file pointer Session semantics (AFS file system) write is not visible to all other users once a file is closed, changes are visible for sessions starting later current sessions do not see changes Immutable-Shared-Files semantics once a file is declared shared, it cannot be modified Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 33

File Sharing on Remote File Systems Uses networking to allow file system access between systems Manually via programs like FTP Semi automatically via the world wide web Automatically, seamlessly using distributed file systems Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 34

Client-server model Allows clients to mount remote file systems from servers Sever: the machine that owns the files and serves multiple clients Client: the machine that accesses remote files Standard OS file calls are translated into remote calls Client and user-on-client identification is insecure or complicated Example: NFS (network file sysytem) for UNIX CIFS (common interface file system) for Windows Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 35

Distributed Information Systems Distributed naming services Provide unified access to the info for remote computing DIS: DNS (Domain Name System) NIS (Network Info Service) Client side Server side Frontend nodes Clusters/ Datacenters Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 36

Failure Modes Failures: HW: disk, network cable, switch, server, etc. SW: corruption or inconsistency of file, directory structure, etc. We need to recover: Data: files, directory contents Metadata: data and system management info. Stateful vs. Stateless communication protocol: Stateless: treats each request as an independent transaction that is unrelated to any previous request (HTTP) Stateful: info. maintained on both client and server is required Chapter10 FS Interface Operating System Concepts NTHU LSA Lab 37