1. It becomes essential to store information for long-
term so that it can be accessed at any time.
2. it is also essential to make data sharable among
various processes.
3. This information can be huge in size and therefore,
must be accommodated on the appropriate storage
devices.
1
What is File?
A file is sequence of logical records i.e. a
sequence of bits and bytes.
File Attributes:
A file has various attributes like name, type,
location, size, protection, time and data of
creation, user information etc.
2
File naming
File naming=File name + File
extension
Eg. Student.doc
In this example the Student is
the file name and doc is the file
extension
3
Some Common File extensions
4
File Attributes
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.
5
Operations that can be performed on files
are:
1. CREATE: A blank file is created.
2. DELETE: The purpose of this system call is to delete
this file
3. OPEN: Open a file either for reading or writing.
4. CLOSE: When a file is no longer accessed.
6
 READ: When a file is only to be read.
 Write: To write some data on file.
 Append: To add some data to the end
of the file.
 Rename: To rename the file.
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.
7
File Access Methods
 Sequential Access: in this access method, data
records are retrieved in the same order in which
they have been stored on the disk. E.g data stored
on magnetic disk.
 Random Access: In case of random access the
record is searched from the disk based on its direct
address information. The technique used is
Hashing. In hashing every record is associated
with a key number to preprocess the address
calculation. Hash function is used to obtain
absolute address of a particular record.
8
9
Sequential Access
Random Access
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.
10
11
Index Access Method
Directory Structure
A directory contains information about
files.
A directory is used as a means to group
the files owned by a user.
12
Hierarchical Directory Systems
13
Root
directory User
directory
files
(a) (b) ( c )
Access paths
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”.
14
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 ‘usercurr’, then the file
whose absolute path is ‘usercurrstudent’ can be
referred simply as ‘student’.
15
Directory Operations
 CREATE: A directory is created.
 DELETE: A directory is deleted.
 OPENDIR: Directories can be opened for reading
it.
 CLOSEDIR: When a directory has been read, it
should be closed to free up internal table space in
main memory.
 RENAME: Directories can be renamed just like
files.
16
File Protection
 File systems often contain information that is highly
valuable to their users.
 Protecting this information against unauthorized
usage is therefore, a major concern of all the file
systems.
17
1. File protection through Access Control
 Following are the few file operations that can be
controlled:
 Read - Read a file
 Write - Write the file
 Append - Append a file
 Delete - Delete a file
 List - List the name and attributes of a file
 Rename - Rename a file
 Edit - Changing the contents of a file
 Copy - Make a copy of a file.
18
Access control list
 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.
19
Classify the users of a file into three types:
1. Owner - The user who created the file.
2.Group - A set of users who are sharing the file and
need similar access.
3.Universe - All remaining users in the system
constitute universe
20
2. File protection through password
 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.
21
File System Implementation
There are 4 ways of File system
implementation. They are the following:
1. Contiguous allocation
2. Linked list allocation
3. Linked list allocation using an index
4. I-nodes
22
1. Contiguous allocation
 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.
23
2. Linked list allocation
 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.
24
3. Linked list allocation using an index
In this technique instead of having a pointer, an index is
maintained.
25
4. I-nodes
 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).
26
Free Space Management
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:
1. Bit map
2. Linked list
3. Grouping
4. Counting
27
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.
28
2. Linked list
 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.
29
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.
30
4. Counting
 In this technique, instead of keeping a list of addresses
of n free blocks, it is more convenient to keep the
address of the first free blocks and the number n of
free contiguous blocks that follow the first block.
31
Security
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:
 Theft of information
 Unauthorized modification of data
 Unauthorized destruction of data
32
System can be protected from
such threats at two levels:
1. Physical
2. Human
33
Authentication
Authentication of a user is based on:
1. User identifier and password (Passwords)
2.Artifact-based Authentication: Badge card
possessed by a user (Artifacts)
3.Finger prints, retina pattern (Biometrics techniques)
34
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.
35
Encryption Schemes
These are two kinds of encryption:
1. ‘Symmetrical Encryption’ or secret key which uses a
single key to encrypt and decrypt the transmitted data.
2.‘Asymmetrical Encryption’ which uses ‘Private Key’, in
which one key is used to encrypt and another to
decrypt the transmitted data.
36
Viruses, Worms and Trojans
 A computer virus is a small program written to alter
the way a computer operates and it executes without
the permission or knowledge of the user.
 Worms are basically the programs that replicate
themselves from system to system without the use of a
host file.
 Trojan horses are impostors - files that claim to be
something desirable, but in fact, are malicious.
37
Threat Monitoring
The security of a system can be done by a
technique called Threat-monitoring.
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.
38
2. Audit log is another common technique used for
threat monitoring. An audit log records the time of
use, the details of users etc.
3. The system can be scanned periodically for
security holes. Scanning can be done when the
system has less traffic.
4. In case we are using Internet use firewall and
antivirus programs.
39
Protection
Protection mechanisms deal with
Controlling the access of programs,
processes or users to the
resources of a computer system.
40
Methods for Enforcement of Protection
Mechanisms
There are 2 methods for Enforcement of
Protection Mechanisms, which are the
Following:
1. Access rights
2. Access matrix
41
1. Access rights
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’.
42
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.
43
44

File management

  • 1.
    1. It becomesessential to store information for long- term so that it can be accessed at any time. 2. it is also essential to make data sharable among various processes. 3. This information can be huge in size and therefore, must be accommodated on the appropriate storage devices. 1
  • 2.
    What is File? Afile is sequence of logical records i.e. a sequence of bits and bytes. File Attributes: A file has various attributes like name, type, location, size, protection, time and data of creation, user information etc. 2
  • 3.
    File naming File naming=Filename + File extension Eg. Student.doc In this example the Student is the file name and doc is the file extension 3
  • 4.
    Some Common Fileextensions 4
  • 5.
    File Attributes A filehas 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. 5
  • 6.
    Operations that canbe performed on files are: 1. CREATE: A blank file is created. 2. DELETE: The purpose of this system call is to delete this file 3. OPEN: Open a file either for reading or writing. 4. CLOSE: When a file is no longer accessed. 6
  • 7.
     READ: Whena file is only to be read.  Write: To write some data on file.  Append: To add some data to the end of the file.  Rename: To rename the file. 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. 7
  • 8.
    File Access Methods Sequential Access: in this access method, data records are retrieved in the same order in which they have been stored on the disk. E.g data stored on magnetic disk.  Random Access: In case of random access the record is searched from the disk based on its direct address information. The technique used is Hashing. In hashing every record is associated with a key number to preprocess the address calculation. Hash function is used to obtain absolute address of a particular record. 8
  • 9.
  • 10.
    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. 10
  • 11.
  • 12.
    Directory Structure A directorycontains information about files. A directory is used as a means to group the files owned by a user. 12
  • 13.
    Hierarchical Directory Systems 13 Root directoryUser directory files (a) (b) ( c )
  • 14.
    Access paths Two possiblemethods 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”. 14
  • 15.
    2. Relative pathname: 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 ‘usercurr’, then the file whose absolute path is ‘usercurrstudent’ can be referred simply as ‘student’. 15
  • 16.
    Directory Operations  CREATE:A directory is created.  DELETE: A directory is deleted.  OPENDIR: Directories can be opened for reading it.  CLOSEDIR: When a directory has been read, it should be closed to free up internal table space in main memory.  RENAME: Directories can be renamed just like files. 16
  • 17.
    File Protection  Filesystems often contain information that is highly valuable to their users.  Protecting this information against unauthorized usage is therefore, a major concern of all the file systems. 17
  • 18.
    1. File protectionthrough Access Control  Following are the few file operations that can be controlled:  Read - Read a file  Write - Write the file  Append - Append a file  Delete - Delete a file  List - List the name and attributes of a file  Rename - Rename a file  Edit - Changing the contents of a file  Copy - Make a copy of a file. 18
  • 19.
    Access control list 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. 19
  • 20.
    Classify the usersof a file into three types: 1. Owner - The user who created the file. 2.Group - A set of users who are sharing the file and need similar access. 3.Universe - All remaining users in the system constitute universe 20
  • 21.
    2. File protectionthrough password  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. 21
  • 22.
    File System Implementation Thereare 4 ways of File system implementation. They are the following: 1. Contiguous allocation 2. Linked list allocation 3. Linked list allocation using an index 4. I-nodes 22
  • 23.
    1. Contiguous allocation 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. 23
  • 24.
    2. Linked listallocation  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. 24
  • 25.
    3. Linked listallocation using an index In this technique instead of having a pointer, an index is maintained. 25
  • 26.
    4. I-nodes  Thismethod is used by UNIX operating system. In this scheme, each file is associated with a little table called an i-node (index node). 26
  • 27.
    Free Space Management Freespace 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: 1. Bit map 2. Linked list 3. Grouping 4. Counting 27
  • 28.
    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. 28
  • 29.
    2. Linked list 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. 29
  • 30.
    3. Grouping  Anotherapproach 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. 30
  • 31.
    4. Counting  Inthis technique, instead of keeping a list of addresses of n free blocks, it is more convenient to keep the address of the first free blocks and the number n of free contiguous blocks that follow the first block. 31
  • 32.
    Security 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:  Theft of information  Unauthorized modification of data  Unauthorized destruction of data 32
  • 33.
    System can beprotected from such threats at two levels: 1. Physical 2. Human 33
  • 34.
    Authentication Authentication of auser is based on: 1. User identifier and password (Passwords) 2.Artifact-based Authentication: Badge card possessed by a user (Artifacts) 3.Finger prints, retina pattern (Biometrics techniques) 34
  • 35.
    Encryption  Encryption isone 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. 35
  • 36.
    Encryption Schemes These aretwo kinds of encryption: 1. ‘Symmetrical Encryption’ or secret key which uses a single key to encrypt and decrypt the transmitted data. 2.‘Asymmetrical Encryption’ which uses ‘Private Key’, in which one key is used to encrypt and another to decrypt the transmitted data. 36
  • 37.
    Viruses, Worms andTrojans  A computer virus is a small program written to alter the way a computer operates and it executes without the permission or knowledge of the user.  Worms are basically the programs that replicate themselves from system to system without the use of a host file.  Trojan horses are impostors - files that claim to be something desirable, but in fact, are malicious. 37
  • 38.
    Threat Monitoring The securityof a system can be done by a technique called Threat-monitoring. 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. 38
  • 39.
    2. Audit logis another common technique used for threat monitoring. An audit log records the time of use, the details of users etc. 3. The system can be scanned periodically for security holes. Scanning can be done when the system has less traffic. 4. In case we are using Internet use firewall and antivirus programs. 39
  • 40.
    Protection Protection mechanisms dealwith Controlling the access of programs, processes or users to the resources of a computer system. 40
  • 41.
    Methods for Enforcementof Protection Mechanisms There are 2 methods for Enforcement of Protection Mechanisms, which are the Following: 1. Access rights 2. Access matrix 41
  • 42.
    1. Access rights Accessrights 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’. 42
  • 43.
    2. Access Matrix Itis used to describe which users have access to what objects (resources). Thus, basically it checks the access rights of users on system resources. 43
  • 44.