Download presentation
Presentation is loading. Please wait.
Published byGisela Fürst Modified over 6 years ago
1
Subject Name: Operating Systems Subject Code:10CS53
Prepared By:Mrs.Jisha Jose,Mrs.Thanu Kurian,Mrs.Preethi Sheba Hepsiba Department:Computer Science Date:30/08/2014 11/13/2018
2
File Concept Access Methods Directory Structure File-System Mounting File Sharing Protection
3
File Attributes Name – 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
4
File Operations File is an abstract data type 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
5
Open Files 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
6
Open File Locking Provided by some operating systems and file 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
7
File Types – Name, Extension
8
Access Methods Sequential Access read next write next reset
Direct Access read n write n position to n rewrite n n = relative block number
9
Sequential-access File
10
Other access method-Index and Relative Files
11
A Typical File-system Organization
12
Directory Structure Operations Performed on Directory
Search for a file Create a file Delete a file List a directory Rename a file Traverse the file system
13
Single-Level Directory
-All files are in the same directory Advantages Easy to support and understand Simple Disadvantages When no of files increases,all files must have same names
14
Two-Level Directory Advantages Separate directory for each user
Can have the same file name for different user Efficient searching Disadvantage Structure isolated one user from another
15
Tree-Structured Directories
16
Tree-Structured Directories (Cont.)
Advantages Efficient 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
17
Acyclic-Graph Directories
18
General Graph Directory
19
File System Mounting 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
20
(a) Existing (b) Unmounted Partition
- Triangles represent subtrees of directories
21
Mount Point
22
File Sharing Sharing of files on multi-user systems is 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
23
File Sharing – Multiple Users
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
24
Remote File Systems 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
25
3)Failure modes 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
26
Protection Information should be safe from
Physical 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
27
Access Control Access Control list- specifies user name and type 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
28
Other protection methods
Password for each file 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)
29
File-System Structure
File system resides on secondary storage (disks) -provides user 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
30
Layered File System
31
File-System Implementation
Structures and operations used to implement file system operations Boot control block contains info needed by system to 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
32
A Typical File Control Block
33
Partitions and Mounting
A disk can be sliced into multiple partitions 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
34
Virtual File System VFS is an abstraction layer on top of the concrete file system It allows client applications to access different types of file systems in a uniform way
35
Schematic View of Virtual File System
36
Directory Implementation
Linear list of file names with pointer to the 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
37
Allocation Methods - Contiguous
An allocation method refers to how disk 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
38
Contiguous Allocation of Disk Space
39
Allocation Methods - Linked
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
40
Linked Allocation
41
Variation of linked allocation-using FAT
A section of disk contains the FAT 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
42
Allocation Methods - Indexed
Indexed allocation Each file has its own index block(s) of pointers to its data blocks Logical view index table
43
Example of Indexed Allocation
44
Size of index block 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
45
Free Space Management File system maintains free-space list to track 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 ….
46
Linked list 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
47
Grouping 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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.