* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 10-11 File Systems
Object storage wikipedia , lookup
Asynchronous I/O wikipedia , lookup
Lustre (file system) wikipedia , lookup
File system wikipedia , lookup
Design of the FAT file system wikipedia , lookup
Disk formatting wikipedia , lookup
File Allocation Table wikipedia , lookup
Computer file wikipedia , lookup
Chapter 10-11 File Systems file offset pointer per-process current-file-position pointer Mac OS/X files resource fork o data type o creator type data fork Unix files magic number o executable file o batch file – shell script file extensions – provides hint but is not controlling as to use sequence of 8-bit bytes Text files – ascii Executable files – relocatable object code – tables or relocatable addresses Internal File Structure – Disk Systems sector size block size disk I/O is done in units of blocks blocks are all the same size disks have no external fragmentation blocks may have internal fragmentation packing data into blocks -- may eliminate internal (block) fragmentation but may make data more difficult to locate packing data into bytes – unrelated to current topic, e.g., see binary coded decimals Disk System Partitions -- segregate portions of the disk system for File Systems o Directory Structures o Files -- Data Storage Swap Space Raw Disk Space Remark: A file system may span multiple disks as long as they, the disks, are included in one partition File System Structure I/O transfers of data between memory and disk – blocks block contains some number of sectors sector size consists of some multiple of 32 bytes, normally 512 bytes frame, page and frames are normally sized such blocks and frames contain some multiple of one another and thus there is no inter-media fragmentation Levels 0. I/O Control -- device drivers Device Driver physical block information -drive, cylinder, track, sector (translates) specific bit patterns written to specified memory locations or registers Device Controller disk 1. Basic File System Manages Memory Buffers & Data Caches Transfer Data Block (in-use) Transfer Data Block (in-reserve) file-system data, directory data Transmits 2. File-Organization Module possibly used by multiple file systems Logical Block Information Physical Block Information File Allocation Information Free-Space Manager – tracks unallocated blocks 3. Logical File System File Name with path Manages Meta-Data Directory Structure File Structure File-Control Block (FCB), i.e., UNIX inode ownership, permissions, location of file contents, last modification date protection security UNIX Unix File System (UFS) derived from the Berkeley Fast File System (FFS) Windows XP FAT, FAT32, NTFS (Windows NT File System) Linux Extended File System ext2, ext3 supports 40+ other file systems partition == volume == file system storage space On-Disk Structures Boot Control Block UFS – boot block; NTFS – partition boot sector o one per partition o information necessary to boot operating system from the partition o may be empty, i.e., there is no operating system on the volume o normally it is the first block of a volume Volume Control Block UFS – superblock; NTFS – stored as part of the Master File Table o one per partition o number of blocks in partition o block size o free-block count o free-block pointers o free-FCB (inode) count o FCB (inode) pointers Directory Structure o one per file system o UFS – file names & associated inode numbers o NTFS – stored as part of the Master File Table File Control Block (FCB), i.e., Unix inode structure o one per file o details about the file o unique identifier (Unix inode) number directory entry (Unix inode number) o NTFS – stored as part of the Master File Table (relational database, one row per file) In-Memory Structures Mount Table o contains information about each mounted volume Directory-Structure Cache o holds directory information about recently accessed directories System-Wide Open-File Table o contains a copy of the FCB, i.e., inode, of each open file Per-Process Open-File Table o contains a pointer to the appropriate entry in the System-Wide Open-File Table I/O Memory Buffers o hold file-system blocks while they are being read from or written to disk File Creation application process requests the creation of a new file logical file system allocates a new FCB, i.e., inode structure, the FCB is either o allocated from free memory or o selected from a pre-allocated set of free-FCB, i.e., free-inodes appropriate directory is updated with the new file name and FCB, i.e., inode Directories Unix – directories are treated as files containing special data Windows – directories differently from files; they require a separate set of systems calls to create, manipulate, etc Operations open( ) o search System-Wide Open-File Table to see if file is currently in use if it is, create a Per-Process Open-File table entry pointing to the existing System-Wide Open-File Table if it is not, search the directory for the file name; once found, place the FCB in the System-Wide Open-File Table o make an entry, i.e., Unix file descriptor, Windows file handle in the Per-Process Open-File Table, with pointers to the entry in the System-Wide Open-File Table and other fields which include a pointer to the current location in the file and the access mode in which the file is open o increment the open cont in the System-Wide Open-File Table o returns a pointer to the appropriate entry in the Per-Process Open-File Table o all subsequent operations are performed with this pointer P0 Per-Process Open-File Table fp0 P5 offset pointer status information System-Wide Open-File Table (Unix UFS Directory System) data location access mode information creation/modification date file size open count (files currently accessing) File Control Block, i.e., Unix inode P0 and P1 File Control Block, i.e., Unix inode P17 fp1 P1 Per-Process Open-File Table offset pointer status information File Control Block, i.e., Unix inode process closes file Per-Process Open-File Table entry is removed; open count decremented all processes close file copy in-memory directory information to disk and System-Wide Open-File Table is removed from memory Unix i-node System inode 34 Unix Directory filename proj1 midterm notes6July inode “number” 34 65 108 data data data data data Unix (UFS) System-Wide Open-File Table holds inodes for files, directories, devices, and network connections inode numbering system is only unique within a given file system across file systems, the use of a pointer is required Mounting File Systems Boot Block – series of sequential blocks containing a memory image of a program, call the boot loader, that locates and mounts the root partition; the partition contains the kernel; the boot loader locates, loads, and starts the kernel executing In-memory mount table – external file systems must be mounted on devices, the mount table records the mount points, types of file systems mounted, and an access path to the desired file system Unix – the in-memory mount table contains a pointer to the superblock of the file system on that device Virtual File System inode object -- vnodes file object superblock object dentry object