MAYURBHANJ SCHOOL OF ENGINEERING
PREPEARED BY:- BIBHUDENDRA SARANGI
TOPIC- File Management
2
What is File?
A file is sequence of logical records i.e. a sequence of bits and bytes.
3
File Attributes:
A file has various attributes like name, type, location, size, protection, time and data of creation, user information etc.
File naming
4
File naming=File name + File extension
Eg. Student.doc
In this example the Student is the file name and doc is the file extension
Some Common File extensions
5
File Attributes
6
A file has a name and data. Other than this, it contains information like date
and time of file creation, file’s current size etc. with a file. These are known as attributes of a file.
Operations that can be performed on files are:
7
8
Note: A file can be made read-only, hidden, system-file, and so-on by setting its read only flag to 1, its hidden flag to 1, its system flag to 1 and so on.
File Access Methods
9
10
Sequential Access
Random Access
11
Index Access method: Indexed file approach is helpful with multiple attribute fields like in database files. In these files, every field is associated with an index key. While querying data the index key is kept in the memory and related records are fetched from the disk.
12
Index Access Method
Directory Structure
13
A directory contains information about files.
A directory is used as a means to group the files owned by a user.
Hierarchical Directory Systems
14
Root
directory
User directory
files
(a)
(b)
( c )
Access paths
15
Two possible methods for access path are:
1. Absolute path name: It is a listing of the directories and files from the root directory to the intended file. For example, the path ‘c:/windows/programs/spss.exe’ means that the root directory contains a subdirectory ‘windows’, which further contains a subdirectory
‘programs’, that contains an executable “spss.exe”.
16
2. Relative path name: This uses the concept of current directory (also known as working directory). A user can specify a particular directory as his current working directory and all the path names instead of being specified from the root directory are specified relative to the working directory. For example, if the current working directory is ‘\user\curr’, then the file whose absolute path is ‘\user\curr\student’ can be referred simply as ‘student’.
Directory Operations
17
File Protection
18
1. File protection through Access Control
19
Following are the few file operations that can be controlled:
Access control list
20
This list may contain the user name and the types of access allowed for each user. The operating system checks this access control list (associated with a file) whenever a user requests an access to a particular file.
But one limitation of Access control list is their length, so we create groups.
21
Classify the users of a file into three types:
2. File protection through password
22
Files can be protected by a password. The owner of a file can control its access by assigning a password.
Thus, only those users who know the password, can access a particular file.
File System Implementation
23
There are 4 ways of File system implementation. They are the following:
1. Contiguous allocation
24
The simplest allocation scheme is to store each file as a contiguous block of data on the disk. Thus, on a disk having blocks size 1k, a 25k file would be allocated 25 consecutive blocks.
2. Linked list allocation
25
The second method for storing files is to keep each one as a linked list of disk blocks, as shown in Figure below. The first word of each block is used as a pointer to the next one. The rest of the block is used for storing data.
3. Linked list allocation using an index
In this technique instead of having a pointer, an index is maintained.
26
4. I-nodes
27
This method is used by UNIX operating system. In this scheme, each file is associated with a little table called an
i-node (index node).
Free Space Management
28
Free space management is used to reuse the disk space created after deleting the files.
We have 4 techniques for Free space management, Which are the following:
29
1. Bit map
The free space list is implemented as a bit map. Every bit represents a block on the disk. The bit for a block is 1 if it is free and it is 0 if the block is allocated.
2. Linked list
30
This approach maintains a linked list of all the free disk blocks. The first free block in the list can be pointed out by a head pointer, which is kept in a special location on the disk.
31
3. Grouping
Another approach is to store the addresses of n free blocks in the first free block. The last block contains the addresses of other n free blocks and so on.
4. Counting
32
Security
33
Security violations (misuse) of the system can be either accidental or intentional. It is easier to protect against the accidental misuse than to protect against the intentional misuse.
Security means Security from:
System can be protected from such threats at two levels:
34
Authentication
35
Authentication of a user is based on:
36
Encryption
Encryption is one such mechanism, which allows such data to be scrambled so that even if some one intercepts it on the network, it is not readable to him/her.
Encryption Schemes
37
Viruses, Worms and Trojans
38
Threat Monitoring
The security of a system can be done by a technique called Threat-monitoring.
39
The techniques that can be used for threat monitoring are:
1. A time sharing system can keep the count of the number of incorrect passwords given, when a user is trying to log in. More than a few incorrect attempts may signal an attempt to guess a password.
40
antivirus programs.
Protection
41
Protection mechanisms deal with Controlling the access of programs, processes or users to the
resources of a computer system.
Methods for Enforcement of Protection Mechanisms
There are 2 methods for Enforcement of Protection Mechanisms, which are the Following:
42
1. Access rights
43
Access rights consists of domain. Thus, a domain known as protection domain can be defined for a process. Such a domain will contain the set of objects and the types of operations that can be invoked on each object. This means that domain is a set of
<object, rights> pair.
For e.g. D = < data file F, {read, write} >; it can perform only read and write operations on the data file named ‘F’.
44
2. Access Matrix
It is used to describe which users have access to what objects (resources). Thus, basically it checks the access rights of users on system resources.
45