Engineered for Tomorrow Subject Name Operating Systems Topic
Engineered for Tomorrow Subject Name: Operating Systems Topic details Subject Code: 10 CS 53 Prepared By: Mrs. Jisha Jose, Mrs. Thanu Kurian, Mrs. Preethi Sheba Hepsiba Department: Computer Science Date: 30/08/2014 12/3/2020
Engineered for Tomorrow • • • File Concept Topic details Access Methods Directory Structure File-System Mounting File Sharing Protection 12/3/2020
Engineered for Tomorrow File Attributes details • Name –Topic only information kept in human-readable form • Identifier – unique tag (number) identifies file within file system • Type – needed for systems that support different types • Location – pointer to file location on 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 • Information about files are kept in the directory structure, which is maintained on the disk 12/3/2020
Engineered for Tomorrow File Operations File is an abstract data type Topic details Create Write Read Reposition within file Delete Truncate Open(Fi) – search the directory structure on disk for entry Fi, and move the content of entry to memory • Close (Fi) – move the content of entry Fi in memory to directory structure on disk • • 12/3/2020
Engineered for Tomorrow Open Files Topic details • Several pieces of data are needed to manage open files: File pointer: pointer to last read/write location, per process that has the file open • File-open count: counter of number of times a file is open – to allow removal of data from open-file table when last processes closes it • Disk location of the file: cache of data access information • Access rights: per-process access mode information 12/3/2020
Engineered for Tomorrow Open File Locking • Provided by some operating systems and file Topic details systems • Mediates access to a file • Mandatory or advisory: – Mandatory – access is denied depending on locks held and requested – Advisory – processes can find status of locks and decide what to do 12/3/2020
Engineered for Tomorrow File Types – Name, Extension Topic details 12/3/2020
Engineered for Tomorrow Access Methods • Sequential Topic. Access details read next write next reset • Direct Access read n write n position to n read next write next rewrite n n = relative block number 12/3/2020
Engineered for Tomorrow Sequential-access File Topic details 12/3/2020
Engineered for Tomorrow Other access method-Index and Topic details Relative Files 12/3/2020
Engineered for Tomorrow A Typical File-system Organization Topic details 12/3/2020
Engineered for Tomorrow Directory Structure Operations Performed on Directory Topic details • • • Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system 12/3/2020
Engineered for Tomorrow Single-Level Directory -All files. Topic are in the same directory details Advantages • Easy to support and understand • Simple Disadvantages • When no of files increases, all files must have same names 12/3/2020
Engineered for Tomorrow Two-Level Directory Topic details Advantages • Separate directory for each user • Can have the same file name for different user • Efficient searching Disadvantage • Structure isolated one user from another 12/3/2020
Engineered for Tomorrow Tree-Structured Directories Topic details 12/3/2020
Engineered for Tomorrow Tree-Structured Directories (Cont. ) Advantages details • Efficient. Topic searching • Allows users to create their own subdirectory • Users can access files of other users also by specifying pathnames Disadvantages • User have to remember long path names Path names 2 types • absolute path name-begins at root • relative path name-begins from current directory 12/3/2020
Engineered for Tomorrow Acyclic-Graph Directories Topic details 12/3/2020
Engineered for Tomorrow General Graph Directory Topic details 12/3/2020
Engineered for Tomorrow File System Mounting Topic details • A file system must be mounted before it can be accessed • A unmounted file system is mounted at a mount point (an empty directory) For eg: on UNIX mount point is /home 12/3/2020
Engineered for Tomorrow (a) Existing (b) Unmounted Partition Topic details - Triangles represent subtrees of directories 12/3/2020
Engineered for Tomorrow Mount Point Topic details 12/3/2020
Engineered for Tomorrow File Sharing • Sharing of files on multi-user systems is Topic details desirable • Sharing may be done through a protection scheme • On distributed systems, files may be shared across a network • Network File System (NFS) is a common distributed file-sharing method 12/3/2020
Engineered for Tomorrow File Sharing – Multiple Users Topic details • File owner-controls the file, change attributes, grant access • Group-subset of users who can access the file • User IDs identify users, allowing permissions and protections to be per-user • Group IDs allow users to be in groups, permitting group access rights 12/3/2020
Engineered for Tomorrow Remote File Systems Topic details • Uses networking to allow file system access between systems Manually via programs like FTP • Distributed file systems • world wide web 1)Client-server model allows clients to mount remote file systems from servers Server can serve multiple clients • NFS is standard UNIX client-server file sharing protocol • Standard operating system file calls are translated into remote calls 2)Distributed Information Systems (distributed naming services) such as LDAP(lightweight directory access protocol) DNS, NIS(Network Information systems) implement unified access to information needed for remote computing 12/3/2020
Engineered for Tomorrow 3)Failure. Topic modes details • Failure in disk, network or hardware • If failure in client server system, client should delay its operations until server recovers • Store state information(knowledge of current activities and open files) in both client and server, to recover from failure 12/3/2020
Engineered for Tomorrow Protection Information should be safe from details • Physical. Topic damage(reliablility) • Improper access(protection) File owner/creator should be able to control: what can be done by whom • Controlled access-limiting the type of file access • Types of access Read Write Execute Append Delete List 12/3/2020
Engineered for Tomorrow Access Control list- specifies user name and type Topic details of access allowed for each user Each file and directory associated with an access control list Classification of users Owner-creator of file Group-set of users sharing the file Universe-all other users 12/3/2020
Engineered for Tomorrow Other protection methods Password for each file Topic details Disadvantage • User has to remember many passwords • If only one password for all files, once its is discovered, all files become accessible • So password is associated with subdirectory(directory protection) 12/3/2020
Engineered for Tomorrow File-System Structure Topicresides details on secondary storage (disks) -provides user • File system interface to storage, mapping logical to physical • Provides efficient and convenient access to disk by allowing data to be stored, located retrieved easily • Disk provides in-place rewrite and random access I/O transfers performed in blocks of sectors (usually 512 bytes) • • File system is composed of different levels I/O control consists of device drivers Basic file system issues commands to device drivers to read and write physical blocks File organisation module knows about files-type of allocation, location of file etc Logical file system manages the metadata 12/3/2020
Engineered for Tomorrow Layered File System Topic details 12/3/2020
Engineered for Tomorrow File-System Implementation Structures and operations used to implement file system operations • Boot control block contains info needed by system to Topic details boot OS from that volume – Needed if volume contains OS, usually first block of volume • Volume control block (superblock, master file table) contains volume details – Total no of blocks, no. of free blocks, block size, free block pointers or array • Directory structure organizes the files • Per-file File Control Block (FCB) contains many details about the file – permissions, size, dates 12/3/2020
Engineered for Tomorrow A Typical File Control Block Topic details 12/3/2020
Engineered for Tomorrow Partitions and Mounting Topiccan detailsbe sliced into multiple partitions • A disk • Partition can be raw(contains no file system) or cooked(contains file system) • Root partition contains the OS, other partitions can hold other OSes, other file systems, or be raw – Mounted at boot time – Other partitions can mount automatically or manually 12/3/2020
Engineered for Tomorrow Virtual File System • VFS is an abstraction layer on top of the Topic details concrete file system • It allows client applications to access different types of file systems in a uniform way 12/3/2020
Engineered for Tomorrow Schematic View of Virtual File System Topic details 12/3/2020
Engineered for Tomorrow Directory Implementation • Linear of file names with pointer to the Topiclist details data blocks – Simple to program – Time-consuming to execute • Linear search time • Could keep ordered alphabetically via linked list or use B+ tree • Hash Table – linear list with hash data structure – Decreases directory search time – Collisions – situations where two file names hash to the same location – Only good if entries are fixed size 12/3/2020
Engineered for Tomorrow Allocation Methods - Contiguous An allocation method refers to how disk Topic details blocks are allocated for files: • Contiguous allocation – each file occupies set of contiguous blocks – Best performance in most cases – Simple – only starting location (block no) and length (number of blocks) are required – Problems include finding space for file, knowing file size, external fragmentation, need for compaction 12/3/2020
Engineered for Tomorrow Contiguous Allocation of Disk Space Topic details 12/3/2020
Engineered for Tomorrow Allocation Methods - Linked Topic details • Linked allocation – each file a linked list of blocks – File ends at nil pointer – No external fragmentation – Each block contains pointer to next block – No compaction, external fragmentation 12/3/2020
Engineered for Tomorrow Linked Allocation Topic details 12/3/2020
Engineered for Tomorrow Variation of linked allocation-using FAT Topic details A section of disk contains the FAT has one entry for each disk block Directory entry contains block number of the first block of the file. Entry indexed by that block number contains block number of next block in file. • This continues until last block which contains a special eof value • • 12/3/2020
Engineered for Tomorrow Allocation Methods - Indexed Topic details • Indexed allocation – Each file has its own index block(s) of pointers to its data blocks • Logical view 12/3/2020 index table
Engineered for Tomorrow Example of Indexed Allocation Topic details 12/3/2020
Engineered for Tomorrow Size of index block Topic details • Linked scheme-for large files we can link together several index blocks • Multilevel index-first level index block points to second level index block, which points to the file blocks • Combined scheme-Say, first 12 pointers point to direct blocks( containing addres of blocks containing data files), next three points to indirect blocks 12/3/2020
Engineered for Tomorrow Free Space Management File system maintains free-space list to track Topic details available blocks/clusters • Bit vector or bit map (n blocks) For eg: consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 17, 18, 25, 26 and 27 are free. The free space bit map would be 0011111100000011100000…. 12/3/2020
Engineered for Tomorrow • Linked list Topic details Another method is to link together all the free disk blocks keeping a pointer to the first free block in a special location in disk 12/3/2020
Engineered for Tomorrow • Grouping Topic details Store addresses of n free blocks in the first free block. The last block contains addresses of another n free block and so on. . • Counting Store address of the first free block and number n of free contiguos blocks that follow in the first block 12/3/2020
- Slides: 47