CS 149: Operating Systems April 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak www.cs.sjsu.edu/~mak.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

File Management.
Chapter 4 : File Systems What is a file system?
Allocation Methods - Contiguous
Chapter 10: File-System Interface
1 Chapter 11: File-System Interface  File Concept  Access Methods  Directory Structure  File System Mounting  File Sharing  Protection  Chapter.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
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 File-System Interface.
File System Implementation CSCI 444/544 Operating Systems Fall 2008.
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
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.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
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
CS 157B: Database Management Systems II March 18 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak.
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
CS 152: Programming Language Paradigms April 9 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
Computer Studies (AL) File Management File system interface.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
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.
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
Operating System Concepts and Techniques Lecture 17
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.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials– 8 th Edition Chapter 10: File System Implementation.
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.
CS 149: Operating Systems April 9 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CSCI-375 Operating Systems Lecture Note: Many slides and/or pictures in the following are adapted from: slides ©2005 Silberschatz, Galvin, and Gagne Some.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 11: File-System Interface Modified.
CS333 Intro to Operating Systems Jonathan Walpole.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
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.
Silberschatz, Galvin, and Gagne  Applied Operating System Concepts Module 11: File-System Interface File Concept Access Methods Directory Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
Chapter 16 File Management The Architecture of Computer Hardware and Systems Software: An Information Technology Approach 3rd Edition, Irv Englander John.
CMPE 226 Database Systems November 18 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
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.
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.
Operating Systems 1 K. Salah Module 4.0: File Systems  File is a contiguous logical address space (of related records)  Access Methods  Directory Structure.
CS 151: Object-Oriented Design October 29 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Access Methods File store information When it is used it is accessed & read into memory Some systems provide only one access method IBM support many access.
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.
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
W4118 Operating Systems Instructor: Junfeng Yang.
CS 154 Formal Languages and Computability April 19 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CSE Operating System Principles File Systems.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
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.
Chapter 11: File System Implementation
CMPE Database Systems Exercise #1 Solutions
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.
CMPE 135: Object-Oriented Analysis and Design November 29 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor:
Chapter 16 File Management
Lecture 4: File-System Interface
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

CS 149: Operating Systems April 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 2 Unofficial Field Trip  Computer History Museum in Mt. View  Saturday, May 9, 11:30 – closing time Special free admission. Do a self-guided tour of the new Revolution exhibit. See a life-size working model of Charles Babbage’s Difference Engine in operation, a hand-cranked mechanical computer designed in the early 1800s. Experience a fully restored IBM 1401 mainframe computer from the early 1960s in operation.  General info:  My summer seminar:  Restoration: thelen.org/1401Project/1401RestorationPage.htmlhttp://ed- thelen.org/1401Project/1401RestorationPage.html

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 3 Unofficial Field Trip  The new Revolution exhibit is now open! Walk through a timeline of the First 2000 Years of Computing History. Historic computer systems, data processing equipment, and other artifacts. Small theater presentations. Atanasoff-Berry Computer Hollerith Census Machine

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 4 Unofficial Field Trip  Babbage Difference Engine, fully operational. Hand-cranked mechanical computer. Computed polynomial functions. Designed by Charles Babbage in the early to mid 1800s.  Arguably the world’s first computer scientist, lived He wasn’t able to build it because he lost his funding.  Live demo at 1:00  His plans survived and this working model was built. Includes a working printer!

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 5 Unofficial Field Trip  IBM 1401 computer, fully restored and operational A small transistor-based mainframe computer. Extremely popular with small businesses in the late 1950s through the mid 1960s  Maximum of 16K bytes of memory.  800 card/minute card reader (wire brushes).  600 line/minute line printer (impact).  6 magnetic tape drives, no disk drives.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 6 File Structure  UNIX supports a minimal set of file structures. A file is simply a stream of bytes. Each byte is addressable by its offset from the file beginning or end. User programs can organize these bytes into fixed- or variable-length records.  Other operating systems (especially on older machines) supported other file structures.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 7 Sequential Access Method  Programs access the records in forward order, one after another.  The file pointer keeps track of the I/O location. Read the next record. Append to the end of the file. Rewind to the beginning of the file. Skip to record n Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 8 Direct (Random) Access Method  Programs can read or write records rapidly in any order. Each record has a position which is a relative block number n relative to the beginning of the file. Fixed-length records. read(n) write(n) position_to(n) read_next() write_next() rewrite(n) Why?

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 9 Other Access Methods  Build other access methods on top of direct-access. Example: An indexed access method. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 10 Disk Structure  A disk can be subdivided into partitions. Disks or partitions can be RAID-protected against failure.  Raw disk or partition: without a file system  Formatted: with a file system  Volume: An entity containing a file system. Each volume tracks its file system’s information in a device directory or volume table of contents.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 11 Disk Structure, cont’d Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 12 Disk Structure, cont’d  Along with general-purpose file systems, there are many special-purpose file systems.  Frequently, all the file systems reside within the same operating system or computer.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 13 Directories  A directory is a container (“folder”) of files.  Provides a way to organize a collection of files on disk.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 14 Directory Operations  Efficiency Locate 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.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 15 Directory Operations, cont’d  Operations Create a file Delete a file Search for a file Rename a file List a directory Traverse the file system

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 16 Single-Level Directory  A single directory for all users.  Disadvantages: Naming Grouping Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 17 Two-Level Directory  The operating system maintains a master file directory.  Each user has a user file directory. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 18 Two-Level Directory, cont’d  Advantages Different users can use the same file names. More efficient searching.  Disadvantages No grouping. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 19 Tree-Structured Directories  Users can create their own subdirectories. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 20 Acyclic-Graph Directories  Allow shared directories and files.  Links Resolve a link by locating the actual file or directory. Symbolic links Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 21 File Path Names  Absolute path name Begins with the root / Example: /usr/local/make  Relative path name Search begins with the current directory. current directory.. parent directory Example: cd /usr ls local/make

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 22 File Path Names, cont’d Modern Operating Systems, 3 rd ed. Andrew Tanenbaum (c) 2008 Prentice-Hall, Inc All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 23 Mounting a File System  Mount an external file system in order to access it. This file system can be located on another disk or on some external removable medium (such as a DVD ROM).  Define a mount point in the current file system. Usually, it’s an empty directory.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 24 Mounting a File System, cont’d  Mount the external file system onto the mount point. Now the contents of the external file system appear under the directory name of the mount point. If the mount point was not an empty directory, the files that were stored in that directory are now hidden and inaccessible.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 25 Mounting a File System, cont’d a) The current file system b) A volume on /devices/dsk Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 26 Mounting a File System, cont’d  The result of mounting /devices/dsk onto /users. The previous contents of /users are no longer accessible. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 27 File Protection  The file owner or creator should be able to control: What can be done to the file By whom  Types of access: Read Write Execute Append Delete List

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 28 File Protection in UNIX  Types of access: read, write, execute (RWX)  Three classes of users and sample access: RWX a) owner access 7  b) group access 6  c) public access4   For a particular file or directory (such as game ), define an appropriate access with the chmod command. ownergrouppublic chmod 764 game

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 29 File Protection in UNIX, cont’d  Sample UNIX file listing via the ls command. Access rights to each file and directory are at the left.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 30 Layered File System Architecture  I/O control Device drivers Interrupt handlers  Basic file system Issue generic commands to the device drivers. Manage memory buffers and caches that hold file system, directory, and data blocks. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 31 Layered File System Architecture, cont’d  File-organization module Manage logical and physical blocks of files. Translate logical block addresses to physical block address.  Logical file system Manage file metadata. File control blocks (UNIX inodes) Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 32 File System Layout on Disk  Master Boot Record (MBR) Located at sector 0 of the disk Used to boot the computer Contains the disk partition table Contains code to boot the computer  The MBR code locates the active disk partition. Read and execute the boot block of the active partition. Load the operating system residing in the partition.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 33 File System Layout on Disk, cont’d  The superblock Contains key parameters about the file system that is read into main memory.  File-control blocks (UNIX inodes) Array of data structures, one per file. Information about each file: Where its disk blocks are located, etc.

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 34 File System Layout on Disk, cont’d  Root directory  Other directories and files Modern Operating Systems, 3 rd ed. Andrew Tanenbaum (c) 2008 Prentice-Hall, Inc All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 35 Contiguous File Allocation  Each file occupies a set of contiguous blocks. Usually best performance. Simple: Requires only the starting location (block #) and length (block count). Problems  Finding space for file  Knowing the file size  External fragmentation  Need for compaction Still used today on CD ROMs and DVDs. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 36 Linked File Allocation  Each file is a linked list of blocks. No external fragmentation. No compaction.  Each block contains a pointer to the next block. Free space management system called when a new block needed. Improve efficiency by clustering blocks into groups, but increases internal fragmentation.  Locating a block can take many I/Os and disk seeks. Poor random access performance. Reliability can be a problem. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 37 File Allocation Table (FAT)  At the beginning of a volume Indexed by block number Much like a linked list. Used by Microsoft Windows.  Needs to be cached in memory for performance.  Simple to allocate a new block. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 38 Indexed File Allocation  Each file has its own index block, an array of disk-block addresses.  No external fragmentation.  Overhead of the index block. Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved

Computer Science Dept. Spring 2015: April 7 CS 149: Operating Systems © R. Mak 39 UNIX Inode Operating Systems Concepts, 9 th edition Silberschatz, Galvin, and Gagne (c) 2013 John Wiley & Sons. All rights reserved UNIX inode has pointers to:  direct blocks  single indirect blocks  double indirect blocks  triple indirect blocks