AN INTRODUCTION
TO OPERATING
SYSTEMS
Lecture 1
Dr. Subhi [Link]
Bahudaila
OS
Operating System
2 Lecture 1
A program that controls the execution of application
programs
An interface between applications and hardware
Main objectives of an OS:
CONVENIENCE:
An operating system makes a computer more convenient to use.
EFFICIENCY:
It allows the computer system resources to be used in an efficient
manner.
ABILITY TO EVOLVE: It should have the capability to permit the
effective development, testing & introduction of new system functions.
The Operating System as a User /
Computer Interface
3 Lecture 1
Operating System Functions
4 Lecture 1
PROGRAM CREATION:
Operating system provides a number of facilities & services to
assist the programmer during development of a program like
“editor & debugger”. These programs normally exist in the form
of a utility program. Such programs are not part of the o/s rather
they are accessible through the o/s.
PROGRAM EXECUTION:
When a program is to be executed, a number of tasks like
instructions & data loading into memory, I/O operation & file
initialization are to be executed. The o/s performs all these jobs
for the user.
OS Functions
5 Lecture 1
ACCESS TO I/O DEVICES: Each I/O devices requires its own set of
instructions or control signals for operations. The o/s takes care of all
these requirements and the user only thinks in terms of reading/writing, all
those details are hidden from the user.
CONTROLLED ACCESS TO FILES: In the case of files, control must
include to understand the nature of the I/O devices like FD, HD & CD and
also the format on the storage medium. Again o/s provides all such
controls but these are transparent to the user. Furthermore in a multi-user
system o/s provides a protection mechanisms to access any file.
OS Functions
6 Lecture 1
SYSTEM ACCESS / PROTECTION: In the case of a shared or public system
the o/s takes control of the whole system as well as the system resources. The
reason being o/s has to provide protection to the data & resources from any
unauthorized user and also to resolve conflicts when more than one user is
competing for a resource.
ERROR DETECTION: During the execution of a program different errors can
be encountered e.g., insufficient memory, device failure, arithmetic overflow &
a program accessing a protected area etc. Typical o/s takes care of all these
problems and respond to clear these errors without disturbing normal
functioning of the system. But in some cases it may have to terminate the
application.
ACCOUNTING: A good OS will collect usage statistics for various resources
and monitor performance parameters such as response time. On any system, this
information is useful in anticipating the need for future enhancements and in
tuning the system to improve performance. On a multiuser system, the
information can be used for billing purposes.
Desirable Features of an OS
7 Lecture 1
EFFICIENCY: There are various factors which determines the efficiency
of an operating system: - Mean time between jobs/processes.
-Unused CPU time. - Turn-round time for batch jobs (Time between
job submission & completion). - Response time - Resource utilization
-Throughput (jobs/time)
It must be noted that a system satisfying all the above listed factors will
represent an ideal system, but in reality there are compromises among
these factors.
RELIABILITY: Ideally an operating system must be completely error free
& should be able to handle all contingencies, but we know in practice
this is not always true.
Desirable Features of an OS
8 Lecture 1
MAINTAINABILITY: A good operating system should be able to
enhance its capabilities & rectify its errors if required without
employing an army of system programmers. The operating system
must be modular in construction, with clearly defined interface
between modules and should be well documented.
SMALL SIZE: Space used to hold the operating system whether in
main memory or hard disk must be of reasonable size. Further more a
larger system is liable to be more error prone and requires obviously
more time to write etc.
OS as a Resource Manager
9 Lecture 1
Computer System is a collection of resources.
O/S manage these resources.
Function wise any ordinary software program and an o/s are
similar in nature.
The distinctive feature is the intent:
o/s commands the processor in using computer system
resources and timing of its execution.
In doing so it stops its own execution.
Meaning it relinquishes control of the processor to do some
productive thing and subsequently resume control of the
processor for another task.
OS as a Resource Manager
10 Lecture 1
Memory is the resource of an operating system.
Memory contains the operating system, as a nucleus
containing the most frequently used functions.
Rest of the memory contains program and data.
Utilization (allocation) of the memory resource is controlled
by o/s and the memory management hardware in the processor.
Processor is also a resource of o/s.
Processor utilization is controlled by the o/s for different
programs.
I/O devices are also resources and o/s decides which and when
to use these devices.
OS as a Resource Manager
11 Lecture 1
Uni-Programming Vs Multi-Programming
12 Lecture 1
Resource Utilization Example
13 Lecture 1
The Results
14 Lecture 1
System Structure
15 Lecture 1
Operating system complexity has grown with its advancement.
Any operating system can suffer from the following 3 components:
O/S chronically late in delivery.
Bugs show up after its operation in the field.
Performance is not that great which is expected.
So, focus has been on the structure of the operating system as:
Modular .
Hierarchical Layer; which is a function of o/s complexity, time
scale and level of abstraction. All of the above can be viewed as
different levels: 1) Each level performs a related subset of
functions. 2) Each levels relies on the adjacent lower level to
perform. 3) Ideally changes in one level may not effect the next
level. 4) Problem is partitioned into more manageable
components.
Hierarchy Design
16 Lecture 1
Required Characteristics of a Modern O/S
17 Lecture 1
Modification or enhancement to the existing architecture has not been
enough to cope with the rate of change of o/s structure. Following are
the main categories typically, required for a modern day o/s:
1. Micro-kernel structure
The key feature of a micro kernel architecture is to keep the most
essential operating system functions in the core and every thing else can be
integrated in the user mode.
Microkernel advantages: Uniform Interface, Extensibility, Flexibility,
Portability, Reliability, Distributed System Support & Object Oriented
Operating System (OOOS)
Kernel Architecture
18 Lecture 2
micro-kernel functions: Low level memory management, inter-process
communication, I/O and interrupt management.
Required Characteristics of a Modern O/S
19 Lecture 1
2. Multi-threading:
• In this case a process is created out of an existing process called thread and
both can run simutaneously.
• Thread is a dispatchable unit of work, it execute sequentially and
interruptable.
• Process could be collection of threads.
3. Symmetric Multi-processing:
• More then one processor may be present in the system.
• This means incremental growth is possible by adding more processors.
• It improves performance.
• It brings fault tolerence to the system.
• Scaling: vendors can provide different degrees of selection based on the
number of processors capability present in the system.
4. Distributed operating system
• This type of setup gives the illusion of a single memory space, clusters are
becoming increasingly popular.
• But still cannot match uni-processor and SMP operating systems.
Traditional Unix Systems
20 Lecture 1
Three levels of Unix Architecture:
hardware, kernel, and user.
The OS called the system kernel, or
simply the kernel, to emphasize its
isolation from the user and
applications. It interacts directly with
the hardware.
UNIX has equipped with a number of
user services and interfaces that are
considered part of the system.
The system call interface is the
boundary with the user and allows
higher-level software to gain access to
specific kernel functions.
The process control subsystem is
responsible for memory management,
the scheduling and dispatching of
processes, and the synchronization
and interprocess communication of
processes.
The file system exchanges data
Modern Unix Systems
21 Lecture 1
Typical of the
modern UNIX kernel
is the architecture.
There is a small core
of facilities, written
in a modular
fashion, that provide
functions and
services needed by a
number of OS
processes.
Each of the outer
circles represents
functions and an
interface that may
be implemented in a
variety of ways.
Examples of modern UNIX systems
22 Lecture 1
BSD The Berkeley Software Distribution:
is widely used in academic installations
has served as the basis of a number of commercial UNIX products
4.4BSD is the final version
FreeBSD:
one of the most widely used and best documented versions
popular for Internet-based servers and firewalls
used in a number of embedded systems
Mac OS X is based on FreeBSD 5.0 and the Mach 3.0
microkernel
Solaris 11:
Most widely used and most successful commercial UNIX
implementation
It has included a number of more advanced features such as:
• a fully preemptable, multithreaded kernel
Examples of modern UNIX systems
23 Lecture 1
Linux and the Modular Structure
24 Lecture 1
Linux achieves many of the advantages of the microkernel approach
by means of its particular modular architecture.
Linux is structured as a collection of modules.
Loadable Modules:
Relatively independent blocks
A module is an object file whose code can be linked to and
unlinked from the kernel at runtime
A module is executed in kernel mode on behalf of the current
process
Have two important characteristics:
• dynamic linking
• stackable modules
Linux Kernel Components
25 Lecture 1
The kernel
uses signals
to call into
The kernel
a process.
uses signals
E.g.,
The system
to call intoare
signals
call is the
used to
a process.
notify a
means by
which a
E.g., process of process
certain
signals are requests a
faults, such
used astodivision specific
kernel
notifybyazero. service,
process of such as
certain networking.
faults, such
as division
by zero.
Textbook:
26 Lecture 1
William Stallings,
"Operating Systems: Internals and design Principles
9th Edition",
(c) Pearson Prentice Hall 2018.
© Associate Prof. Dr. Subhi Abdul-rahim Bahudaila