Introduction to Operating System
By Dr D B Ntalasha
1 CS 225 Ntalasha @2024 8/24/2024
Objectives
To provide a grand tour of the major operating systems
components
To provide coverage of basic computer system
organization
2 CS 225 Ntalasha @2024 8/24/2024
What is an Operating System?
A program that acts as an intermediary between
a user of a computer and the computer
hardware.
Operating system goals:
Execute user programs and make solving user
problems easier.
Make the computer system convenient to use.
Use the computer hardware in an efficient
manner.
Computer System Structure
Computer system can be divided into four components
Hardware – provides basic computing resources
CPU, memory, I/O devices
Operating system
Controls and coordinates use of hardware among various
applications and users
Application programs – define the ways in which the system
resources are used to solve the computing problems of the
users
Word processors, compilers, web browsers, database systems,
video games
Users
People, machines, other computers
Four Components of a Computer System
Operating System Definition
OS is a resource allocator
Manages all resources
Decides between conflicting requests for efficient and
fair resource use
OS is a control program
Controls execution of programs to prevent errors and
improper use of the computer
Operating System Definition (Cont.)
No universally accepted definition
“Everything a vendor ships when you order an
operating system” is good approximation
But varies wildly
“The one program running at all times on the
computer” is the kernel. Everything else is
either a system program (ships with the operating
system) or an application program
Computer Startup
bootstrap program is loaded at power-up or reboot
Typically stored in ROM or EPROM, generally known as
firmware
Initializates all aspects of system
Loads operating system kernel and starts execution
Computer System Organization
Computer-system operation
One or more CPUs, device controllers connect through
common bus providing access to shared memory
Concurrent execution of CPUs and devices competing for
memory cycles
OS Services Support Applications on
Computers
We often use computers for a variety of applications
which require some logistical system support. A few
typical applications are listed below:
Document design
Accounting
E-mail
Image Processing
Games
OS support is application neutral and service- specific
10 CS 225 Ntalasha @2024 8/24/2024
Operating System : Definition
It is the software layer, nearest to hardware which
facilitates launching of all the other software utilities and
applications.
OS provides wide range of generic data services.
Manages keyboard, display, processor, memory and other
devices.
Schedules input, output and data processing
11 CS 225 Ntalasha @2024 8/24/2024
User and OS
OS facilitates use of
resources by hiding local
details and
presenting an interface
which is convenient to use.
For instance :
computer games, e-mail,
browsing or
preparing documents are
applications launched by
simply
clicking on cue icons. How
easy it is !
12 CS 225 Ntalasha @2024 8/24/2024
User and System View of OS
User perspective : ease of usage is the main consideration.
System perspective : efficiency in usage of resources is the
main consideration.
As a provider of resources - OS must have a policy and a
control program to regulate the allocation of resources
13 CS 225 Ntalasha @2024 8/24/2024
Objectives of Operating
Systems
Modern Operating systems generally have following
three major goals.
Operating systems generally accomplish these goals by
running processes in low privilege and providing
service calls that invoke the operating system kernel in
high-privilege state.
To hide details of hardware by creating
abstraction
To allocate resources to processes (Manage
resources
Provide a pleasant and effective user interface
14 CS 225 Ntalasha @2024 8/24/2024
To hide details of hardware by creating
abstraction
An abstraction is software that hides lower level details and
provides a set of higher-level functions.
An operating system transforms the physical world of devices,
instructions, memory, and time into virtual world that is the
result of abstractions built by the operating system.
There are several reasons for abstraction.
First, the code needed to control peripheral devices is not
standardized.
Operating systems provide subroutines called device drivers
that perform operations on behalf of programs for example,
input/output operations.
15 CS 225 Ntalasha @2024 8/24/2024
Continuation
Second, the operating system introduces new
functions as it abstracts the hardware.
For instance, operating system introduces the file
abstraction so that programs do not have to deal
with disks.
Third, the operating system transforms the computer
hardware into multiple virtual computers, each
belonging to a different program.
Each program that is running is called a process. Each
process views the hardware through the lens of
abstraction.
Fourth, the operating system can enforce security
through abstraction
16 CS 225 Ntalasha @2024 8/24/2024
OS Objectives contin…
To allocate resources to processes (Manage resources)
An operating system controls how processes (the active agents)
may access resources (passive entities).
Provide a pleasant and effective user interface
The user interacts with the operating systems through the user
interface and usually interested in the “look and feel” of the
operating system.
The most important components of the user interface are the
command interpreter, the file system, on-line help, and application
integration.
The recent trend has been toward increasingly integrated
graphical user interfaces that encompass the activities of multiple
processes on networks of computers.
17 CS 225 Ntalasha @2024 8/24/2024
Operating Systems History
Historically operating systems have been tightly related to
the computer architecture, it is good idea to study the
history of operating systems from the architecture of the
computers on which they run.
Operating systems have evolved through a number of
distinct phases or generations which corresponds roughly to
the decades.
18 CS 225 Ntalasha @2024 8/24/2024
The 1940's - First Generations
The earliest electronic digital computers had no
operating systems.
Machines of the time were so primitive that programs
were often entered one bit at time on rows of
mechanical switches (plug boards).
Programming languages were unknown (not even
assembly languages).
Operating systems were unheard of .
19 CS 225 Ntalasha @2024 8/24/2024
The 1950's - Second Generation
By the early 1950's, the routine had improved
somewhat with the introduction of punch cards.
The General Motors Research Laboratories
implemented the first operating systems in early
1950's for their IBM 701.
The system of the 50's generally ran one job at a time.
These were called single-stream batch processing
systems because programs and data were submitted
in groups or batches.
20 CS 225 Ntalasha @2024 8/24/2024
The 1960's - Third Generation
The systems of the 1960's were also batch processing
systems, but they were able to take better advantage
of the computer's resources by running several jobs
at once.
So operating systems designers developed the
concept of multiprogramming in which several jobs
are in main memory at once; a processor is switched
from job to job as needed to keep several jobs
advancing while keeping the peripheral devices in use.
21 CS 225 Ntalasha @2024 8/24/2024
Multiprogramming
For example, on the system with no
multiprogramming, when the current job paused to
wait for other I/O operation to complete, the CPU
simply sat idle until the I/O finished.
The solution for this problem that evolved was to
partition memory into several pieces, with a different
job in each partition.
While one job was waiting for I/O to complete,
another job could be using the CPU.
22 CS 225 Ntalasha @2024 8/24/2024
Spooling
Another major feature in third-generation operating
system was the technique called spooling
(simultaneous peripheral operations on line).
In spooling, a high-speed device like a disk interposed
between a running program and a low-speed device
involved with the program in input/output.
Instead of writing directly to a printer, for example,
outputs are written to the disk.
Programs can run to completion faster, and other
programs can be initiated sooner when the printer
becomes available, the outputs may be printed.
23 CS 225 Ntalasha @2024 8/24/2024
Time-Sharing
Another feature present in this generation was time-
sharing technique, a variant of multiprogramming
technique, in which each user has an on-line (i.e., directly
connected) terminal.
Because the user is present and interacting with the
computer, the computer system must respond quickly to
user requests, otherwise user productivity could suffer.
Timesharing systems were developed to multiprogram
large number of simultaneous interactive users.
24 CS 225 Ntalasha @2024 8/24/2024
Fourth Generation
With the development of LSI (Large Scale Integration) circuits,
chips, operating systems entered in personal computer and the
workstation age.
Microprocessor technology evolved to the point that it
become possible to build desktop computers as powerful as
the mainframes of the 1970s.
Two operating systems have dominated the personal computer
scene: MS-DOS, written by Microsoft, Inc. for the IBM PC and
other machines using the Intel 8088 CPU and its successors,
and UNIX, which is dominant on the large personal computers
using the Motorola 6899 CPU family.
Even though, not all systems have the same structure, many
modern operating systems share the same goal of supporting
the following types of system components.
25 CS 225 Ntalasha @2024 8/24/2024
OS : Design Considerations
To achieve higher throughput : I/O could be overlapped with
processing.
In 70s we witnessed emergence of high speed disks as
“secondary storage”.
Address space enhanced to achieve access to “virtual
address space”.
The Strategy: “swap out” what is not needed immediately,
“swap in” what is required for current processing.
26 CS 225 Ntalasha @2024 8/24/2024
Difficulties with OS Design
Improper synchronization
ensure a program waiting for an I/O device receives the
signal
Failed mutual exclusion
must permit only one program at a time to perform a
transaction on a portion of data
Deadlock
It might happen that 2 or more pgms wait endlessly after
each other to perform an operation.
27 CS 225 Ntalasha @2024 8/24/2024
Operating Systems Services
Following are the five services provided by an
operating system to the convenience of the users
1. Program Execution
Running a program involves the allocating and
deallocating memory, CPU scheduling in case of
multiprocesses. These functions cannot be given to
the user-level programs. So user-level programs
cannot help the user to run programs independently
without the help from operating systems.
28 CS 225 Ntalasha @2024 8/24/2024
OS Services
29 CS 225 Ntalasha @2024 8/24/2024
2. I/O Operations
Each program requires an input and produces output.
This involves the use of I/O.
The operating systems hides the user the details of
underlying hardware for the I/O.
All the user sees is that the I/O has been performed
without any details.
So the operating systems by providing I/O make it
convenient for the users to run programs.
For efficiently and protection users cannot control
I/O so this service cannot be provided by user-level
programs.
30 CS 225 Ntalasha @2024 8/24/2024
3. File System Manipulation
The output of a program may need to be written into new files
or input taken from some files.
The operating systems provides this service.
The user does not have to worry about secondary storage
management.
Users give a command for reading or writing to a file and see
his/her task accomplished.
Thus operating systems make it easier for user programs to
accomplished their tasks.
This service involves secondary storage management.
The speed of I/O that depends on secondary storage
management is critical to the speed of many programs and hence
I think it is best relegated to the operating systems to manage it
than giving individual users the control of it.
It is not difficult for the user-level programs to provide these
services but for above mentioned reasons it is best if this service
is left with operating system.
31 CS 225 Ntalasha @2024 8/24/2024
4. Communications
There are instances where processes need to
communicate with each other to exchange information.
It may be between processes running on the same
computer or running on the different computers.
By providing this service the operating system relieves
the user of the worry of passing messages between
processes.
In case where the messages need to be passed to
processes on the other computers through a network it
can be done by the user programs.
The user program may be customized to the specifics of
the hardware through which the message transits and
provides the service interface to the operating system.
32 CS 225 Ntalasha @2024 8/24/2024
5. Error Detection
An error is one part of the system may cause malfunctioning
of the complete system.
To avoid such a situation the operating system constantly
monitors the system for detecting the errors.
This relieves the user of the worry of errors propagating to
various part of the system and causing malfunctioning.
This service cannot be allowed to be handled by user
programs because it involves monitoring and in cases altering
area of memory or de-allocation of memory for a faulty
process.
Or may be relinquishing the CPU of a process that goes into
an infinite loop.
These tasks are too critical to be handed over to the user
programs.
A user program if given these privileges can interfere with the
correct (normal) operation
33 CS 225 Ntalasha @2024 8/24/2024
Operating System Facilities
User access to the system
Storage and management of information
Protection of information against accidental and intentional
misuse
Support for data processing activities
Communication with I/O devices
Management of all activities in a transparent manner.
34 CS 225 Ntalasha @2024 8/24/2024
Operational Overview
Processor – executes programs, schedules and allocate
processor time.
Memory – stores programs, and supports mechanisms to
access data
Input output devices – supports all input and output
operations
Communication mechanisms - with devices external to the
system
Mutual exclusion – schedule the usage of shared device
and fair access
Shell of an OS
Human computer interface (HCI/CHI)
35 CS 225 Ntalasha @2024 8/24/2024
Operation of a computer system
The principle states that a program is initially stored in
memory and executed by fetching an instruction at a
time.
.The basic cycle of
operation is
Fetch an instruction
(Fetch)
Interpret the instruction
(Decode)
Execute the instruction
(Execute)
36 CS 225 Ntalasha @2024 8/24/2024
A Physical Overview of a Computer System
Modern systems allow multiple users to use a computer system.
Even on a stand alone PC there may be multiple application which
are running simultaneously
37 CS 225 Ntalasha @2024 8/24/2024
Input Output Devices
The peripheral devices
communicate in a
mode known as
interrupt mode.
Typically human input is
considered important
and often uses this
mode.
This is so because
human desire to guide
the operation.
For instance, we use a
mouse click or a key
board input.
These require
immediate attention by
needing an appropriate
interruption service.
38 CS 225 Ntalasha @2024 8/24/2024
Processes and Tools
Program in execution is called a process.
Interprocess communication forms the basis of distributed
computing.
The machine seeking the service is client and the machine
offering the service is server.
OS provide many general purpose utilities as a set of
packaged tools
39 CS 225 Ntalasha @2024 8/24/2024
Impact of Networking
Computers communication NW required OS to be NW
aware enabling remote resource sharing.
Programs, files or data could be moved around and
accessed.
Lead to protocols like FTP, telnet - TErminal NETwork,
RPC.
Internet required HTTP and browser support
40 CS 225 Ntalasha @2024 8/24/2024
Characteristics of Modern Operating
Systems
New design elements were introduced recently
In response to new hardware development
multiprocessor machines
high-speed networks
faster processors and larger memory
In response to new software needs
multimedia applications
Internet and Web access
Client/Server applications
41 CS 225 Ntalasha @2024 8/24/2024
Microkernel architecture
Only a few essential functions in the kernel
primitive memory management (address space)
Interprocess communication (IPC)
basic scheduling
Other OS services are provided by processes running in
user mode (servers)
device drivers, file system, virtual memory…
More flexibility, extensibility, portability…
A performance penalty by replacing service calls with
message exchanges between process...
42 CS 225 Ntalasha @2024 8/24/2024
Multithreading
A process is a collection of one or more threads that can
run simultaneously
Useful when the application consists of several tasks that do
not need to be serialized
Gives the programmer a greater control over the timing of
application-related events
All threads within the same process share the same data
and resources and a part of the process’s execution context
It is easier to create or destroy a thread or switch among
threads (of the same process) than to do these with
processes
43 CS 225 Ntalasha @2024 8/24/2024
Symmetric Multiprocessing (SMP)
A computer with multiple processors
Each processor can perform the same functions and share
same main memory and I/O facilities (symmetric)
The OS schedule processes/threads across all the
processors (real parallelisme)
Existence of multiple processors is transparent to the user.
Incremental growth: just add another CPU!
Robustness: a single CPU failure does not halt the system,
only the performance is reduced.
44 CS 225 Ntalasha @2024 8/24/2024
Process Management
A process is a program in execution. It is a unit of work within the system. Program
is a passive entity, process is an active entity.
Process needs resources to accomplish its task
CPU, memory, I/O, files
Initialization data
Process termination requires reclaim of any reusable resources
Single-threaded process has one program counter specifying location of next
instruction to execute
Process executes instructions sequentially, one at a time, until completion
Multi-threaded process has one program counter per thread
Typically system has many processes, some user, some operating system running
concurrently on one or more CPUs
Concurrency by multiplexing the CPUs among the processes / threads
Process Management Activities
The operating system is responsible for the following
activities in connection with process management:
Creating and deleting both user and system processes
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication
Providing mechanisms for deadlock handling
Memory Management
All data in memory before and after processing
All instructions in memory in order to execute
Memory management determines what is in memory
when
Optimizing CPU utilization and computer response to users
Memory management activities
Keeping track of which parts of memory are currently being
used and by whom
Deciding which processes (or parts thereof) and data to move
into and out of memory
Allocating and deallocating memory space as needed
Storage Management
OS provides uniform, logical view of information storage
Abstracts physical properties to logical storage unit - file
Each medium is controlled by device (i.e., disk drive, tape drive)
Varying properties include access speed, capacity, data-transfer rate,
access method (sequential or random)
File-System management
Files usually organized into directories
Access control on most systems to determine who can access
what
OS activities include
Creating and deleting files and directories
Primitives to manipulate files and dirs
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
Mass-Storage Management
Usually disks used to store data that does not fit in main memory or data that must be kept
for a “long” period of time.
Proper management is of central importance
Entire speed of computer operation hinges on disk subsystem and its algorithms
OS activities
Free-space management
Storage allocation
Disk scheduling
Some storage need not be fast
Tertiary storage includes optical storage, magnetic tape
Still must be managed
Varies between WORM (write-once, read-many-times) and RW (read-write)
I/O Subsystem
One purpose of OS is to hide peculiarities of hardware
devices from the user
I/O subsystem responsible for
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)
General device-driver interface
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
Huge range, including denial-of-service, worms, viruses, identity theft,
theft of service
Systems generally first distinguish among users, to determine
who can do what
User identities (user IDs, security IDs) include name and associated
number, one per user
User ID then associated with all files, processes of that user to
determine access control
Group identifier (group ID) allows set of users to be defined and
controls managed, then also associated with each process, file
Privilege escalation allows user to change to effective ID with
more rights
Computing Environments
Traditional computer
Blurring over time
Office environment
PCs connected to a network, terminals attached to mainframe or
minicomputers providing batch and timesharing
Now portals allowing networked and remote systems access to same
resources
Home networks
Used to be single system, then modems
Now firewalled, networked
End ..
Questions
53 CS 225 Ntalasha @2024 8/24/2024