ADVANCED OPERATING
SYSTEMS
OVERVIEW
An operating system
is a program that manages the computer hardware. It provided a basis for
application programs and acts as an intermediary between the computer user and
the computer hardware. Main frame operating systems are designed primarily to
optimize utilization of hardware. PC operating systems support complex games,
business applications etc. Operating systems for handheld computers are
designed to provide an environment in which a user can easily interface with
the computer to execute programs. What operating systems do: A computer system
can be divided roughly into four components – the hardware, the operating
system, the application programs and the users. The hardware – which
consists of CPU, memory and I/O devices, provides the basic computing resources
for the system. The application programs define the ways in which these
resources are used to solve users’ computing problems. The operating system
controls and co-ordinates the use of hardware among the various application
programs for the various users.
Operating
system from the user view- The user’s view of the computer varies according to the
interface being used. While designing a PC for one user, the goal is to
maximize the work that the user is performing. Here OS is designed mostly for ease
of use. In another case the user sits at a terminal connected to a main
frame or minicomputer. Other users can access the same computer through
other terminals. OS here is designed to maximize resource utilization to assure
that all available CPU time, memory and I/O are used efficiently. In other
cases, users sit at workstations connected to networks of other
workstations and servers. These users have dedicated resources but they also
share resources such as networking and servers. Here OS is designed to
compromise between individual usability and resource utilization. Operating system
from the system view- From the computer’s point of view, OS is the program
which is widely involved with hardware. Hence OS can be viewed as resource
allocator where in resources are – CPU time, memory space, file storage
space, I/O devices etc. OS must decide how to allocate these resources to
specific programs and users so that it can operate the computer system
efficiently. OS is also a control program. A control program manages the
execution of user programs to prevent errors and improper use of computer. It
is concerned with the operation and control of I/O devices. Defining operating
systems- OS
exists because they offer a reasonable way to solve the problem of creating a
usable computing system. Goal of computer systems is to execute user program
and to make solving user problems easier. Hence hardware is constructed. Since
hardware alone is not easy to use, application programs are developed. Operating System
Structure- An OS provides an environment within which programs are
executed. One of the most important aspects of OS is its ability to multi
program. Multi programming increases CPU utilization by organizing jobs
(code and data) so that the CPU always has one to execute.
OS keeps several
jobs in memory. This set of jobs can be a subset of jobs kept in the job pool
which contains all jobs that enter the system. OS picks and begins to execute
one of the jobs in memory. The job may have to wait for some task, such as I/O
operation to complete. In a non multi programmed system, OS simply switches to
and executes another job. When that job needs to wait, CPU is switched to
another job and so on. As long as at least on job needs to execute, CPU is
never idle.
Multi programmed
systems provide an environment in which the various system resources are
utilized effectively but they do not provide for user interaction with the
computer system. Time sharing or multi tasking is a logical extension of
multi programming. In time sharing systems, CPU executes multiple jobs by
switching among them but the switches occur so frequently that the users can
interact with each program while it is running. Time sharing requires an interactive
computer system which provides direct communication between the user and
the system. A time shared operating system allows many users to share the
computer simultaneously. It uses CPU scheduling and multi programming to
provide each user with a small portion of a time shared computer. A program loaded
into memory and executing is called a process. Time sharing and multi
programming require several jobs to be kept simultaneously in memory. Since
main memory is too small to accommodate all jobs, the jobs are kept initially
on the disk 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 there is not enough space, then the system must
choose among them. Making this decision is job scheduling. Having
several programs in memory at the same time requires some form of memory
management. If several jobs are ready to run at the same time, the system must
choose among them. Making this decision is CPU scheduling.
In a time sharing
system, the operating system must ensure reasonable response time which is
accomplished through swapping where processes are swapped in and out of
main memory to the disk. Virtual memory is a technique that allows the
execution of a process that is not completely in memory. It enables users to
run programs that are larger than actual physical memory. Protection and
security- If
a computer system has multiple users and allows the concurrent execution of
multiple processes, then access to data must be regulated. Hence mechanisms ensure
that files, memory segments, CPU and other resources can be operated on by only
those processes that have gained proper authorization from the OS. Protection
is a mechanism for controlling the access of processes or users to the
resources defined by a computer system. This mechanism must provide means for
specification of the controls to be imposed and means for enforcement.
Protection improves reliability by detecting latent errors at the interfaces
between component sub systems. It is the job of security to defend a
system from external and internal attacks. Such attacks spread across a huge
range and include viruses and worms, denial of service attacks, identity theft
and theft of service. Distributed Systems- A distributed system is a collection of
physically separate, possibly heterogeneous computer systems that are networked
to provide the users with access to the various resources that the system
maintains. Access to a shared resource increases computation speed,
functionality, data availability and reliability. The protocols that create a
distributed system can greatly affect that system’s utility and popularity. A network
is a communication path between two or more systems. Distributed systems
depend on networking for their functionality. Networks are characterized based
on the distances between their nodes. A local area network (LAN)
connects computers within a room, a floor or a building. A wide area network (WAN)
links buildings, cities or countries. A metropolitan area network (MAN)
could link buildings within a city. Special Purpose Systems – Classes of computers
whose functions are limited and objective is to deal with limited computation
domains- Real Time Embedded Systems: Embedded computers are devices found from
car engines and manufacturing robots to VCR’s and microwave ovens. These have
specific tasks to accomplish. Embedded systems almost always run real time
operating system. Multimedia systems: Most operating systems are designed to
handle conventional data such as text files, programs, and word processing
documents and spread sheets. A recent trend is incorporation of multimedia data
into computer systems. Multimedia data consist of audio and video files as well
as conventional files. Handheld systems: Handheld systems include personal
digital assistants (PDA’s), cellular telephones many of which use special
purpose embedded operating systems. SYSTEM STRUCTURES OS services- OS provides an
environment for execution of programs. It provides certain services to programs
and to the users of those programs. OS services are provided for the
convenience of the programmer, to make the programming task easier. One set of
SOS services provides functions that are helpful to the user –
a. User interface:
All OS have a user interface(UI).Interfaces are of three types- Command Line
Interface: uses text commands and a method for entering them Batch interface:
commands and directives to control those commands are entered into files and
those files are executed. Graphical user interface: This is a window system
with a pointing device to direct I/O, choose from menus and make selections and
a keyboard to enter text.
b.
Program execution: System must be able to load a program into memory and run
that program. The program must be able to end its execution either normally or
abnormally.
c. I/O
operations: A running program may require I/O which may involve a file or an
I/O device. For efficiency and protection, users cannot control I/O devices
directly.
d. File
system manipulation: Programs need to read and write files and directories.
They also need to create and delete them by name, search for a given file, and
list file information.
e.
Communications: One process might need to exchange information with another
process. Such communication may occur between processes that are executing on
the same computer or between processes that are executing on different computer
systems tied together by a computer network. Communications may be implemented
via shared memory or through message passing.
f. Error detection:
OS needs to be constantly aware of possible errors. Errors may occur in the CPU
and memory hardware, in I/O devices and in the user program. For each type of
error, OS takes appropriate action to ensure correct and consistent computing.
Another set of OS
functions exist for ensuring efficient operation of the system. They are-
a. Resource
allocation: When there are multiple users or multiple jobs running at the same
time, resources must be allocated to each of them. Different types of resources
such as CPU cycles, main memory and file storage are managed by the operating
system.
b.
Accounting: Keeping track of which users use how much and what kinds of
computer resources.
c. Protection and
security: Controlling the use of information stored in a multiuser or networked
computer system. Protection involves ensuring that all access to system
resources is controlled. Security starts with requiring each user to
authenticate himself or herself to the system by means of password and to gain
access to system resources.
System Calls System calls provide
an interface to the services made available by an operating system.
An example to
illustrate how system calls are used: Writing a simple program to read data
from one file and copy them to another file-
a) First input
required is names of two files – input file and output file. Names can be
specified in many ways-
One approach is for
the program to ask the user for the names of two files. In an interactive
system, this approach will require a sequence of system calls, to write a
prompting message on screen and then read from the keyboard the characters that
define the two files. On mouse based and icon based systems, a menu of file
names is displayed in a window where the user can use the mouse to select the
source names and a window can be opened for the destination name to be
specified.
b) Once the two file
names are obtained, program must open the input file and create the output
file. Each of these operations requires another system call.
Possible error
conditions –
When the program
tries to open input file, no file of that name may exist or file is protected
against access. Program prints a message on console and terminates abnormally.
If input file exists, we must create a new output file. If the output file with
the same name exists, the situation caused the program to abort or delete the
existing file and create a new one. Another option is to ask the user(via a sequence
of system calls) whether to replace the existing file or to abort the program.
When both files are set up, a loop reads from the input file and writes to the
output file (system calls respectively). Each read and write must return status
information regarding various possible error conditions. After entire file is
copied, program closes both files, write a message to the console or window and
finally terminate normally. Application developers design programs according to
application programming interface (API). API specifies set of functions that
are available to an application programmer. Three of the most common API’s
available to application programmers are the Win32API for Windows Systems;
POSIX API for POSIX based systems (which include all versions of UNIX, Linux
and Mac OS X) and Java API for designing programs that run on Java virtual
machine. Pictorial representation of system calls-
The functions that
make up the API typically invoke the actual system calls on behalf of the
application programmer.
Benefits of
programming rather than invoking actual system calls:
ü Program portability
– An application programmer designing a program using an API can expect program
to compile and run on any system that supports the same API.
ü Actual system calls can be more detailed and difficult
to work with than the API available to an application programmer.
The run time support
system ( a set of functions built into libraries included with a compiler) for
most programming languages provides a system call interface that serves
as a link to system calls made available by OS. The system call interface
intercepts function calls in the API and invokes the necessary system call
within the operating system. A number is associated with each system call and
the system call interface maintains a table indexed according to these numbers.
System call interface then invokes the intended system call in the OS kernel
and returns the status of the system call and return any values. System calls
occur in different ways, depending on the computer in use – more information is
required than simply the identity of the desired system call. The exact type
and amount of information vary according to the particular OS and call. Three
general methods are used to pass parameters to OS-
I. Pass
the parameters in registers
II.
Storing parameters in blocks or tables in memory and the address of the block
id passed as a parameter in a register
III. Placing or
pushing parameters onto the stack by the program and popping off the stack by the
OS.
Types of system
calls Five
major categories:
1)
Process control
o
end,
abort
o load, execute
o create process, terminate process
o get process attributes, set process attributes
o wait for time
o wait event, signal event
o allocate and free memory
2) File
Management
o create file, delete file
o open, close
o read, write, reposition
o get file attributes, set file attributes
3)
Device management
o request device, release device
o read, write, reposition
o get device attributes, set device attributes
o logically attach or detach devices
4)
Information maintenance
o get time or date, set time or date
o get system data, set system data
o get process, file or device attributes
o set process, file or device attributes
5)
Communications
o create, delete communication connection
o send, receive messages
o transfer status information
o
attach
or detach remote devices
System Programs
System programs provide a convenient
environment for program development and execution. They can be divided into
these categories-
Ø File management:
These programs create, delete, copy, rename, print, dump, list and manipulate
files and directories.
Ø Status information:
Some programs ask the system for the date, time, and amount of available memory
or disk space, number of users.
Ø File modification:
Text editors may be available to create and modify the content of files stored
on disk or other storage devices.
Ø Programming language
support: Compilers, assemblers, debuggers and interpreters for common
programming languages are often provided to the user with the OS.
Ø Program loading and
execution: Once a program is assembled or compiled, it must be loaded into
memory to be executed. System provides absolute loaders, relocatable loaders,
linkage editors and overlay loaders.
Ø Communications: These programs provide the mechanism for
creating virtual connections among processes, users and computer systems.
In addition to
systems programs, OS are supplied with programs that are useful in solving
common problems or performing operations. Such programs include web browsers,
word processors and text formatters, spread sheets, database systems etc. These
programs are known as system utilities or application programs.
Operating System
Structure
Simple structure: Operating
systems of commercial systems started as a small, simple and limited systems.
Example is MS-DOS. It was written to provide the most functionality in the
least space, so it was not divided into modules.
But the interfaces
and levels of functionality are not separated. It was also limited by the
hardware. Layered approach: With proper hardware support, OS can be broken into
pieces that are smaller and more appropriate. OS can then retain much greater
control over the computer and over the applications that make use of the
computer. Under the top down approach, the overall functionality and features are
determined and are separated into components. A system can be made modular in
many ways – one method is the layered approach in which the OS is broken up
into number of layers (levels). The bottom layer is the hardware and the
highest layer is the user interface.
The main advantage
of layered approach is simplicity of construction and debugging. The layers are
selected so that each uses functions and services of only lower level layers.
This approach simplifies debugging and system verification. The major difficulty
with layered approach involves defining the various layers. They tend to be
less efficient than other types.
Micro kernels:
This method
structures the OS by removing all non essential components from the kernel and
implementing them as system and user level programs which results in a smaller
kernel. Micro kernels provide minimal process and memory management in addition
to a communication facility. The main function of micro kernel is to provide a
communication facility between the client program and the various services that
are also running in user space. Communication is provided by message passing.
Advantage of the micro kernel approach is ease of extending the operating
system. All new users are added to user space and hence do not require modification
of the kernel. The resulting operating system is easier to port from one
hardware design to another. Microkernel also provides more security and
reliability since most services are running as user processes. But micro
kernels can suffer from performance decreases due to increased system function
over head. Modules:
The best current
methodology for operating system design involves using object oriented
programming techniques to create a modular kernel. The kernel has a set of core
components and dynamically links in additional services either during boot time
or run time.
Ex: Solaris loadable
kernel modules
Solaris OS structure
is organized around a core kernel with seven types of loadable kernels. Such a
design allows the kernel to provide core services and also allows certain
features to be implemented dynamically.
Operating System
Generation
Operating systems
are designed to run on any class of machines at a variety of sites with a
variety of peripheral configurations. The system must then be configured or
generated for each specific computer site, a process known as system generation
(SYSGEN). This SYSGEN program reads from a given file or asks the operator of
the system for information concerning the specific configuration of the
hardware system or probes the hardware directly to determine what components
are there. The following information must be determined:
a) What
CPU is to be used? What options are installed? For multiple CPU systems, each
CPU system must be described.
b) How
much memory is available?
c) What
devices are available?
d) What operating
system options are desired or what parameter values are to be used?
Once this
information is determined, it can be used in several ways. It can be used by
the system administrator to modify a copy of the source code of the OS. OS is
then completely compiled. It is also possible to construct a system that is
completely table driven. All the code is always part of the system and
selection occurs at execution time rather than compile time or link time. The
major differences among these approaches are the size and generality of the
generated system and the ease of modification as the hardware configuration
changes.
No comments:
Post a Comment