Anda di halaman 1dari 19

1 | Page

OPERATING SYSTEMS
PART-B

October/November 2007

UNIT-I
a. Explain real time system.

Embedded system almost always runs real time operating system.


A real-time system is used when there are rigid time requirements on
the operation of a processor or the flow of data, and thus is often used as
a control device in a dedicated application. Systems that control
scientific experiments, medical imaging systems, industrial control
systems, and some display systems are real-time systems.
Processing must be done within the defined constraints, or the
system will fail. A real-time system is considered to function correctly
only if-it returns the correct result within any time constraints.
A real-time are of two types:
(i) Hard real-time systems: A hard real-time system guarantees
that critical tasks complete on time. This goal requires that all delays in
the system be bounded, from the retrieval of stored data to the time that
it takes the operating system to finish any request made of it. Such time
constraints dictate the facilities that are available in hard real-time
systems.
(ii) Soft real-time systems: A less restrictive type of real-time
system is a soft real-time system, where a critical real-time task gets
priority over other tasks, and retains that priority until it completes. As in
hard real-time systems, kernel delays need to be bounded: A real-time
task cannot be kept waiting indefinitely for the kernel to run it. Soft real
time is an achievable goal that is amenable to mixing with other types of
systems. Soft real-time systems, however, have more limited utility than
do hard real-time systems.

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

2 | Page

b. Explain batch processing system and its limitations.

Batch Processing System: It is designed to maximize


resources utilization to assure that all available CPU type, memory
and I/O devices are used efficiently. In the network environment
user stores resources as networking and about the nature of the job
and submitted to the computer. The job was usually in the form of
punched cards and sometime later the output appeared. The output
consists of result of final memory and register consists for
debugging. Its major task was to transfer control automatically
from one job to the next. The operating system was resident in
memory.
To speed up processing job, operators batched together jobs
with similar needs and ran them through the computer as a group.
In such batch system the computer operator would sort
programs into batches with similar requirements and, as the
computer, became available, would run each batch. The output from
each job would be sent back to the appropriate programmer.

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
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

3 | Page

c. Explain multiprogrammed systems.

The operating system keeps several jobs in memory


simultaneously. These setup services like computer and print
servers. Their system is designed to compromise between useability and resource ability as in resource allocation.
A computer system has many resource hardware and
software, that may be registered to solve in problems CPU,
memory space, file storage case, I/O devices and so on. The OS
acts as the manager of these resources. The operating system is a
control program to prevent errors and improves use of the
computer. Operating system is one program that is running at all
time on the computer usually called kernel, as provides user with
direct interface that may be command line interface or GUI where
the operating systems are therefore fairly sophisticated.

(Memory layout for Multiprogramming System)


All the jobs that enter the system are kept in the job pool. This pool
consists of all processes residing on disk awaiting allocation of
main memory. If several jobs are ready to be brought into memory,
and if there is not enough room for all of them, then the system
must choose among them.
Making this discussion is job scheduling. When the
operating system selects a job into memory for execution. If
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

4 | Page

several jobs are ready to run at the same time, then the system must
choose among them. Making this decision is CPU scheduling.
d. Discuss about Time sharing systems. (November/December 2009)

Time sharing, or multitasking, is a logical extension of


multiprogramming. Multiple jobs are executed by the CPU switching
between them, but the switches occur so frequently that the users may
interact with each program while it is running.
A time-shared operating system allows many users to share the
computer simultaneously. Since each action or command in a tomeshared system tends to be short, only title CPU time is needed for each
other. As the system switches rapidly from one user to the next, each
user is given the impression that the entire computer system is dedicated
to her use, even though it is being shared among many users.
A time-shared operating system uses CPU scheduling and
multiprogramming to provide each user with a small portion of a timeshared computer. Each user has at least one separate program in
memory. A program that is loaded into memory and is executing is
commonly referred to as a process. When a process executes, it typically
executes for only a short time before it either finishes or needs to
perform I/O.
Time-sharing operating systems are even more complex than are
multiprogrammed operating systems. As in multiprogramming, several
jobs must be kept simultaneously in memory, which requires some form
of memory management and protection.
e. Explain multiprocessor system.

Multiprocessor system is also known as parallel system or


tightly coupled systems, are growing in importance such systems
have two or more processing, in close communication sharing the
computer bus and sometimes the clock memory, peripheral
devices.
Its main three advantages are:

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

5 | Page

1. Increased throughput: By increasing the number of processors,


expect to get more work done in less time. The speed-up ratio with
N processor is not N, however; rather it is less than N.
2. Economy of Scale: Multiprocessor system can cost less than
equivalent multiple single processor system, because they can
share peripherals, mass storage and power suppliers. If several
programs operate on the same set of data, it is cheaper to store data
on one disk and to have all processor share them than to have
many copies of data.
3. Increased reliability: If functions can be distributed properly
among several processors, then the failure of one processor will
not halt the system, only show it down. If we have ten processors
and one fails, then each of the remaining 9 processors can pick up
a share of work of failed processor. Thus the entire system runs
only 10% slower rather than failing together.
2 Mark Questions
1. What do you mean by CPU scheduling?
When the operating system selects a job from the job
pool, it loads that job into memory for execution. If several
jobs are ready for execution or to run at the same time, the
system must choose among them, making this decision is
called CPU scheduling.
2. An operating system is a control program. Justify your
answer?
An operating system is a program that manages the
computer hardware. It also provides a basis for application
programs and acts as an intermediary between a user of a
computer and the computer hardware. So operating system is
a control program.
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

6 | Page

3. What are the components of a computer system?


Components of a computer system are its hardware,
software and data.
4. List out any two operating system services.
Operating system services:
1. Program execution
2. I/O operation
3. File system manipulation
4. Communications
5. Error detection
5 Mark Questions

1. Explain the services of operating system.


Operating-system services are provided for the convenience
of the programmer, to make the programming task easier.
Program execution: The system must be able to load a program
into memory and to run it. The program must be able to end its
execution, either normally or abnormally (indicating error).
I/O operations: A running program may require I/O. This I/O may
involve a file or an I/O device. For specific devices, special
functions may be desired (such as rewind a tape drive, or blank the
screen on a CRT). For efficiency and protection, users usually
cannot control I/O devices directly. Therefore, .the operating
system must provide some means to do I/O.
File-system manipulation: The file system is of particular
interest. It should be obvious that programs need to read and write
files. They also" need to create and delete files by name.
Communications: There are many circumstances in which one
process needs to exchange information with another process. There
are two major ways in which such communication can occur. The
first takes place between processes executing on the same
computer; the second takes place between processes executing on

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

7 | Page

different computer systems that are tied together by a computer


network. Communications may be implemented via shared
memory, or by the technique of message passing, in which packets
of information are moved between processes by the operating
system.
Error detection: The operating system constantly needs to be
aware of possible errors. Errors may occur in the CPU and memory
hardware (such as a memory error or a power failure), in I/O
devices (such as a parity error on tape, a connection failure on a
network, or lack of paper in jne printer), or in the user program
(such as an arithmetic overflow, an attempt to access an illegal
memory location, or a too great use of CPU time). For each type of
error, the operating system should take the appropriate action to
ensure correct and consistent computing.
2. Explain the following:
i. Single level directory structure.
ii. Tree directory structure.
i. Single level directory: The simplest directory structure is the
single-level directory. All files are contained in tjie same directory,
which is easy to support and understand.
A single-level directory has significant limitations, however,
when the number of files increases or when there is more than one user.
Since all files are in the same directory, they must have unique names. If
we have two users who call their data file test, then the unique-name rule
is violated.

Single directory structure

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

8 | Page

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 11character file names; UNIX allows 255 characters.
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.

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

9 | Page

3. Briefly explain the concept of bit vector in free space


management.
The free-space list is implemented as a bit map or bit vector.
Each block is represented by 1 bit. If the block is free, the bit is 1; if the
block is allocated, the bit is 0.
For example, consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12, 13,
17, 18, 25, 26, and 27 are free, and the rest of the blocks are allocated.
The free-space bit map would be
001111001111110001100000011100000 ...
The main advantage of this approach is that it is relatively simple and
efficient to find the first free block, or n consecutive free blocks on the
disk. Indeed, many computers supply bit-manipulation instructions that
can be used effectively for that purpose. Bit vectors are inefficient unless
the entire vector is kept in main memory.
The calculation of the block number is
(number of bits per word) x (number of 0-value words) + offset of first 1 bit
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

10 | P a g e

4. Explain the different file operations.


A file is an abstract data type. To define a file properly, we need to
consider the operations that can be performed on files. The operating
system provides system calls to create, write, read, reposition, delete,
and truncate files.
1. Creating a file: Two steps are necessary to create a file. First,
space in the file system must be found for the file. We shall discuss
how to allocate space for the file. An array for the new file must be
made in the directory. The directory entry records the name of the
file and the location in the file system.
2. Writing a file: To write a file, we make a system call specifying
both the name of the file and the information to be written to the
file. Given the name of the file, the system searches the directory
to find the location of the file. The system must keep a write
pointer to the location in the file where the next bwrite is to take
place. The pointer must be updated whenever the write occurs.
3.
4. Reading a file: To read from a file, we use a system call that
specifies the name of the file and where (in memory) the next
block of the file should be put. Again, the directory is searched for
the associated directory entry, and the system needs to keep a read
pointer to the location in the file where the next read is to take
place. Once the read has taken place, the read pointer is updated.
5. Repositioning within a file: The directory is searched for the
appropriate entry, and the current-file-position is set to a given
value. Repositioning within a file does not need to involve any
actual I/O. This file operation is also known as a file seek.
6. Deleting a file: To delete a file, we search the directory for the
named file. Having found the associated directory entry, we release
all file space (so that it can be reused by other files) and erase the
directory entry.
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

11 | P a g e

7. Truncating a file: There are occasions when the user wants the
attributes of a file to remain the same, but wants to erase the
contents of the file. Rather than forcing the user to delete the file
and then recreate it, this function allows all attributes to remain
unchanged (except for file length) but for the file to be reset to
length zero and its file space released.
5. Explain direct access method of a file.
Direct Access Method: Direct access method is also known as
relative access. A file is made up of fixedlength 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. A direct-access file
allows arbitrary blocks to be read or written.
Direct-access files are of great use for immediate access to large
amounts of information. Databases are often of this type. When a query
concerning a particular subject arrives, we compute which block
contains the answer, and then read that block directly to provide the
desired information.

Sequential Acess Files


For the direct access method the file operations must be modified
to include the block number as a parameter. The block number provided
the user to the operating system is normally a relative block number. A
relative block number is an index relative to the beginning of the file.
Given a logical record length L, a request for record N is turned
into an I/O request for L bytes starting at location L * (N -I) within the
file (assuming first record is N = 1). Since logical records are of a fixed
size, it is also easy to read, write, or delete a record.
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

12 | P a g e

Some systems allow only sequential file access; others allow only
direct access., Some systems require that a file be defined as sequential
or direct when it is created; such a file can be accessed only in a manner
consistent with its declaration.

6. Explain sequential access methods on a file.


The simplest access method is sequential access. Information
in the file is processed in order, one record after the other. This
mode of access is by far the most common.
For example: Editors & Compilers usually access files in this
fashion.
The bulk of the operations of a file is reads and writes. A read
operations reads the next portion of the file and advances to the
end of the newly written material (the new end of file). Such 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 sequential access is based on a tape model of
a file, and works as well an sequential access device as it does on
random access ones.
7. List the attributes of a file.
1. Name
2. Identifier
3. Type
4. Location
5. Size
6. Protection
7. Time, data and user identifier
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

13 | P a g e

8. What is ISAM? How it is organized?


ISAM stands for Index Sequential Access Method.
These methods can be build on top of a direct-access method.
These methods generally involve the construction of an index for
the file.
9. What is spooling?
Spooling is a simultaneously peripheral operation on line. It
ia a technique used in batched processing system to improve the
I/O state and overcome the disadvantage.

10. Differentiate between text file and executable file.


A text file is a sequence of characters recognize into file and
possibly pages.
Executable file is a series of code section that the ladder can
bring into memory and execute.
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

14 | P a g e

11. Define file pointer and access rights of a file?


File pointer: On systems that do not include a file offset as
part of the read and write system calls, the system must track
the last read/write location as a current-file-position pointer.
This pointer is unique to each process operating on the file,
and therefore must be kept separate from the on-disk file
attributes.
Access rights: Each process opens a file in an access mode.
The information is stored on the preprocessor table so the
operating system can allow or deny subsequent I/O request.
Kernel: The one program running all times on the computer
is called kernel, with all else bring application program.
Job Scheduling: If several jobs are ready to be brought into
memory and if there is not enough rooms for all of them then
the operating system must choose among them making this
decision is called Job Scheduling.
CPU Scheduling: If several jobs are ready to run at the same
time, then the system must choose among them. Making the
decision is CPU scheduling.
Process: loaded into memory and executing is commonly
known as process.
Text file: Is a sequence of characters organizing into file and
possibly pages.
Source file: Is a sequence of subroutine and functions is each
of which is further organized as declaration followed by
executable statement.
Object file: Is a sequence of bytes organized into blocks
understandable by linkers.
Executable file: Is a series of code section that the ladder can
bring into memory and execute.
File: A file is named collection of related information that is
recorded on secondary storage.
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

15 | P a g e

12. What is an operating system? Explain any two types of


operating systems.
An operating system is a program that manages the
computers hardware. It also provides an intermediate
between the user of a computer and the computers
hardware.
1. Multiprogrammed System
2. Real-time System

13. Explain indexed file allocation method.


These methods can be built on top of a direct access method.
These methods generally involve the construction of an index for a file.
The index like an index in the back of the book. Contains the pointers to
various blocks. To find the record in the file, we first search the index
and then use the pointer to access the file directly and to find the desired
record.
With large files the index file itself may become too large to be
kept in memory. One solution is to create an index for the index file. The
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

16 | P a g e

primary index file would contain pointers to secondary indexed files,


which would point to the actual data items.

14. Explain any 5 major activities of operating system regard to


process management?
Process Management: A program does nothing unless its
instructions are executed by a CPU. A process can be thought of as a
program in execution, but its definition will broaden as we explore it
further. A process needs certain resources, including CPU time, memory,
files, and I/O devices, to accomplish its task. These resources are either
given to the process when it is created, or allocated to it while it is
running.
A process is the unit of work in a system. Such a system consists of
a collection of processes, some of which are operating-system processes
(those that execute system code) and the rest of which are user processes
(those that execute user code).
The creation and deletion of both user and system processes
The suspension and resumption of processes
The provision of mechanisms for process synchronization
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

17 | P a g e

The provision of mechanisms for process communication


The provision of mechanisms for deadlock handling

15. List the advantages of Time sharing system over


multiprogramned system?
Time sharing system is a popular representation of
multiprogrammed multiuser system. One of the primary object
of multiuser system is general and time sharing system in
particular is good terminal response time.
Giving the illustration to each user of having a machine to
oneself. Time sharing systems often attempt to provide equitable
sharing of common resources.
Time sharing and multiprogramming require that several
jobs be kept. Simultaneously if several jobs are ready to be
brought into the memory and if there is not enough room for all
of them, making this decision is called job scheduling. If
several jobs are ready to run at the same time, then the system
must choose among them, making this decision is called CPU
scheduling.
In a time sharing system, the operating must ensure
reasonable response time, which is sometimes accomplished
through swapping, where processes are swapping in and out of
main memory to the disk.

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

18 | P a g e

16. Explain the various mechanisms used to protect files.


When information is kept in a computer system a
major concern is its protection from both physical damage and
improper access.
Protection can be provided in many ways
Types of access: The need for protection is a direct result of
the ability to access file on systems that do not permit
access to files of other users, protection is not needed. Thus
one extreme would be to provide complete protection by
prohibiting access. The extreme id to provide free access
with no protection. Both of these approaches are extreme
for general use.
Protection mechanism provides controlled access by
limiting the types of file access that can be made. Access is
permitted or denied depending on several factors. One of
which is the type of access requested. Several different
types of operations may be controlled
i. Read: Read from file.
ii. Write: Write or rewrite the file.
iii. Execute: Load the file into memory and execute it.
iv. Append: Write new information at the end of the file.
v. Delete: Delete the file and free its space for possible
reuse.
vi. List: List the name and attribute of files.
OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

19 | P a g e

Access lists and groups:


The most common approach to the protection
problem is to make access dependent on the identity of
the users, various users may need different type of
access to a file or directory constructing such a list
may be a tedious and unrewarding task especially if
we do not know in advance the list of users in the
system. The directory entry that previously was fixed
size resulting in space management being more
complicated. These problems can be resolved by use
of a condensed version of the access list.
To condense the length of the access list many
systems recognize this classification of users in
connection with each file
Owner: The user who created the file.
Group: A set of users who are sharing the file and need
similar access is a group.
Universe: A set of users in the system constitute the
universe.
Other protection approach: There is no approach to the
protection problem, which is to associate a password with
each file. Just as access to the computer system itself is
often controlled by a password access to each file can be
controlled by a password.

OPERATING SYSTEMS

NOMAN MOHAMED HANIF III SEMESTER (B.C.A.)

Anda mungkin juga menyukai