unit1 os
unit1 os
2. What is a process?
A process is a program in execution. It is a unit of work within the system.
Program is a passive entity like the contents of a file stored on disk; process is
an active entity.
Process needs resources to accomplish its task
1. CPU, memory, I/O, files
2. Initialization data
10. List any two functions of Memory Management Component of the OS.
Keeping track of which parts of memory are currently being used and by
whom
11. List any two functions of Mass-Storage Management Component of the OS.
Mounting and unmounting
Free-space management
Storage allocation
Disk scheduling
Partitioning
Protection
12. List any two functions of Cache Management Component of the OS.
Faster storage (cache) checked first to determine if information is there
If it is, information used directly from the cache (fast)
If not, data copied to cache and used there
Disadvantages:
In this execution environment the CPU is often idle because of the speed of the
mechanized I/O device are slower than electronic device
where it is
stored in the storage hierarchy
Multiprocessor environment must provide cache coherency in hardware such
that all CPUs have the most recent value in their cache
Distributed environment situation even more complex
o Several copies of a datum can exist
I/O Subsystem
One purpose of OS is to hide peculiarities of hardware devices from the user
I/O subsystem responsible for
o Memory management of I/O including buffering (storing data
temporarily while it is being transferred), caching (storing parts of data
in faster storage for performance), spooling (the overlapping of output of
one job with input of other jobs)
o General device-driver interface
o Drivers for specific hardware devices
Protection and Security
Protection – any mechanism for controlling access of processes or users to
resources defined by the OS
Security – defense of the system against internal and external attacks
o Huge range, including denial-of-service, worms, viruses, identity theft,
theft of service
Java programs are first compiled to a Java byte code .class file and then
translated into an executable .dex file.
In one programming class, 23 students called the program for their second
assignment prog2; another 11 called it assign2.) Although file names are
generally selected to reflect the content of the file, they are often limited in
length. The MS-DOS operating system allows only 11-character file names;
UNIX allows 255 characters.
Mr K Praveen Kumar, SMC SHIRVA Page 26
Even with a single user, as the number of files increases, it becomes difficult to
remember the names of all the files, so as to create only files with unique names.
It is not uncommon for a user to have hundreds of files on one computer system
and an equal number of additional files on another system.
ii. Tree structured directory: Tree structured directory generalization allows
users to create their own sub- directories and to organize their files accordingly.
The tree has a root directory. Every file in the system has a unique path name. A
path name is the path from the root, through all the subdirectories, to a specified
file.
In normal use, each user has a current directory. The current directory should
contain most of the files that are of current interest to the user. When reference is
made to a file, the current directory is searched. If a file is needed that is not in
the current directory, then the user must either specify a path name or change the
current directory to be the directory holding that file. To change the current
directory to a different directory, a system call is provided that takes a directory
name as a parameter and uses it to redefine the current directory. The initial
current directory of a user is designated when the user job starts or the user logs
in. The path names can be of two types:
1. Absolute path name 2. Relative path name
1. An absolute path name begins at the root and follows a path down to the
specified file, giving the directory names on the path.
2. A relative path name defines a path from the current directory.
In the two-level directory structure, each user has own user file directory (UFD).
Each UFD has a similar structure, but lists only the files of a single user. When a
user job starts or a user logs in, the system's master file directory (MFD) is
searched. The MFD is indexed by user name or account number, and each entry
points to the UFO for that user (Figure).
Although the two-level directory structure solves the name-collision problem,
it still has disadvantages.
This structure effectively isolates one user from another.
This isolation is an advantage when the users are completely independent, but
is a disadvantage when the users want to cooperate on some task and to access
one another's files.
Some systems simply do not allow local user files to be accessed by other
users.
Acyclic-Graph Directories:
The common subdirectory should be shared. A shared directory or
file will exist in the file system in two or more places at once. A tree
structure prohibits the sharing of files or directories.
An acyclic graph is a graph with no cycles. It allows directories to
share subdirectories and files.
The same file or subdirectory may be in two different directories.
The acyclic graph is a natural generalization of the tree-structured
directory scheme.
Mr K Praveen Kumar, SMC SHIRVA Page 28
Two methods to implement shared-files (or subdirectories):
1. Create a new directory-entry called a link. A link is a pointer to
another file (or subdirectory).
2. Duplicate all information about shared-files in both sharing directories.
Two problems:
1. A file may have multiple absolute path-names.
2. Deletion may leave dangling-pointers to the non-existent file.
The write operation (write next) appends to the end of the file and
advances to the end of the newly written material.
A file can be reset to the beginning and on some systems, a
program may be able to skip forward or backward n records for
some integer n-perhaps only for n =1.
1. Direct Access
A file is made up of fixed length logical records that allow programs
to read and write records rapidly in no particular order.
The direct-access method is based on a disk model of a file, since
disks allow random access to any file block. For direct access, the
file is viewed as a numbered sequence of blocks or records.
Example: if we may read block 14, then read block 53, and then
write block 7. There are no restrictions on the order of reading or
writing for a direct-access file.
Disadvantages:
1. Finding space for a new file is difficult. The system chosen to
manage free space determines how this task is accomplished. Any
management system can be used, but some are slower than others.
Satisfying a request of size n from a list of free holes is a problem. First
fit and best fit are the most common strategies used to select a free
hole from the set of available holes.
2. The above algorithms suffer from the problem of external
fragmentation.
As files are allocated and deleted, the free disk space is broken
into pieces.