CS Introduction to Operating Systems

Slides:



Advertisements
Similar presentations
File-System Interface
Advertisements

Concepts about the file system 2. The disk structure 3. Files in disk – The ext2 FS 4. The Virtual File System (c) 2013, Prof. Jordi Garcia.
Free Space and Allocation Issues
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Chapter 10: File-System Interface
File System Interface CSCI 444/544 Operating Systems Fall 2008.
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.
Chapter 10.2: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface Chapter 10.1.
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Ceng Operating Systems
10.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 10: File-System Objectives To discuss file-system design tradeoffs, including.
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.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface.
The file structure and related utilities CS240 Computer Science II.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Naming and Directories. Recall from the last time… File system components Disk management organizes disk blocks into files. Many disk blocks management.
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.
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.
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.
Lesson 9-Setting and Using Permissions. Overview Describing file permissions. Using execute permissions with a file. Changing file permissions using mnemonics.
File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation ( of textbook)
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
Module 4.0: File Systems File is a contiguous logical address space.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Project 6 Unix File System. Administrative No Design Review – A design document instead 2-3 pages max No collaboration with peers – Piazza is for clarifications.
Linux+ Guide to Linux Certification, Third Edition
CE Operating Systems Lecture 17 File systems – interface and implementation.
The Unix File system (UFS) Presented by: Gurpreet Singh Assistant Professor Department of School of Computing and Engineering Galgotias University.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Lecture Topics: 11/29 File System Interface –Files and Directories –Access Methods –Protection –Consistency.
File Systems - Part I CS Introduction to Operating Systems.
Silberschatz, Galvin and Gagne ©2009 Edited by Khoury, 2015 Operating System Concepts – 9 th Edition, Chapter 11: File-System Interface.
The Unix File System R Bigelow. The UNIX File System The file system refers to the way in which UNIX implements files and directories. The UNIX file system.
Operating Systems Files, Directory and File Systems Operating Systems Files, Directory and File Systems.
Lecture 14 Page 1 CS 111 Online File Systems: Naming, Reliability, and Advanced Issues CS 111 On-Line MS Program Operating Systems Peter Reiher.
W4118 Operating Systems Instructor: Junfeng Yang.
Lecture 11 Page 1 CS 111 Summer 2013 File Systems: Memory Management, Naming and Reliability CS 111 Operating Systems Peter Reiher.
File-System Management
Directory Structure Single Level Directory Two Level Directory
FileSystems.
Module 10: File-System Interface
Chapter 11: File-System Interface
Chapter 11: File System Implementation
Filesystems.
Naming A name in a distributed system is a string of bits or characters used to refer to an entity. To resolve name a naming system is needed.
Naming and Directories
Exploring the UNIX File System and File Security
CS510 Operating System Foundations
Naming and Directories
Chapter 11: File-System Interface
Naming and Directories
Chapter 11: File System Implementation
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Lecture 43 Syed Mansoor Sarwar
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 10: File-System Interface
Files Management – The interfacing
Secondary Storage Management Hank Levy
Chapter 11: File System Implementation
Module 10: File-System Interface
Naming and Directories
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
File Systems CSE 2431: Introduction to Operating Systems
Presentation transcript:

CS 537 - Introduction to Operating Systems File Systems - Part II CS 537 - Introduction to Operating Systems

Directory A directory maps file names to disk locations A single directory can contain files and other directories A modern file system is made up of many directories

File Names A file name is given as a path Relative path name a road map through the directory system to the files location in the directory Relative path name files location relative to the current directory Absolute path name files location from beginning of directory

File Names Each file must have a unique path in the directory A file can have more than one path name The same path name cannot be used to represent multiple files

File Names Good Bad foo file 1 joe test bar file 2 test car file 3

One-Level Directory All files are listed in the same directory boo da cat dog test proj data x y

One-Level Directory Easy to implement One major problem is the unique name requirement imagine 2 users both doing project 2 in single directory, they couldn’t both name it proj2 even for single user system it is difficult to keep track of the names of every file

Tree Structured Directories Directory structure is made up of nodes and leafs A node is a directory A leaf is a file Each directory can contain files or sub-directories Each node or leaf has only 1 parent

Tree Structured Directories root directory tmp usr bin foo docs mike beth pat ls cat vi mk proj bt proj pt proj tst cat beth

Tree Structured Directories Allows users to have there own directories users can create there own sub-directories Different files can now have the same name as long as the absolute path is different A user has a current directory directory the user is currently in

Tree Structured Directories Traversing the tree can be done in two ways absolute path begin searching from the root ( /usr/beth/proj ) relative path begin searching from current directory assume in usr directory and want to access beth’s project beth/proj

Tree Structured Directories Trees are fairly easy to traverse and maintain One major problem is the sharing of files remember, only one parent per node/leaf Would like to be able to have multiple references to a file or directory

Acyclic Graph Directories Similar to a tree except each node or leaf can have more than one parent One requirement is that there can be no cycles cycles can cause infinite search loops File and directory sharing now becomes easy

Acyclic Graph Directories root directory tmp usr bin . . . mike beth pat mk proj proj bt pt links vi cat ls ls cat vi

Acyclic Graph Directories Unix uses this structure Reference from one directory to another directory or file is called a link In Unix, a reference count is kept for each file (or directory) When no more references to a file, it is deleted notice, Unix has no explicit delete method uses unlink to remove a reference to a file

Cycles Cycles in a graph can present a major problem now unlink this root root foo bar foo bar lnk lnk this is now garbage Reference counting wouldn’t work would need to do garbage collection garbage collection on disk is extremely time consuming

Cycles Cycles present other problems root foo bar lnk Imagine trying to delete everything beneath bar we first need to search for everything contained in bar an infinite loop will develop search to lnk, lnk points to bar, bar points to lnk, …

Links Hard links Symbolic links (soft links) actual entry in a directory points directly to another directory or a file Symbolic links (soft links) special file that contains a path name to another file or directory when it is encountered, read the file and follow the path described in the file does not count in reference counting scheme

Links To prevent cycles, do not allow more than one hard link to a directory count how many times a search “loops” if it loops a certain number of times, exit search routine ref count here is now zero and it can be deleted root root now delete this foo bar foo bar lnk /root/bar lnk /root/bar softLink softLink

Directory Entry A directory entry contains a name and a location on disk the name can be a file the name can be another directory This is a hard link to another entity name location

Directory A directory is made up entries In Unix, a directory is almost identical to a regular file How does Unix know it is looking at a directory and not a regular file? information in meta data marks it as a directory

Directory Marked as a directory file d Meta Data this could be another foo 23 test.dat 110 prog.c 94 these would be files

Searching the Directory User gives an absolute or relative path name A copy of the users current directory is cached memory If user gives relative path, use this cache If user gives absolute path, go to disk and find the root directory continue search from there Unix has a function called namei namei does the actual directory search

namei() int namei(int startDirLoc, String [] path) { for(int i=0; i<path.length; i++) { if(startDirLoc != directoryFile) ERROR; startDirLoc = getDiskLocation(startDirLoc, path[i]); if(startDirLoc == 0) } return startDirLoc;

namei() Example test.c 39 currentDir 23 d public mattmcc 19 mattmcc 110 19 d d test.c 39 public 110

namei() Example startDirLoc = 23 path = {mattmcc, public, test.c} test is the actual file we are looking for on disk a program like emacs might do the following int fileLoc = namei(startDirLoc, path); start at currentDir and look for mattmcc -> 19 make 19 the current search directory and look for public -> 110 make 110 the current search directory and look for test.c -> 39 (this is the location we want)

Protection A good file system should provide a means of controlling access to files In early systems with only a single user, this was not an issue Today, almost anyone can access a computer either through a LAN or through the internet

Controlling Access The user that creates a file should have all rights to that file that user can read, write, and delete the file the user should also be able to control access rights of other users to that file For example imagine a supervisor creates a work schedule the supervisor should be able to read and modify that schedule the workers should all be able to read the schedule but they should not be able to modify it

Access Control List For each file, the author could specify every other users access rights to the file this is very flexible this is very tedious for a user to do Instead of specifying all users, system could have a default and only specify specific users to grant access to still very flexible much less work on the part of the file creator default access may be read-only or no access at all Problem with both of these approaches is the amount of space needed in meta data of file have to record this information and it may vary (or grow over time)

Unix Access Control Unix uses a much simpler strategy there are three type of people in the world owner of the file (usually the creator) a group to which the owner belongs everyone in the world for each of these categories, the owner of the file specifies rights Directories and files have rights associated with them

Unix Access Control Possible rights for a file read write execute can read the file, can list a directory, can copy the file write can write the file, can add or delete files from a directory execute can execute an executable file

Unix Access Control The rights for each type of user is specified when the file is created These rights can be changed by the owner of the file It takes 9 bits to record the access rights of the file R W X R X R owners rights groups rights universal rights