CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

File Management.
Chapter 4 : File Systems What is a file system?
File Management.
File Systems.
Allocation Methods - Contiguous
Chapter 10: File-System Interface
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.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
File Management Systems
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
CS 104 Introduction to Computer Science and Graphics Problems
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
1 File Management in Representative Operating Systems.
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
Operating Systems File systems
Chapter 12 File Management Systems
1 Course Outline Processes & Threads CPU Scheduling Synchronization & Deadlock Memory Management File Systems & I/O Networks, Protection and Security.
CMPT 300: Operating Systems I
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Disk and I/O Management
1 CSC 539: Operating Systems Structure and Design Spring 2005 File-system management  files and directories  directory organization  access methods:
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
File Systems CSCI What is a file? A file is information that is stored on disks or other external media.
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.
CSCI-375 Operating Systems Lecture Note: Many slides and/or pictures in the following are adapted from: slides ©2005 Silberschatz, Galvin, and Gagne Some.
File Storage Organization The majority of space on a device is reserved for the storage of files. When files are created and modified physical blocks are.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
File system.
Chapter 16 File Management The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander John.
CE Operating Systems Lecture 17 File systems – interface and implementation.
File Systems. 2 What is a file? A repository for data Is long lasting (until explicitly deleted).
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and 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.
FILE SYSTEM IMPLEMENTATION 1. 2 File-System Structure File structure Logical storage unit Collection of related information File system resides on secondary.
ECE 456 Computer Architecture Lecture #9 – Input/Output Instructor: Dr. Honggang Wang Fall 2013.
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
W4118 Operating Systems Instructor: Junfeng Yang.
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.
File-System Management
Chapter 11: File System Implementation
FileSystems.
Chapter 11: File System Implementation
Operating Systems (CS 340 D)
Operating Systems (CS 340 D)
Operating System I/O System Monday, August 11, 2008.
Lecture 45 Syed Mansoor Sarwar
Chapter 11: File System Implementation
Chapter 11: File System Implementation
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
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.
Secondary Storage Management Brian Bershad
Chapter 16 File Management
Chapter 14: File-System Implementation
Secondary Storage Management Hank Levy
Chapter 11: File System Implementation
Department of Computer Science
Lecture 4: File-System Interface
Presentation transcript:

CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared by Yang Song and Dr. Hung)

The Fundamental Functions Process Management Memory Management File Management Input / Output Networking Utility Services

File Management Files and directories Access methods: sequential, direct, indexed File system and directory implementation

File Concept File is the logical unit within a file system logical files are mapped into physical entities by the OS in user's view, file is the smallest unit that can be saved to disk The attributes that a file might possess: name : provides handle for reference DOS (8 chars + 3 char extension), Windows (unlimited? length, 3 char extension) UNIX (spaces tricky, no extension needed) type : indicates how the file should be treated DOS/Windows rely on extension, can map extensions to programs UNIX uses "magic number", first few bytes of file specify file type protection : permissions, access control information location & size

File Operations A file is an abstract data type (ADT), so we manipulate it through a set of operations create : find space on disk and make entry in directory write : write to file, requires positioning within the file read : read from file, involves positioning within the file delete : delete directory entry, reclaim disk space reposition : move read/write position The OS must maintain information about all open files file pointer : the current position of the read/write pointer in the file disk location : the location of the file on the disk file open count : keep track of number of processes currently accessing the file such a table of information allows the OS to enforce policies such as only one process can write to a file at a given time

File Structure Files can be stored physically as bytes lines records Whatever entity is stored, OS must map into a disk sector because on a physical disk, sectors are smallest writeable unit Access methods: sequential : information in the file is accesses from first to last direct : possible to reposition read/write pointer to any position such files are generally made up of fixed-length records indexed : built on top of direct access, but access records in file using a key each record has a key associated with it, an index of keys is stored with the file

Directory Structure To manage a large number of files, structure is essential Disks are broken into one or more partitions each partition is logically mounted separately each partition can have its own file system method (FAT, NTFS, … ) Within each partition, a device directory keeps information about stored files may be viewed as a symbol table that maps file names to directory entries directory operations include: search/create/delete/rename a file, list a directory, … Most directory structures are hierarchical one top-level directory (root) within directory are file & other directories can define the location of a file/directory by its path from the root, traverse up and down note: if hard links (shared access) or soft links (aliasing) are allowed, then cycles are possible

File System Implementation File systems are implemented primarily on disks Although other media are used, most of the ideas about implementing file systems were developed with disks in mind Disks read and write sectors (usually 512 bytes) Logical I/O transfers between CPU and disk involve blocks of sectors File system is generally composed of many levels  logical file system : manages directories, manipulates files as ADT's  file organization module : maps logical block addresses to physical blocks, manages free space  basic file system : issues generic commands to read/write physical blocks  I/O control : consists of device drivers and interrupt handlers to transfer info between RAM and disk

Directory Implementation: Contiguous Allocation Each file occupies a contiguous set of blocks on the disk Problems:  managing free space is complex, external fragmentation is possible  total space needed for file is often unknown at creation  over-allocation leads to internal fragmentation Used by the Veritas File System

Directory Implementation: Linked Allocation File is a linked list of disk blocks Problems:  only supports sequential access  extra space is needed for pointers  a single bad sector can corrupt an entire file Used in MS-DOS & Windows  File-Allocation Table (FAT) is stored in first block of the partition

Directory Implementation: Indexed Allocation For each file, an index block stores pointers to all the blocks Problems:  index block requires space  large file may need several index blocks  growing files may need index blocks dynamically extended Used in Unix File System  uses multiple levels of indirection

The Fundamental Functions Process Management Memory Management File Management Input / Output Networking Utility Services

Input/Output Systems Device is connected to an interface Interface is connected to an internal bus Internal bus is connected to a bus controller Bus controller is connected to the main bus (e.g., PCI) Main bus is connected to the CPU typical PC bus structure

Disk Scheduling The OS is responsible for using hardware efficiently If the disk and controller are not busy when request arrives, handle immediately Otherwise, it must save requests and schedule them Disk access time has two major components seek time is the time for the disk are to move the heads to the right track rotational latency is the additional time for the disk to rotate to the right sector Disk Bandwidth is amount of data transferred/time from request to completion Given a sequence of disk accesses, can schedule to maximize bandwidth (similar to how CPU scheduling maximized throughput)

Disk Scheduling Algorithms (1) Suppose read/write head is currently at track 53, and requests arrive: tracks 98, 183, 37, 122, 14, 124, 65, 67 (First Come First Serve) FCFS: movement across 640 tracks  easy, not very efficient

Disk Scheduling Algorithms (2) Suppose read/write head is currently at track 53, and requests arrive: tracks 98, 183, 37, 122, 14, 124, 65, 67 Shortest Seek Time First (SSTF): movement across 236 tracks  better, can lead to starvation

Disk Scheduling Algorithms (3) Suppose read/write head is currently at track 53, and requests arrive: tracks 98, 183, 37, 122, 14, 124, 65, 67 Circular Look (C-LOOK): movement across 322 tracks effective, no starvation