Chapter 11 File-System Interface

Slides:



Advertisements
Similar presentations
Chapter 10: File-System Interface
Advertisements

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.
CHAPTER 11: FILE-SYSTEM INTERFACE File Concept File Concept File Access File Access Directory Structure Directory Structure File System Mounting File System.
Chapter 10: File-System Interface
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.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Chapter 12 File Management
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File-System Interface.
04/05/2010CSCI 315 Operating Systems Design1 Virtual Memory Wrap-up; File System Interface.
1 Operating Systems Chapter 7-File-System File Concept Access Methods Directory Structure Protection File-System Structure Allocation Methods Free-Space.
Chapter 10: File-System Interface
File System Structure §File structure l Logical storage unit l Collection of related information §File system resides on secondary storage (disks). §File.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
Os111 Chapter 11 File-System Interface. os112 Outline File Concept Access Methods Directory Structure File System Mounting File Sharing Protection.
7/15/2015B.RamamurthyPage 1 File System B. Ramamurthy.
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
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 10: File-System Interface.
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
CHP - 9 File Structures. INTRODUCTION In some of the previous chapters, we have discussed representations of and operations on data structures. These.
Computer Studies (AL) File Management File system interface.
ITEC 502 컴퓨터 시스템 및 실습 Chapter 10-1: File Systems Mi-Jung Choi DPNM Lab. Dept. of CSE, POSTECH.
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 Systems Long-term Information Storage Store large amounts of information Information must survive the termination of the process using it Multiple.
NETW3005 File System Interface. Reading For this lecture, you should have read Chapter 10 (Sections 1-5) and Chapter 11 (Sections 1-4). NETW3005 (Operating.
Chap 10 File-System Interface. Objectives To explain the function of file systems To describe the interfaces to file systems To discuss file-system design.
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.
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.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Page 110/19/2015 CSE 30341: Operating Systems Principles Chapter 10: File-System Interface  Objectives:  To explain the function of file systems  To.
Chapter 11 File Systems and Directories. 2 File Systems File: A named collection of related data. File system: The logical view that an operating system.
File Systems (1). Readings r Reading: Disks, disk scheduling (3.7 of textbook; “How Stuff Works”) r Reading: File System Implementation ( of textbook)
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 11: File-System Interface Modified.
Operating Systems COMP 4850/CISG 5550 File Systems Files Dr. James Money.
10.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 10: File-System Interface.
Fall 2000M.B. Ibáñez Lecture 22 File-System I File Concept.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
File System Implementation
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  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.
CS 346 – Chapter 11 File system –Files –Access –Directories –Mounting –Sharing –Protection.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 10: File-System Interface File Concept.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
It consists of two parts: collection of files – stores related data directory structure – organizes & provides information Some file systems may have.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
SOCSAMS e-learning Dept. of Computer Applications, MES College Marampally FILE SYSTEM.
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.
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.
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.
W4118 Operating Systems Instructor: Junfeng Yang.
SVBIT SUBJECT:- Operating System TOPICS:- File Management
Operating Systems (CS 340 D) Princess Nora University Faculty of Computer & Information Systems Computer science Department.
CSE Operating System Principles File Systems.
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
Operating Systems (CS 340 D)
Files Management – The interfacing
File-System Interface
Lecture 4: File-System Interface
Presentation transcript:

Chapter 11 File-System Interface

File-System The file-system consists of two distinct parts: A collection of files, each storing related data A directory structure, which organized and provides information about all the files in the system. Some file systems have a third part, partitions, which are used to separate physically or logically large collection of directories.

File-System Multiple-Choices Questions: ( ) Which of the following parts is not belonging to a file system? (A) programs (B) files (C) directory structure (D) partitions The file-system consists of two distinct parts: A collection of files, each storing related data A directory structure, which organized and provides information about all the files in the system. Some file systems have a third part, partitons, which are used to seperate physically or logically large collection of directories. Ans: A

File Concept § 11.1 The OS abstracts from the physical properties of its storage devices to define a logical storage unit (the file). User’s view of a file as the smallest allotment of logical secondary storage. Files may be free form, such as text files, or may be formatted rigidly.

File Concept § 11.1 True-False Question: ( ) From a user’s perspective, a file is the largest allotment of logical secondary storage. The OS abstracts from the physical properties of its storage devices to define a logical storage unit (the file). User’s view of a file as the smallest allotment of logical secondary storage. Files may be free form, such as text files, or may be formatted rigidly. Ans: X

File Concept The information in a file is defined by its creator. A file has a certain defined structure according to its type. text file: a sequence of characters organized into lines or pages. source file: a sequence of subroutines and functions. object file: a sequence of bytes organized into blocks understandable by the system’s linker. executable file: a series of code sections that the loader can bring into memory and execute.

File Attributes Name – only information kept in human-readable form. § 11.1.1 Name – only information kept in human-readable form. Identifier – identifies the file within the file sysem; non-human-readable name for the file. Type – needed for systems that support different types. Location – pointer to a device and to the location of the file on that device. Size – current file size. Protection – controls who can do reading, writing, executing. Time, date, and user identification – data for protection, security, and usage monitoring.

File Attributes Information about files are kept in the directory structure, which is maintained on the disk. The directory entry consists of the file’s name and its unique identifier. The identifier in turn locates the other file attributes. May take more than a kilobyte to record this information for each file. In a system with many files, the size of the directory itself may be megabytes.

File Operations Six basic file operations: Creating a file § 11.1.2 Six basic file operations: Creating a file Writing a file Reading a file Repositioning a file Deleting a file Truncating a file

Other common operations Append new info to the end of existing file. Rename existing file Copy a file (Combined from other file operations) Get and set various file attributes

Open-File Table To avoid directory searching for the entry associated with the named file while constantly performing above operations, many system require that an open system call be used before that file is first used actively. OS keeps the open-file table containing information about all open files. When a file is requested, the file is specified via an index into this table, no searching is required.

Open-File Table True-False Question: ( ) With the help of open-file table, no searching will ever be needed. To avoid directory searching for the entry associated with the named file while constantly performing above operations, many system require that an open system call be used before that file is first used activtly. OS keeps the open-file table containing information about all open files. When a file is requested, the file is specified via an index into this table, no searching is required. Ans: X

open Operation The open operation takes a file name and searches the directory, copying the directory entry into the open-file table. If request modes are allowed, the file is opened for the process. open returns a pointer to the entry in the open-file table. This pointer, not the actual file name, is used in all I/O, avoiding any further searching.

In Multiuser Environment The open and close in multiuser environment, such as UNIX, is more complicated since several users may open the file at the same time. Two levels of internal tables: a per-process table tracks all files that a process has open. Including current file pointer, access rights, and accounting information. a system-wide table

In Multiuser Environment Each entry in the per-process table in turn points to a system-wide open-file table which contains process-independent information such as the location of the file on disk, access dates, and file size. Information associated with an open file: File pointer File open count Disk location of the file Access rights

File Types § 11.1.3 If an OS recognizes the type of a file, it can then operate on the file in reasonable ways. Common technique: file name extension. Example: MS-DOS TOPS-20 Apple Macintosh UNIX

File Types

TOPS-20 If the user tries to execute an object program whose source file has been modified (or edited) since the object file was produced, the source file will be recompiled automatically. Avoid wasting times executing the old object file.

TOPS-20 The OS must distinguish source file from the object file, check the time that each file was created or last modified, and determine the language of the source program.

Apple Macintosh Each file also has a creator attribute containing the name of the program that created it. When the user opens that file, the corresponding application program is invoked automatically

UNIX UNIX uses a crude magic number stored at the beginning of some files to indicate roughly the type of the file. Not all files have magic numbers, so system features cannot be based solely on this type of information. UNIX does not record the name of the creating program, either.

UNIX Multiple-Choices Questions: ( ) UNIX uses a ________ stored at the beginning of some files to indicate roughly the type of the file. (A) file pointer (B) magic number (C) index number (D) type pointer UNIX uses a crude magic number stored at the beginning of some files to indicate roughly the type of the file. Not all files have magic numbers, so system features cannot be based solely on this type of information. UNIX does not record the name of the creating program, either. Ans: B

File Structure § 11.1.4 Certain files must conform to a required structure that is understood by the OS. Some system support multiple file structures ... needs to contain the code to support each different file structure. Problem may result if new applications require different structure from the system supported structures.

Example: UNIX UNIX support minimal number of file structure. It considers each file to be a sequence of 8-bit bytes; no interpretation of these bits is made by the OS. This scheme provides maximum flexibility, but little support. However, all OS must support at least one structure – executable file structure.

Example: UNIX True-False Question: ( ) UNIX support minimal number of file structure and consider each file to be a sequence of 8-bit bytes. This scheme has no flexibility at all. UNIX support minimal number of file structure. It considers each file to be a sequence of 8-bit bytes; no interpretation of these bits is made by the OS. This scheme provides maximum flexibility, but little support. However, all OS must support at least one structure – executable file structure. Ans: X

Example: Macintosh Files contain two parts: resource fork  and data fork.  Too few structures make programming inconvenient, whereas too many cause OS bloat and programmer confusion. Contain information of interest to the user Contain program code or data, as traditional file.

Internal File Structure § 11.1.5 The physical record size will not exactly match the length of the logical record ... packing a number of logical records into physical records. UNIX: define all files to be simply a stream of bytes. File system automatically packs and unpacks bytes into physical disk blocks – say, 512bytes per block – as necessary.

Internal Fragmentation Because disk space is always allocated in blocks, some portion of the last block of each file is generally wasted. All file systems suffer from internal fragmentation; the larger the block size, the greater the internal fragmentation.

Access Methods § 11.2 Sequential access. The simplest and by far the most common method. Information in the file is processed in order, one record after the other. Editor and Compiler usually use this method. Based on a tape model of a file.

Access Methods Direct Access. A file is made up of fixed-length logical records that allow programs to read and write records rapidly in no particular order. Based on a disk model of a file which allowing random access to any file block. Useful for immediate access to large amounts of information such as database.

Access Methods It is easy to simulate sequential access on a direct-access file. It is extremely inefficeint and clumsy to simulate a direct-access file on a sequential-access file.

Other Access Methods Other access methods can be built on top of a direct-access method. Generally using an index contains pointers to the blocks. To find a record in the file, first search the index, then use the pointer to access the file directly and to find the desired record.

Other Access Methods Example: Retail-price file listing the universal product codes (UPCs) and the prices for each item. Each record consists of a 10-digit UPC and a 6 digit price for a 16-byte record. For 1024 bytes per block disk, can store 64 records per block. A file of 120000 records occupy about 2000 blocks. Define an index consisting of the first UPC in each block. This index would have 2000 entries of 10 digits each, or 20000 bytes. Searching the index would know exactly which block contains the desired record.

Large Files With large files, the index file itself may become too large to be kept in memory ... create an index for the index file. The primary index file contain pointers to secondary index files, which would point to the actual data items.

ISAM of IBM IBM’s indexed sequential-access method (ISIM) uses a small master index that points to disk blocks of a secondary index. The secondary index blocks point to the actual file blocks. To find a particular item, we first make a binary search of the master index, which provides the block number of the secondary index. A search again used to find the block containing the desired record. Finally, this block is searched sequentially. In this way, any record can be located from its key by at most two direct-access reads.

Example – VMS indexes