Further Readings: Check Your Progress
Further Readings: Check Your Progress
3) The X window system does not define any particular style of interface but
provides a mechanism for supporting many styles. X is also network-based in
contrast with other GUls, or the X architecture is based on the premise that an
application can run on one computer while the graphical presentation of the
application's output and the responses from the user can occur on another
computer..
FURTHER READINGS
1) Communication of ACM, April 1993.
2.9 Further ~ e ~ d f d g s 54
-
2.0 INTRODUCTION
An operatifig system is a system software which may be viewed as an organized
selletztion of software consisting of procedures for operating a computer and providing
an eflvironment for execution of programs. It acts as an interface between users and
the hardware of a computer system.
There are many important reasons for studying operating systems. Some of thcin are:
1) User interacts with the computer through the operating system in order to
accomplish his task since it is his primary interface with a computer.
3) Many concepts and techniques found in the operating system have general
applicability in other applications.
The introductory concepts and principles of an operating system will be the main
issues for discussion in this unit. The unit starts with the basic definition and then goes
on to explain the stages of evolution of operating systems. It further gives details of
several approaches to operating system design.
111 the last two subsections of tile unit we classify an advanced opelati1:g system and
explain some characteristics of modern operating systerns.
Operating System etc., which replace assembly language for system programming. The use of system
Fundamentals & calls in C or Pascal programs very much resemble pre-defined fiinctions or subroutine
As an example of how system calls are used, let us consider a simple program to copy
data from one file to another. 111an interactive system, the following system calls will
be generated by the operating system:
Prompt message for inputting two file names and reading it from the terminal.
Open source and destination file.
Prompt error message in case the source file cannot be open because it is
protected against access or because the destination file cannot be created since
there is already a file with this name.
Read the source file
Write into the destination file
Display status information regarding various Read/Write error conditions. For
example, the program may find that the end of the file has been reached or that
there was a hardware failure. The write operation may encounter various errors,
depending upon the output device (no more disk space, physical end of tape,
printer out of paper and so on).
Close both files after the entire file is copied.
As we can observe, a user program makes heavy use of the operating system. All
interaction between the program and its environment must occur as the result of
requests from the program to the operating system.
Operating System Commands: Apart from system calls, users may interact with
the operating system directly by means of operating system commands.
For example, if you want to list files or sub-directories in MS-DOS, you invoke dir
command. In either case, the operating system acts as an interface between users
and the hardware of the computer system. The fundamental goal of computer
systems is to solve user problems. Towards this goal computer hardware is
designed. Since the bare hardware alone is not very easy to use, programs
(software) are developed. These programs require certain common operations,
such as controlling peripheral devices. The command function of controlling and
allocating resources are then brought together into one piece of software; the
operating system.
To see what operating systems are and what operating systems do, let us consider
how they have evolved over the years. By tracing their evolution, we can identi@ the
common elements of operating systems and examine how and why they have
developed as they have.
$ END
DATA FROM PROGRAM
$ RUN
$ LOAD
I - I
USER'S PROGRAM TO BE -
COMPOSED
-
1 $COB
$JOB -
Figure 2: Card Deck for Cobol Program for a Simple Batch Syscern
If the CPU is, on the average, much faster than an input device, buffering will be of
little use. If the CPU is always faster, then it always finds an empty buffer and has to
wait for the input device. For outpyt, the CPU can proceed at full speed until,
eventually, all system buffers are full. Then the CPU must wait for the output device.
This situation occurs with inputjoutput bound jobs where the amount af iaput/output
device, the speed of execution is controlled by the input/output devlce, not by the speed
of the CPU.
1 Figure 3: Spooling I
Buffering overlaps input, output and processing of a singlejob whereas Spooling
allows CPU to overlap the input of one job with computation and output of
other jobs. Therefore this approach is better than buffering. Even in a simple system,
the spooler may be reading the input of one job while printing the output of a different
I job.
2.3.3 Multiprogramming
Buffering and Spooling improve system performance by overlapping the input, output
and computation of a singlejob, but both ofthem have their limitations. A single user
cannot always keep CPU or I10 devices busy at all times. Multiprogramming offersa
more efficient approach to increase system performance. In order to increase the
resource utilisation, systems supporting multiprogramming approach allow more than
one job (program) to reside in the memory to utilise CPU time at any moment. More
number of programs competing for system resources better will mean better resource
uti lisation.
The idea is implemented as follows. The main memory of a system contains more than
one program (Figure 4).
Operating System Primary Memory
Fundamentals &
MONITOR
PROGRAM 1
PROGRAM 2
. . .
. . .
PROGRAM N
The operating system picks one of the programs and starts executing. During
execution of program 1 it needs some I10 operation to complete in a sequential
execution environment (Figure 5a).The CPU would then sit idle whereas in a
multiprogramming system, (Figure 5b) the operating system will simply switch over to
the next program (program 2).
Program 1 Program 2
Figure 5: Multiprogramming
I
When that program needs to wait for some I10 operation, it switches over to program
3 and so on. Ifthere is no other new program left in the main memory, the CPU will
pass its control back to the previous programs.
Multiprogramming has traditionally been employed to increase the resources utilisation
of a computer system and to support multiple simultaneously interactive users
(terminals).
Compared to the operating system, which supports only sequential execution, the
multiprogramming system requires some form of CPU and memory management
strategies. which will be discussed in the next section.
Introduction to
2.4 OPEFUTING SYSTEM STRUCTURE Operating System
Since operating system is a very large and complex software, supports a large number
of functions. It should be developed as a collection of several smaller modules with
carefully defined inputs, outputs and functions rather than a single piece of software. In
this section, we will examine different operating system structure.
As shown in Figure 6, layer 0 dealt with hardware; the higher layer 1 handled
allocation ofjobs to processor. The next layer implemented memory management.
Level 3 contained the device driver for the operator's console. By placing it, as well as
I10 buffering, at level 4, above memory management, the device buffers could be
placed in virtual memory. The 110 buffering was also above the operator's console, so
that VO error conditions could be output to the operator's console.
The main advantages of the layered approach is modularity which helps in debugging
and verification of the system easily. The layers are designed in such a way that it uses
operation and services only of a layer below it. A higher layer need not know how
these operations are implemented, only what these operations do. Hence each layer
hides implementation details from higher-level layers. Any layer can be debugged
without any concern about the rest of the layer.
The major difficulty with the layered approach is definition of a new level i.e. how to
differentiate one level from another. Since a layer can use the services of a layer below
it, it should be designed carefully. For example, the device driver for secondary memory
must be at a lower level than the memory management routines since memory
management requires the ability to use the backing store.
Virtual
machine
operating
system OS
.-
1
I
I
CPU
O S I
'
I
1
. l l C I I .
'
I
I
CPU
OS2
'
I
I
,lllll.
I
u
I
I
CPU
OS3
I
I
I
I
Reader
Virtual
Disk
0Virtual
Disk Virtual
Input device
I From the user's viewpoint, a virtual machine can be made to appear ve1.J.similar to an
existing real machine or they can be entirely different. An important aspect of this.
technique is that each user can run the operating system of his own choice. This fact
is depicted by OS, (Operating System I), OS,, OS, etc. as in Figure 7.
I
allocated a portio~iof the real machine resources. The same machine resources are
distributed among several processes.
-
Conventional multi-
programming operating system
'I
Virtual Virtual
Virtual
Machine Machine
Machine
1 2 N
In the virtual multiprogramming system, a single real machine gives the illusion of
several virtual machines, each having its own virtual processor, storage and I10
devices possibly with much larger capacities.
The virtual machine has many uses and advantages:
I
Because each virtual machine is identical to the true hardware, each one can run any
operating system that will run directly on the hardware. In fact, different virtual
machines can, and usually do, run different operating systems. SOIIIC run one of the
descendants of OS1360 for batch processing, while other ones run a simple, single-
user, interactive system called CMS (Conversational Monitor System) for time-sharing
Operating System When a CMS program executes a system call, the call is trapped to the operating
Fmodamentals & system in its own virtual machine, not to VMl370; just as it would if it were running on
a real machine instead of a virtual one. CMS then issues the normal hardware 110
instructions for reading its virtual disk or whatever is needed to carry out the call.
These 110 instructions are trapped by VM1370, which then performs them as part of
its simulation of the real hardware. By making a complete separation of the functions
of multiprogramming and providing an extended machine, each of the pieces can be
mush simpler and more flexible.
The virtual machine concept has several advantages. Notice that there is complete
protection. Each machine is completely isolated from all other virtual machines, so
there is no problem with protection. On the other hand, there is no sharing. To provide
sharing, two approaches have been implemented. First, it is possible to share a
minidisk. This scheme is modeled after a physical shared disk, but implemented by
software. With this technique, files can be shared. Second, it is possible to define a
network of virtual machines, each of which can send information over the virtual
communications network. Again, the network is modeled after physical communication
networks, but implemented in software.
Such a virtual machine system is a perfect vehicle for operating systems research and
development. Normally changing an operating system is a difficult process. Since
operating systems are large and complex programs, it is difficult to be sure that a
change in one point does not cause obscure bugs in some other part. This situation can
be particularly dangerous because of the power of the operating system. Since the
operating system executes in monitor mode, a wrong change in a pointer could cause
an error that would destroy the entire file system. Thus, it is necessary to test all
changes to the operating system carefully.
But the operating system runs on and controls the entire machine. Therefore, the
current system must be stopped and taken out of use, while changes are made and
tested. This is commonly called system development time. Since it makes the system
unavailable to users, system development time is often scheduled late at night or on
weekends.
A virtual machine system can eliminate much of this problem. System programmers
are given their own virtual machine and system development is done on the virtual
machine, instead of on a physical machine. The normal system operation seldom need
be disrupted for system development.
Kernel
mode
Kernel
'The picture painted above of a kernel that handles only the transport of messages from
clients to servers and back is not completely realistic. Some operating system functio~is
(such as loading commands into the physical 110 device registers) are difficult, if not
impossible, to do from user-space programs. There are two ways of dealing with this
problem. One way is to have some critical server processes (e.g., I10 device drivers)
actually run in kernel mode, with complete access to all the hardware, but still
communicate with other processes using the normal message mechanism.
The other way is to build a minimal amount of mechanism into the kernel, but leave
the policy decisions up to servers in user space. For example, the kernel might
recognize that a message sent to a certain special address means to take the contents
I of that message and load it into the I10 device registers from some disk, to start a disk
read. In this example, the kernel would not even inspect the bytes in the message to
see if they were valid or meaningful; it would just blindly copy them into the disk's
device registers. (Obviously some scheme for limiting such messages to authorized
. processes only must be used). The split between mechanism and policy is an important
concept; it occurs again and again in operating systems in various contexts.
2.4.4 Kernel Approach
Kernel is that part of operating system which directly makes interface with hardware
1
,
1 The drive for advanced operating systems has come from two directions. First, it has
I come from advances in the architecture of multicomputer systems and is now driven
by a wide variety of high-speed architectures. Hardware design of extremely fast
parallel and distributed systems is fairly well understood. These architectures offer
great potential for speed up but they also present a substantial challenge to operating
I
system designers. The following Figure I3 gives a broad classification of the
advanced operating system.
t
1C Advanced operating ..
A second class advanced operating system is driven by applications. There are several
important applications that require special operating system support, as a requirement
as well as for efficiency. General-purpose operating systems are too broad in nature
time systems, have received considerable attention in the past and the operating system
issues for these systems have been extensively examined.
t
2.5.1 Architecture Driven Operating System
A brief discussion of three operating systems in the category of the Architecture
The basic issues in the design of a distributed operating system are the same as in a
traditional operating system, viz., process synchronisation, deadlocks, scheduling, file
systems, interprocess communication, memory and buffer management, failure
recovery, etc. However, several idiosyncrasies of a distributed system, namely, the
lack of both shared memory and a physical global clock, and unpredictable
communication delays make the design of distributed operating systems much more
difficult.
Network operating systems focus on the use of remote services and resources
existing on a network of computer systems. Distributed operating systems focus on
effective utilization of resources in distributed computing environments.
Resource sharing
Reliability
Communication
Incremental growth
Resource sharing has been the main motivation for distributed systems. The
earliest form of a distributed system was a computer network which enabled the
use of specialized hardware and software resources by geographically distqnt
users. Resource sharing continues to be an important aspect of distributed systems
today. However, the nature of distribution and sharing of resources has changed
due to advances in networking technology. Sharing of resources is now equally
meaningful in a local area network (LAN), for example sharing laser printers in
the lab.
One aspect of reliability is availability of a resource despite failures in a system. A Introduction to
distributed environment can offer enhanced availability of resources through Operating System
redundancy of resources and communication paths. For example, availability of a disk
resource can be increased by having two or more disks located at different sites in the
system. If one disk is unavailable due to a disk or site failure, a program can use some
other disk. The availability of a data resource, e.g., a file, can be similarly enhanced by
keeping copies of the file at various sites in the system.
Distributed systems are capable of incremental growth, i.e., the capabilities of a system
(e.g. its processing power) can be enhanced at a price proportional to the nature and
size of the enhancement. A major advantage of this feature is that enhancements need
not be planned in advance. This is in contrast to the classical mainframe architectures
where enhancements often took the form of upgradation, that is, replacement of
subsystems by more powerful ones -hence enhancement costs tended ta be
disproportionate to the nature and size of an enhancement.
Distributed systems today cover a wide spectrum of computer hardware, software and
topological configurations; resource sharing services range from off-line access to real-
time access and topologies vary from locally distributed to geographically distributed.
The basic issues in the design of a multiprocessor operating system are the same as in
a traditional operating system. However, the issues of process synchronisation,task
scheduling, memory management, and protection and security become more complex
because the main memory is shared by many physical processors.
The operating system is the shield of the computer hardware against all software
components. It provides a comfortable environment for the execution of programs, and
it ensures effective utilisation of the computer hardware. The operating system offers
various services related to the essential resources of a computer: CPU, main memory,
storage and all input and output devices.
For the processi~igof audio and video, multimedia application demands that humans
perceive these media in a natural, error-free way. These continuous media data
Operating System originate at sources like microphones, cameras and files. From these sources, the data
Fundamentals & are transferred to destinations like loudspeakers, video windows and files located at
the same computer or at a remote station. On the way from source to sink, the digital
data are processed by at least some type of move, copy or transmit operation. In this
data manipulation process there are always many resources which are under the
control of the operating system. The integration of discrete and continuous multimedia
data demands additional services from many operating system components.
The major aspect in this context is real-time processing of continuous media data.
Process management must take into account the timing requirements imposed by the
handling of multimedia data. Appropriate scheduling methods should be applied. In
contrast to the traditional real-time operating systems, multimedia operating systems
also have to consider tasks without hard timing restrictions under the aspect of
fairness.
To obey timing requirements, single components are conceived as resources that are
reserved prior to execution. This concept of resource reservation has to cover all
resources on a data path, i.e. all resources that deal with continuous media. It also
may affect parts of the application that process continuous media data. In distributed
systems, for example, resource management also comprises nehrork capacity.
The communication and synchronization between single processes must meet the
restrictions of real-time requirements and timing relations among different media. The
main memory is available as a shared resource to single processes.
Real-time systems also place special requirements on operating system, which have
their roots in the specific application that the real-time system is supporting. Adistinct
feature of real-time systems is that jobs have completion deadlines. A job should be
completed before its deadline to be of use (in soft real-time system) or to avert a
disaster (in hard real-time systems). The major issue in the design of real-time
operating systems is the scheduling ofjobs in such a way that a maximum number of
jobs satis@ their deadlines. Other issues include designing languages and primitives to
effectively prepare and execute a job schedule.
@= Check Your Progress 2 lntroduction to
Operating System
1) What are the basic design issues in the distributed operating systems.
2.6.2 Multithreading
Multithreading is a technique in which a process executing an application is divided
into threads that can run concurrently. We can make the following distinction:
r, Threads: A dispatchable unit of work. It includes a processor context (which
includes the program counter and stack pointer) and its owl1 data area for a stack
(to enable subroutine branching). A thread executes sequentially and is
interruptable so that the processor can turn to another thread.
Process: A collection of one or more threads and associated system resources
(such as memory containing code and data, open files, and devices). This
corresponds closely to the concept of a program in execution. By breaking a
single application into multiple threads, the programmer has great control over the
modularity of the application and the timing of application related events.
Multithreading is useful for applications that perform a number of essentially
independent tasks that do not need to be serialised. An example is a database server
that listens for and processes numerous client requests. With multiple threads running
within the same process, switching back and forth among threads involves less
processor overhead than a major process switch between different processes.
Threads are also useful for structuring processes that are part of the OS kernel as
described in subsequent chapters.
2) These processors share the same main memory and I10 facilities, interconnected
by a communications bus or other internal connection scheme.
3) All processors can perform the same functions (hence the term Symmetric).
The operating system of an SMP schedules processes or threads across all of the
processors. SMP has a number of potential advantages over uniprocessor
architecture, including the following:
8 Pesformancc: If the work to be done by a computer can be organised so that
some portions of the work can be done in parallel, then a sysfe.-.,with multiple
processors will yield greater performance than one with a single processor of the Introduction to
Operating System
same type. With multiprogramming, only one process can execute at a time;
meanwhile all other processes are waiting for the processor. With
multiprocessing, more than one process can be running simultaneously, each on a
different processor.
Availability: In a symmetric multiprocessor, because all processors can perform
the same functions, the failure of a single processor does not halt the machine.
Instead, the system can continue to function at reduced performance.
Incremental growth: A user can enhance the performance of a system by
adding an additional processor.
Scaling: Vendors can offer a range of products with different price and
performance characteristics based on the number of processors configured in the
system.
It is important to note that these are potential rather than guaranteed benefits. The
operating system must provide tools and functions to exploit the parallelism in an SMP
system.
Multithreading and SMP are often discussed together, but the two are independent
facilities. Even on a uniprocessor machine, multithreading is useful for structuring
applications and kernel processes. An SMP machine is useful for non-threaded
processes, because several processes can run in parallel. However, the two facilities
complement each other and can be used effectively together.
An attractive feature of an SMP is that the existence of multiple processors is
transparent to the user. The operating system takes care of scheduling of threads
or processes on individual processors and of synchronisation among processors. A
different problem is to provide the appearance of a single system for a cluster of
I
I separate computers - a multicomputer system. In this case, we are dealing with a
collection of entities (computers), each with its own main memory, secondary
I
memory, and other I10 modules. A distributed operating system provides the illusion
I of a single main memory space and a single secondary memory space, plus other
unified access facilities, such as a distributed file system. Although clusters are
becoming increasingly popular, and there are many cluster products on the market,
I the state of the art for distributed operating systems lags that of uniprocessor and
I
SMP operating systems.
I The most recent innovation in operating system design is the use of object oriented
technologies. Object oriented design lends discipline to the process of adding modular
I extensions to a small kernel. At the operating system level, an object-based structure
enables programmers to customise an operating system without disrupting system
integrity. Object orientation also eases the development of distributed tools and a full-
blown distributed operating system.
2.7 SUMMARY
The operating system is an essential component of system software, which
consists of procedures for managing computer resources. Initially computers were
operated from the front console. System software such as Assemblers, Loaders
and Compilers greatly helped in software development but also required substantial
setup time. To reduce the setup time an operator was hired and similar jobs were
batched together.
Batch systems allowed automatic job sequenting by a resident monitor and improved
the overall utilisation of systems greatly. The computer no longer had to wait for
human operations - but CPU utilisation was still low because of slow speed of I10
Operating System devic s compared to the CPU. A new concept buffering was developed to improve
Fundamentals &
Networking
d'
syst m performance by overlapping the input, output and computation of a singlejob.
Spooling was another new concept in improving the CPU utilisation by overlapping
input of one job with the computation and output ofother jobs.
Operating systems are now almost always written in a higher-level language
(C, PASCAL, etc.). UNIX was the first operating system developed in C language.
This feature improves their implementation, maintenance and portability.
The operating system provides a number of services. At the lowest level, there are
system calls, which allow a running program to make a request from the operating
system directly. At a higher level, there is a command interpreter, which supports a
mechanism for a user to issue a request without writing a program.
In this unit, we began with tracing the evolution of the operating system through serial
processing, batch processing and multiprogramming. We also presented different
operating system models: Layered structured, Kernel based, virtual machine system
and client server model.
At the end we presented classification and characteristics of emerging operating
systems.
management, failure recovery, etc., but what makes its design complexity are the
lack of shared memory and common physical global clock and unpredictable
communication delays.
2) The basic difference between the two is that the network operating system I
focuses on the use of remote services and resources existing on a network
operating system whereas the distributed operating system focuses on the
effective utilisation of resources on distributed environment.