Unit 5
Unit 5
System Protection
Dr B.Soujanya
Assistant Professor
Department of Computer Science and Technology
GITAM Institute of Technology (GIT)
Visakhapatnam – 530045
Email: [email protected]
UNIT-5
It is a method of data collection that is used as a medium for giving input and
receiving output from that program.
File
Concepts
Different Components are
1. File Attributes
2. File Operations
3. File Types
4. File Structure
➔ Name – The symbolic file name is the only information kept in human-readable form.
➔ Identifier – A unique tag (i.e., an internal number) that identifies the file
➔ Time, date, and user identification – This information may be kept for creation,last
modification, and last use.These data can be useful for protection,security and
usage monitoring.
2. File Operations
A File is an abstract data type..
I. Creating a File
II. Writing a File -To write a file,we make a system call specifying both the name of
file and the information to be written to the file.
III. Reading a File: To read from a file, we use a system call specifying both the
name of the file and where the next block of the file should be kept.
IV. Repositioning within a file: The directory is searched for the appropriate entry,
and the current-file-position pointer is repositioned to a given value.
V. Deleting a File
VI. Truncating a file- The user may want to erase the contents of a file but keep its attributes.
3. File Types
4. File Structure
● Some files contain an internal structure, which may or may not be known to the OS.
● For the OS to support particular file formats increases the size and complexity of the OS.
● UNIX treats all files as sequences of bytes, with no further consideration of the internal structure.
( With the exception of executable binary programs, which it must know how to load
● Macintosh files have two forks - a resource fork, and a data fork. The resource fork
contains information relating to the UI, such as icons and button images, and can
be modified independently of the data fork, which contains the code or data as
appropriate
5. Internal File Structure
● Disk files are accessed in units of physical blocks, typically 512 bytes or some
power-of-two multiple thereof. ( Larger physical disks use larger block sizes, to
keep the range of block numbers within the range of a 32-bit integer. )
● Internally files are organized in units of logical units, which may be as small as a
structure size.
● The number of logical units which fit into one physical block determines its
Sequential-access file.
Access
Methods
2. Direct Access
● Jump to any record and read that record. Operations supported include:
○ read n - read record number n.
○ write n - write record number n.
○ jump to record n - could be 0 or the end of file.
○ Query current record - used to return back to this record later.
○ Sequential access can be easily emulated using direct access.
2. objfs – interface into kernel memory to get kernel symbols for debugging
● Each user / process has the concept of a current directory from which all (
relative ) searches take place.
● Files may be accessed using either absolute pathnames ( relative to the root of
the tree ) or relative path names ( relative to the current directory. )
● Directories are stored the same as any other file in the system, except there
is a bit that identifies them as directories, and they have some special
structure that the OS understands.
● One question for consideration is whether or not to allow the removal of
directories that are not empty - Windows requires that directories be emptied
first, and UNIX provides an option for deleting entire sub-trees.
Directory and Disk
Structure
Tree-structured directory structure.
Directory and Disk
Structure
3 Acyclic-Graph Directories
● When the same files need to be accessed in more than one place in the
directory structure ( e.g. because they are being shared by more than one
user / process ), it can be useful to provide an acyclic-graph structure. ( Note
the directed arcs from parent to child. )
● UNIX provides two types of links for implementing the acyclic-graph structure.
○ A hard link ( usually just called a link ) involves multiple directory entries
that both refer to the same file. Hard links are only valid for ordinary files
in the same filesystem.
○ A symbolic link, that involves a special file, containing information about
where to find the linked file. Symbolic links may be used to link directories
and/or files in other filesystems, as well as ordinary files in the current
filesystem.
Directory and Disk
Structure
Acyclic-graph directory structure.
Directory and Disk
Structure
4 General Graph Directory
Protection
● In computer systems, a lot of user’s information is stored, the
● For multi-user systems, different mechanisms are used for the protection.
Protectio
1 Types of Access
n
● The following low-level operations are often controlled:
○ Read - View the contents of the file
○ Write - Change the contents of the file.
○ Execute - Load the file onto the CPU and follow the instructions
contained therein.
○ Append - Add to the end of an existing file.
○ Delete - Remove a file from the system.
○ List -View the name and other attributes of files on the system.
Protectio
2 Access Control
n
● The most common approach to the protection problem is to make access
dependent on the identity of the user.
● Different users may need different types of access to a file or directory.
● The most general scheme to implement identity dependent access is to
associate with each file and directory an access-control list(ACL)
specifying user names and types of access allowed for each user.
The ACL may have three classifications of users of connection
● Some systems can apply passwords, either to individual files, or to specific sub-
directories, or to the entire system. There is a trade-off between the number of
passwords that must be maintained ( and remembered by the users ) and the
amount of information that is vulnerable to a lost or forgotten password.
● Older systems which did not originally have multi-user file access permissions
( DOS and older versions of Mac ) must now be retrofitted if they are to share
files on a network.
● Access to a file requires access to all the files along its path as well. In a cyclic
directory structure, users may have different access to the same file accessed
through different paths.
● Sometimes just the knowledge of the existence of a file of a certain name is a
security ( or privacy ) concern. Hence the distinction between the R and X bits
on UNIX directories.
Overview of Mass-Storage Structure
Traditional magnetic disks have the following basic structure:
● One or more platters in the form of disks covered with magnetic media. Hard disk
platters are made of rigid metal, while "floppy" disks are made of more flexible plastic.
● Each platter has two working surfaces. Older hard disk drives would sometimes
not use the very top or bottom surface of a stack of platters, as these surfaces
● Each working surface is divided into a number of concentric rings called tracks.
The collection of all tracks that are the same distance from the edge of the
● Each track is further divided into sectors, traditionally containing 512 bytes of
data each, although some modern disks occasionally use larger sector sizes.
● The data on a hard drive is read by read-write heads. The standard configuration
uses one head per surface, each on a separate arm, and controlled by a common
arm assembly which moves all heads simultaneously from one cylinder to another.
Mass-Storage Structure-Disk
Scheduling
1 FCFS Scheduling
3 SCAN Scheduling
4 C-SCAN Scheduling
5 LOOK Scheduling
Mass-Storage Structure-Disk
Scheduling
1 FCFS
. intrinsically fair, but not very efficient.
First-Come First-Serve is simple and
Under the SCAN algorithm, If a request arrives just ahead of the moving head then it
will be processed right away, but if it arrives just after the head has passed, then it will
have to wait for the head to pass going the other way on the return trip. This leads to a
fairly wide variation in access times which can be improved upon .
4.C-SCAN Scheduling
● The Circular-SCAN algorithm improves upon SCAN by treating all requests in
a circular queue fashion - Once the head reaches the end of the disk, it
returns to the other end without processing any requests, and then starts
again from the beginning of the disk:
5.LOOK Scheduling
LOOK scheduling improves upon SCAN by looking ahead at the queue of pending requests,
and not moving the heads any farther towards the end of the disk than is necessary.
Mass-Storage Structure-Swap-Space
Management
1 Swap-Space Use
2 Swap-Space Location
Need of Protection:
● To prevent the access of unauthorized users and
● To ensure that each active programs or processes in the system uses
resources only as the stated policy,
● To improve reliability by detecting latent error
1. Goals of Protection
2. Principles of Protection
3. Domain of Protection
4. Access Matrix
1.Goals of Protection
● In one protection model, computer consists of a collection of objects, hardware or software
● Each object has a unique name and can be accessed through a well-
● Protection problem - ensure that each object is accessed correctly and only
● Each user may be a domain.In this case,the set of objects that can be accessed
depends on the identity of the user.Domain switching occurs when the user is
changed-generally when one user logs out and another user logs in.
● Each process may be a domain.In this case, the set of objects that can be accessed
depends on the identity of the process.Domain switching occurs when one process
● Each procedure may be a domain.In this case,the set of objects that can be
domain have the right to copy that access within the same column, i.e. for the same
● If the asterisk is removed from the original access right, then the right is
transferred, rather than being copied. This may be termed a transfer right as
● If only the right and not the asterisk is copied, then the access right is added to
the new domain, but it may not be propagated further. That is the new domain