COMP5102 Lecture 3 Operating Systems (OS) File systems phones off (please)

Slides:



Advertisements
Similar presentations
Disk Storage, Basic File Structures, and Hashing
Advertisements

Chapter 12: File System Implementation
Chapter 4 : File Systems What is a file system?
Allocation Methods - Contiguous
Chapter 10: File-System Interface
File Management Systems
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
1 Chapter 6 Storage and Multimedia: The Facts and More.
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.
Operating Systems File systems
DISK STORAGE IBM 305 RAMAC, MB on inch disks
METU Department of Computer Eng Ceng 302 Introduction to DBMS Disk Storage, Basic File Structures, and Hashing by Pinar Senkul resources: mostly froom.
Ceng Operating Systems
1 Outline File Systems Implementation How disks work How to organize data (files) on disks Data structures Placement of files on disk.
1 Friday, July 07, 2006 “Vision without action is a daydream, Action without a vision is a nightmare.” - Japanese Proverb.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 13 Disk Storage, Basic File Structures, and Hashing.
Operating Systems File systems
Chapter 12 File Management Systems
DISK STORAGE INDEX STRUCTURES FOR FILES Lecture 12.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Chapter 10 File System Interface
1 File Systems Chapter Files 6.2 Directories 6.3 File system implementation 6.4 Example file systems.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Lesson 7-Creating and Changing Directories. Overview Using directories to create order. Managing files in directories. Using pathnames to manage files.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 17 Disk Storage, Basic File Structures, and Hashing.
How Hard Disks Work. Hard disks were invented in the 1950s. They started as large disks up to 20 inches in diameter holding just a few megabytes. They.
1 Chapter 12 File Management Systems. 2 Systems Architecture Chapter 12.
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.
Lecture 9: The FAT and VFAT Filesystems 6/16/2003 CSCE 590 Summer 2003.
1 Secondary Storage Management Submitted by: Sathya Anandan(ID:123)
File Systems Long-term Information Storage Store large amounts of information Information must survive the termination of the process using it Multiple.
Component 4: Introduction to Information and Computer Science Unit 4: Application and System Software Lecture 3 This material was developed by Oregon Health.
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.
GENERAL INFORMATION Invented in 1950's on mainframe computers with 20 inches diameter with only few megabytes of data. Originally called 'Fixed Disc'
Operating Systems COMP 4850/CISG 5550 File Systems Files Dr. James Money.
1 Comp 104: Operating Systems Concepts Files and Filestore Allocation.
Chapter 13 Disk Storage, Basic File Structures, and Hashing. Copyright © 2004 Pearson Education, Inc.
File Structures. 2 Chapter - Objectives Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and.
Lecture 18 Windows – NT File System (NTFS)
File Systems. 2 What is a file? A repository for data Is long lasting (until explicitly deleted).
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
THE FILE SYSTEM Files long-term storage RAM short-term storage Programs, data, and text are all stored in files, which is stored on.
Chapter 6 File Systems. Essential requirements 1. Store very large amount of information 2. Must survive the termination of processes persistent 3. Concurrent.
Lecture 19 Linux/Unix – File System
Chapter 11 File Systems and Directories. 2 File Systems (Chapter 11.1) File: 1. A named collection of related data. 2.smallest amount of information that.
Chapter 5 Record Storage and Primary File Organizations
File System Department of Computer Science Southern Illinois University Edwardsville Spring, 2016 Dr. Hiroshi Fujinoki CS 314.
W4118 Operating Systems Instructor: Junfeng Yang.
SVBIT SUBJECT:- Operating System TOPICS:- File Management
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 11: File System Implementation.
Chapter 11: File System Implementation
File System Structure How do I organize a disk into a file system?
9/12/2018.
Lecture 45 Syed Mansoor Sarwar
File Management.
Chapter 11: File System Implementation
Disk Storage, Basic File Structures, and Hashing
Disk Storage, Basic File Structures, and Buffer Management
Disk storage Index structures for files
File System B. Ramamurthy B.Ramamurthy 11/27/2018.
Secondary Storage Management Brian Bershad
Files Management – The interfacing
Secondary Storage Management Hank Levy
Department of Computer Science
Networks & I/O Devices.
Chapter 5 File Systems -Compiled for MCA, PU
Presentation transcript:

COMP5102 Lecture 3 Operating Systems (OS) File systems phones off (please)

© De Montfort University, 2005Comp5102/ L32 Lecture Outline File Types Files information File Access File Structure –Disk Construction –File Allocation Tables

© De Montfort University, 2005Comp5102/ L33 File Types A file may have a specific type or purpose, e.g. regular files, directories, character/block special files, pipes Some systems have specific types for things like –ASCII (text) files –executable (machine code) files File types may be enforced –MS-DOS executable must have ‘.exe’ extension or not (they are just a hint to the user) –UNIX text files may have ‘.txt’ extension File types may have associations –Apple Mac types associate a file with its creator

© De Montfort University, 2005Comp5102/ L34 File Types – Name, Extension

© De Montfort University, 2005Comp5102/ L35 Unix File Types Four basic types: Regular Files –may contain text, a program, or other data, either in ASCII, in the numerical range 0 to 127, i.e. in the 7-bit range or a binary file, whose bytes can be of all possible values 0 to 255, in the 8-bit range. Directory Files –A directory containing files within a directory E.g. directory x may contain a, b and c, and that b is a directory, containing files u and v. b can be viewed as a directory, containing files and as a file itself.

© De Montfort University, 2005Comp5102/ L36 Unix File Types …. Device Files –In Unix, physical devices (printers, terminals etc.) are represented as ``files.'' In his way, the same read() and write() functions used to read and write real files can also be used to read from and write to these devices. Link Files –new name for another file –suppose we have a file X, and type ln X Y If we then run ls, it will appear that a new file, Y, has been created, as a copy of X,

© De Montfort University, 2005Comp5102/ L37 Files info. In a given Directory The `a' (``all'') and `l' (``long'') options of the ls command can give us a lot of information about files in a specified directory: bash-2.05$ ls -al total 448 drwx--x--x 3 msaf csstf 4096 Nov 17 10:44. drwx--x--x 69 msaf csstf Nov 17 10:39.. -rwx--x--x 1 msaf csstf Nov a.out -rwx--x--x 1 msaf csstf Oct prg1 -rw msaf csstf 343 Oct prog1.c

© De Montfort University, 2005Comp5102/ L38 Files info. … The output is separated into six columns: 1st column - access permissions (see below) 2nd column - number of file entries (in the case of directory files) 3rd column - owner 4th column - size in bytes 5th column - date and time of last modification 6th column – file name

© De Montfort University, 2005Comp5102/ L39 File Access Control In Unix, all files are protected under some access control mechanism –the owner of a file can deny access of his files to others. e.g. drwxr-xr-x. The meanings of the flags are shown below: file type: d (directory) - (ordinary file) l (symbolic link)

© De Montfort University, 2005Comp5102/ L310 File Access … permissions for the owner: – r (read) – w (write) – x execute – r-x read and execute permission are granted, but not write permission, for other users. To change or delete a file you need to have write permission To view a file you need to have read permission

© De Montfort University, 2005Comp5102/ L311 Some File Commands chmod change access permissions of any of your own file. –u user (i.e. owner) –g group –o others –+ add permission –- remove permission –r read –w write –x execute

© De Montfort University, 2005Comp5102/ L312 e.g. –chmod ugo+rw prog2 –adds read and write permission for all users to the prog2 file or directory of the person issuing this command. In some cases it is useful for a user to deny himself/herself permission to write to a file, –e.g. to make sure the file not deleted by mistake.

© De Montfort University, 2005Comp5102/ L313 du and df The du command displays the sizes in kilobytes of all files in the specified directory, and the total of all those sizes; The df command displays the amount of unused space left in your disk systems. diff displays line-by-line differences between two ASCII files. If for example, you have two versions of a C source file but don't remember how the new version differs from the old one, you could type diff oldprog.c newprog.c

© De Montfort University, 2005Comp5102/ L314 Wild Cards –There are two wild-card characters in Unix, `*' and `?'. rm *.c rm x?b.c rm test[1-3].c

© De Montfort University, 2005Comp5102/ L315 File Access Methods There are two distinct classes of access method –sequential access –suited to magnetic tape devices the information in a file (bytes or records) can only be written at the end (appended) or read in sequential order –random access –suited to hard disks bytes or records can be read or written in any order sometimes this is implemented by each read and write operation specifying a position parameter, or

© De Montfort University, 2005Comp5102/ L316 File System Structure Hard disks provide the bulk of secondary storage on which a file system is maintained –to improve input / output efficiency, I/O transfers are performed in units of blocks Each block consists of one or more physical hard disk sectors –typical physical sector sizes vary from 32 to 4K bytes –usually, particularly on PC’s, sectors are 512 bytes Hard disks have two important characteristics –blocks can be read, modified and written (in place) –blocks can be directly accessed in any order

© De Montfort University, 2005Comp5102/ L317 File System Layers In order to provide convenient and efficient user access to the disk, the operating system imposes a file system structure –this generally comprises a number of layers to insulate the logical structure from device dependencies application programs logical file system basic file system I/O control hardware devices (files, directories, etc) (block read & write) (interrupts, device drivers)

© De Montfort University, 2005Comp5102/ L318 Disk Construction A hard disk consists of a number of platters –made of aluminium or glass –with a thin magnetic film on the surface –common platter diameters range from inches Information is stored magnetically on both surfaces (sides) of each platter The platters rotate at a fixed rate on the spindle –e.g. modern PC drives rotate at 5,400 or 7,200 rpm

© De Montfort University, 2005Comp5102/ L319 Read / Write Heads side view r/w headsarmsactuator Each surface has a read/write head to access the magnetic fields –the heads are mounted on arms and their movement is controlled by an actuator all the heads move together The heads do not touch the surface, but ‘fly’ a very small distance above the surface –the fly height typically between around 0.2 to 0.07 mm

© De Montfort University, 2005Comp5102/ L320 The Disk Surface The surface of a disk is logically divided into concentric circular tracks –1,000’s are now common The surface is also divided into segments –a track through a particular segment is a sector note: often the term sector is confusingly used to refer to both segments and sectors! –on typical PC disks, each sector holds 512 bytes

© De Montfort University, 2005Comp5102/ L321 data capacity of a disk is described best by: Disk Capacity = Cylinders * Heads * Sectors * (# bytes / disk block) A typical example for a 2.1 GB IDE disk on a Linux-based PC would be: C/H/S = 1024/64/63 Disk Capacity = 1024 * 64 * 63 * 512 bytes/block = bytes = 2.11 gigabytes

© De Montfort University, 2005Comp5102/ L322 File Allocation Tables The FAT is an index array of linked-list block numbers kept in its own disk block –the FAT contents are critical to finding all file blocks, so it is (usually) held twice at the start of each partition the root directory immediately follows the FATs The directory entry holds the start block of a file –the FAT entry indexed by that block number contains the block number of the next block in the chain –there is a special value to signify end of file Special values signify free blocks and bad blocks

© De Montfort University, 2005Comp5102/ L323 File Systems in Unix In Unix, the files are organized into a tree structure with a root named by the character '/'. –The first few levels of the tree look like this: