Introduction to Operating Systems

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Chapter 4 : File Systems What is a file system?
File Systems.
File Management. Persistent storage Shared device Why Programmers Need Files HTML Editor HTML Editor … … Web Browser Web Browser Structured information.
File System Interface CSCI 444/544 Operating Systems Fall 2008.
Chapter 11: File System Implementation
File Management Systems
File Systems. 2 Storing Information Applications can store it in the process address space Why is it a bad idea? –Size is limited to size of virtual address.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Ceng Operating Systems
6/24/2015B.RamamurthyPage 1 File System B. Ramamurthy.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
Chapter 12 File Management Systems
1 Course Outline Processes & Threads CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Networks, Protection and Security.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Storage Systems. Main Points File systems – Useful abstractions on top of physical devices Storage hardware characteristics – Disks and flash memory File.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Silberschatz, Galvin and Gagne  Operating System Concepts File Concept Contiguous logical address space Smallest user allocation Non-volatile.
File Systems Long-term Information Storage Store large amounts of information Information must survive the termination of the process using it Multiple.
Operating System Concepts and Techniques Lecture 17
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
File System Interface. File Concept Access Methods Directory Structure File-System Mounting File Sharing (skip)‏ File Protection.
File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation ( of textbook)
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
Operating Systems COMP 4850/CISG 5550 File Systems Files Dr. James Money.
Chapter 16 - File Systems –Persistent storage: storage that will continue to exist after a program that uses or creates it completes. –Sometimes called.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
CE Operating Systems Lecture 17 File systems – interface and implementation.
Slide 13-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter File Management.
File Systems. 2 What is a file? A repository for data Is long lasting (until explicitly deleted).
Operating Systems, Spring 2003 Local File Systems in UNIX Ittai Abraham Zinovi Rabinovich (recitation)
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
File Systems - Part I CS Introduction to Operating Systems.
Chapter 5 Record Storage and Primary File Organizations
W4118 Operating Systems Instructor: Junfeng Yang.
COT 4600 Operating Systems Spring 2011 Dan C. Marinescu Office: HEC 304 Office hours: Tu-Th 5:00 – 6:00 PM.
COMP 3500 Introduction to Operating Systems Directory Structures Block Management Dr. Xiao Qin Auburn University
Chapter 13: File-System Interface
Jonathan Walpole Computer Science Portland State University
Chapter 11: File System Implementation
FileSystems.
Introduction to Operating Systems
COMP 3500 Introduction to Operating Systems File Management
Filesystems.
Chapter 12: File System Implementation
Introduction to Operating Systems
EECE.4810/EECE.5730 Operating Systems
Chapter 11: File System Implementation
File Systems Kanwar Gill July 7, 2015.
EECE.4810/EECE.5730 Operating Systems
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Outline File Management Structured files
Introduction to Operating Systems
Secondary Storage Management Brian Bershad
Lecture 11: Flash Memory and File System Abstraction
Secondary Storage Management Hank Levy
Chapter 16 - File Systems Persistent storage: storage that will continue to exist after a program that uses or creates it completes. Sometimes called secondary.
File System Implementation
Department of Computer Science
Lecture 4: File-System Interface
Lecture Topics: 11/20 HW 7 What happens on a memory reference Traps
Chapter 5 File Systems -Compiled for MCA, PU
Lecture 26: File Systems CS April 29, 2019.
Introduction to Operating Systems
Presentation transcript:

Introduction to Operating Systems CPSC/ECE 3220 Fall 2019 Lecture Notes OSPP Chapter 11 (adapted by Mark Smotherman from Tom Anderson’s slides on OSPP web site)

Main Points File systems Files Directories File open/close Useful abstractions on top of physical devices Files Metadata, data, file type Directories File open/close UNIX file system API File system usage patterns

I/O System Layers

File Systems Abstraction on top of persistent storage Devices provide Magnetic disk Flash memory (e.g., USB thumb drive) Devices provide Storage that (usually) survives across machine crashes Block level (random) access Large capacity at low cost Relatively slow performance Magnetic disk read takes 10-20M processor instructions

Logical Record Blocking Application Reads/writes of logical records (can be 1 byte at a time) Buffer in memory to reduce the number of physical I/O ops Physical record buffer Reads/writes of physical records (blocks) (1000s of bytes at a time) Device Note: double-buffering allows processing to overlap transfer of next physical record

File System as Illusionist: Hide Limitations of Physical Storage Persistence of data stored in file system: Even if crash happens during an update Even if disk block becomes corrupted Even if flash memory wears out Controlled access to shared data Naming: Named data instead of disk block numbers Byte addressable data even though devices are block-oriented Directories instead of flat storage Performance: Data placement and data structure organization Cached data

File System Abstraction Persistent, named data Operating system crashes (and disk errors) leave file system in a valid state Access control on data File: named collection of data Linear sequence of bytes (or a set of sequences or records) Read/write or memory mapped Hierarchical organization (directories, subdirectories) Performance Achieve close to the hardware limit in the average case

Files Metadata owner, access permissions, timestamps (creation, last written), size, reference count, lock, etc. Data May be unstructured or structured: Stream of bytes (even if stored as blocks) Records are collections of related fields, often with a key field used for searching and sorting Alternate data streams (resource forks in Mac OS)

Identifying the File Type Extension identifier (.c, .o) Can be used to specify usage or structure OS can associate a specific application with an extension Magic number within file Identify usage or structure First four bytes for ELF file are: 177 E L F

Three File Types in UNIX Regular file Text (e.g., ASCII) Binary Directory Writes must be restricted to preserve structure Special file Maps physical I/O device to the file system

File Type Philosophies UNIX philosophy as stated by Ritchie and Thompson (inventors): “the structure of files is controlled by the programs that use them, not by the system” Alternate approach, e.g., IBM z/OS “An access method defines the technique that is used to store and retrieve data. Access methods have their own data set structures to organize data, macros to define and process data sets, and utility programs to process data sets.” Ex: Virtual Sequential Access Method (VSAM) Ex: Queued Sequential Access Method (QSAM)

Directories Directory Path Links Mount Group of named files or subdirectories Mapping from file name to file metadata location Path String that uniquely identifies file or directory Ex: /web/home/mark/public_html/3220.html Links Hard link: link from name to metadata location Soft link: link from name to alternate name Mount Mapping from name in one file system to root of another

OS/360 – top-level is user name Directory Levels System-wide Per-device Flat CP/M Two-level OS/360 – top-level is user name Tree-structured UNIX Windows

Path Names Absolute path Relative path Fully qualified Starts at root (“/” in Unix systems) Relative path Partially qualified, ex: public_html/3220.html Unqualified, ex: 3220.html Starts at current working directory . => this directory, .. => parent directory

Connection-Oriented Interface Explicit open and close operations for files OS creates an internal data structure on open Read and write ops use descriptor (a.k.a. handle or stream) to identify the internal data structure No need to reparse file name Per-open data structure contains: Access permission under which file was opened Location of file (e.g., inode number) Pointer to current byte or record for sequential access

UNIX Data Structures for Open Files per-process system-wide on disk Diagram from K. Thompson, “UNIX Implementation,” Bell System Tech. Jrnl., 1978

UNIX Data Structures for Open Files (2) copy inode info into kernel memory per-process system-wide Diagram from W. Richard Stevens, Chapter 3, “UNIX File I/O,” Advanced Programming in the UNIX® Environment, 2003

UNIX Data Structures for Open Files (3) Two processes open the same file – each has its own current file pointer (“offset”) Diagram from W. Richard Stevens, Chapter 3, “UNIX File I/O,” Advanced Programming in the UNIX® Environment, 2003

UNIX File System API create, link, unlink, createdir, rmdir Create file, link to file, remove link Create directory, remove directory open, close, read, write, seek Open/close a file for reading/writing Seek resets current position fsync File modifications can be cached fsync forces modifications to disk (like a memory barrier)

File System Workload File sizes Are most files small or large? Which accounts for more total storage: small or large files?

File System Workload File sizes Are most files small or large? Which accounts for more total storage: small or large files? LARGE

File System Workload File access Are most accesses to small or large files? Which accounts for more total I/O bytes: small or large files?

File System Workload File access Are most accesses to small or large files? SMALL Which accounts for more total I/O bytes: small or large files? LARGE

File System Workload How are files used? Most files are read/written sequentially Some files are read/written randomly Ex: database files, swap files Some files have a pre-defined size at creation Some files start small and grow over time Ex: program stdout, system logs

File System Design For small files: For large files: Small blocks for storage efficiency Concurrent ops more efficient than sequential Files used together should be stored together For large files: Storage efficient (large blocks) Contiguous allocation for sequential access Efficient lookup for random access May not know at file creation Whether file will become small or large Whether file is persistent or temporary Whether file will be used sequentially or randomly