File Management
File Management
Sharing
Commonly, files represent programs (both source and object forms) and data. Data files
may be numeric, alphabetic, alphanumeric, or binary. Files may be free form, such as text
files, or may be formatted rigidly. In general, a file is a sequence of bits, bytes, lines, or
records, the meaning of which is defined by the file’s creator and user. The concept of a
file is thus extremely general.
File Types
However, Operating systems like MS_DOS and UNIX has the following 4 type of files:
2. Ordinary files
3. Directory Files
Directory contains files and other related information about those files. Its
basically a folder to hold and organize multiple files.
4. Special Files
These files are also called device files. It represents physical devices like printers,
disks, networks, flash drive, etc.
5. Functions of File
Create file, find space on disk, and make an entry in the directory.
Write to file, requires positioning within the file
Read from file involves positioning within the file
Delete directory entry, regain disk space.
Reposition: move read/write position.
FILE DIRECTORIES:
Collection of files is a file directory. The directory contains information about the files,
including attributes, location and ownership. Much of this information, especially that is
concerned with storage, is managed by the operating system. The directory is itself a file,
accessible by various file management routines.
Information contained in a device directory are:
Name
Type
Address
Current length
Maximum length
Date last accessed
Date last updated
Owner id
Protection information
Path name:Due to two levels there is a path name for every file to locate that
file.
Now,we can have same file name for different user.
Searching is efficient in this method.
TREE-STRUCTURED DIRECTORY:
Directory is maintained in the form of a tree. Searching is efficient and also there is
grouping capability. We have absolute or relative path name for a file.
The tree structured directory system doesn't allow the same file to exist in multiple
directories therefore sharing is major concern in tree structured directory system. We can
provide sharing by making the directory an acyclic graph. In this system, two or more
directory entry can point to the same file or sub directory. That file or sub directory is shared
between the two directory entries.
These kinds of directory graphs can be made using links or aliases. We can have multiple
paths for a same file. Links can either be symbolic (logical) or hard link (physical).
If a file gets deleted in acyclic graph structured directory system, then
1. In the case of soft link, the file just gets deleted and we are left with a dangling pointer.
2. In the case of hard link, the actual file will be deleted only if all the references to it gets
deleted.
Before you can access the files on a file system, you need to mount the file system.
Mounting a file system attaches that file system to a directory (mount point) and makes it
available to the system. The root (/) file system is always mounted. Any other file system
can be connected or disconnected from the root (/) file system.
When you mount a file system, any files or directories in the underlying mount point
directory are unavailable as long as the file system is mounted. These files are not
permanently affected by the mounting process, and they become available again when
the file system is unmounted. However, mount directories are typically empty, because
you usually do not want to obscure existing files.
For example, the figure below shows a local file system, starting with a root (/) file system
and subdirectories sbin, etc, and opt.
First, you must create a directory to use as a mount point for the file system you want to
mount, for example, /opt/unbundled. Once the mount point is created, you can mount the
file system (by using the mount command), which makes all of the files and directories
in /opt/unbundled available, as shown in the figure below. See Chapter 36, Mounting and
Unmounting File Systems (Tasks) for detailed instructions on how to perform these tasks.
File Sharing
File Sharing –Remote File Systems (Covered in detail in Computer Network Subject)
File Sharing – Failure Mode
File Protection
In computer systems, alot of user’s information is stored, the objective of the operating
system is to keep safe the data of the user from the improper access to the system.
Protection can be provided in number of ways. For a single laptop system, we might
provide protection by locking the computer in a desk drawer or file cabinet. For multi-
user systems, different mechanisms are used for the protection.
Types of Access :
The files which have direct access of the any user have the need of protection. The files
which are not accessible to other users doesn’t require any kind of protection. The
mechanism of the protection provide the facility of the controlled access by just limiting
the types of access to the file. Access can be given or not given to any user depends on
several factors, one of which is the type of access required. Several different types of
operations can be controlled:
Read –
Reading from a file.
Write –
Writing or rewriting the file.
Execute –
Loading the file and after loading the execution process starts.
Append –
Writing the new information to the already existing file, editing must be end
at the end of the existing file.
Delete –
Deleting the file which is of no use and using its space for the another data.
List –
List the name and attributes of the file.
Operations like renaming, editing the existing file, copying; these can also be controlled.
There are many protection mechanism. each of them mechanism have different
advantages and disadvantages and must be appropriate for the intended application.
Access Control :
There are different methods used by different users to access any file. The general way
of protection is to associate identity-dependent access with all the files and directories
an list called access-control list (ACL) which specify the names of the users and the types
of access associate with each of the user. The main problem with the access list is their
length.
To condense the length of the access-control list, many systems recognize three
classification of users in connection with each file:
Owner –
Owner is the user who has created the file.
Group –
A group is a set of members who has similar needs and they are sharing the
same file.
Universe –
In the system, all other users are under the category called universe.
The most common recent approach is to combine access-control lists with the normal
general owner, group, and universe access control scheme. For example: Solaris uses
the three categories of access by default but allows access-control lists to be added to
specific files and directories when more fine-grained access control is desired.
Other Protection Approaches:
The access to any system is also controlled by the password. If the use of password are is
random and it is changed often, this may be result in limit the effective access to a file.
The use of passwords has a few disadvantages:
The number of passwords are very large so it is difficult to remember the large
passwords.
If one password is used for all the files, then once it is discovered, all files are
accessible; protection is on all-or-none basis.