INTRODUCTION TO OPERATING SYSTEM
CHAPTER 1: INTRODUCTION
What is an Operating System?
Computer-System Organization
Operating-System Structure
Operating-System Operations
Process Management
Computing Environments
Open-Source Operating Systems
Computer-System Architecture
OBJECTIVES
To describe the basic organization of computer
systems
To provide a grand tour of the major components of
operating systems
To give an overview of the many types of computing
environments
To explore several open-source operating systems
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
WHAT OPERATING SYSTEMS DO
The operating system controls the hardware and
coordinates its use among the various application programs
for the various users.
We can also view a computer system as consisting of
hardware, software, and data.
The operating system provides the means for proper use of
these resources in the operation of the computer system.
An operating system simply provides an environment
within which other programs can do useful work.
To understand more fully the operating system's role, we
explore operating systems from two viewpoints:
The user
The system.
USER VIEW
The user's view of the computer varies according to the
interface being used
Single user computers (e.g., PC,
workstations). Such systems are designed
for one user to monopolize its resources.
Ease of use
Performance efficient.
Multi user computers (e.g., mainframes,
computing servers). These users share
resources and may exchange information.
The operating system in such cases is
designed to maximize resource utilization --
to assure that all available CPU time,
memory, and I/O are used efficiently.
USER VIEW (CONT.)
Handheld computers (e.g., smartphones and
tablets). The user interface for mobile
computers generally features a touch screen.
The systems are resource poor, optimized for
usability and battery life.
Embedded computers (e.g., computers in
home devices and automobiles) The user
interface may have numeric keypads and may
turn indicator lights on or off to show status.
The operating systems are designed primarily
to run without user intervention.
SYSTEM VIEW
From the computer's point of view, the operating system is
the program most intimately involved with the hardware.
There are two different views:
The operating system is a resource
allocator
Manages all resources
Decides between conflicting requests for efficient
and fair resource use
The operating systems is a control program
Controls execution of programs to prevent errors
and improper use of the computer
DEFINING OPERATING SYSTEM
No universally accepted definition of what an OS:
Operating systems exist to offer a reasonable
way to solve the problem of creating a usable
computing system.
The fundamental goal of computer systems is to
execute user programs and to make solving user
problems easier.
Since bare hardware alone is not particularly
easy to use, application programs are
developed.
These programs require certain common operations,
such as those controlling the I/O devices.
The common functions of controlling and allocating
resources are brought together into one piece of
software: the operating system.
DEFINING OPERATING SYSTEM (CONT.)
No universally accepted definition of what is part of the OS:
A more common definition, and the one
that we usually follow, is that the
operating system is the one program
running at all times on the computer --
usually called the kernel.
Along with the kernel, there are two
other types of programs:
System programs, which are associated
with the operating system but are not
necessarily part of the kernel.
Application programs, which include all
programs not associated with the operation
of the system.
EVOLUTION OF COMPUTER SYSTEMS
Users
Applications
Database System
Operating System
Hardware
MODERN COMPUTER SYSTEM
COMPUTER-SYSTEM ORGANIZATION
A modern general-purpose computer system
consists of one or more CPUs and a number of
device controllers connected through a common
bus that provides access to shared memory.
Each device controller is in charge of a specific
type of device (for example, disk drives, audio
devices, or video displays). Each device controller
has a local buffer.
CPU moves data from/to main memory to/from
local buffers.
The CPU and the device controllers can execute
in parallel, competing for memory cycles. To
ensure orderly access to the shared memory, a
memory controller synchronizes access to the
memory.
COMPUTER STARTUP
Bootstrap program is loaded at power-up
or reboot
A bootstrap is the program that initializes
the operating system (OS) during startup.
Typically stored in ROM or EPROM, generally
known as firmware
Initializes all aspects of system
Loads operating system kernel and starts
execution
COMPUTER-SYSTEM OPERATION
Once the kernel is loaded and executing, it can
start providing services to the system and its
users.
Some services are provided outside of the
kernel, by system programs that are loaded into
memory at boot time to become system
processes, that run the entire time the kernel
is running.
The occurrence of an event is usually signaled
by an interrupt.
INTERRUPTS
There are two types of interrupts:
Hardware -- a device may trigger an interrupt by
sending a signal to the CPU, usually by way of
the system bus.
Software -- a program may trigger an interrupt
by executing a special operation called a system
call.
A software-generated interrupt (sometimes
called trap or exception) is caused either by
an error (e.g., divide by zero) or a user
request (e.g., an I/O request).
An operating system is interrupt driven.
COMMON FUNCTIONS OF INTERRUPTS
When an interrupt occurs, the operating system
preserves the state of the CPU by storing the
registers and the program counter
Determines which type of interrupt has occurred
and transfers control to the interrupt-service
routine.
An interrupt-service routine is a collection of
routines (modules), each of which is responsible
for handling one particular interrupt (e.g., from a
printer, from a disk)
The transfer is generally through the interrupt
vector, which contains the addresses of all the
service routines
Interrupt architecture must save the address of
the interrupted instruction.
INTERRUPT TIMELINE
COMPUTER-SYSTEM ARCHITECTURE
Single general-purpose processor
Most systems have special-purpose processors as well
Multiprocessors systems growing in use and importance
Also known as parallel systems, tightly-coupled systems
Advantages include:
Increased throughput: more work done in less time
Economy of scale: cost less
Increased reliability – graceful-degradation/fault-tolerance
Two types:
Symmetric Multiprocessing – each processor performs all
tasks
Asymmetric Multiprocessing – each processor is assigned
a specific task.
SYMMETRIC MULTIPROCESSING ARCHITECTURE
MULTICORE SYSTEMS
Most CPU design now includes multiple
computing cores on a single chip. Such
multiprocessor systems are termed
multicore.
Multicore systems can be more efficient
than multiple chips with single cores
because:
On-chip communication is faster than between-
chip communication.
One chip with multiple cores uses significantly
less power than multiple single-core chips.
A dual-core with two cores placed on the same chip
CLUSTERED SYSTEMS
Like multiprocessor systems, but multiple systems working
together
Usually sharing storage via a storage-area network
(SAN)
Provides a high-availability service which survives
failures
Asymmetric clustering has one machine in hot-standby
mode
Symmetric clustering has multiple nodes running
applications, monitoring each other
Some clusters are for high-performance
computing (HPC)
Applications must be written to use parallelization
Some have distributed lock manager (DLM) to
avoid conflicting operations
CLUSTERED SYSTEMS
MULTIPROGRAMMED SYSTEM
Single user cannot keep CPU and I/O devices
busy at all times
Multiprogramming organizes jobs (code and
data) so CPU always has one to execute
A subset of total jobs in system is kept in
memory
Batch systems:
One job selected and run via job scheduling
When it has to wait (for I/O for example), OS
switches to another job
Timesharing systems:
Logical extension of batch systems -- CPU switches
jobs so frequently that users can interact with each
job while it is running, creating interactive
computing
TIMESHARING SYSTEMS
Timesharing is also referred to as
multitasking.
Response time should be < 1 second
Each user has at least one program executing
in memory. Such a program is referred to as a
process
If several processes are ready to run at the
same time, we need to have CPU
scheduling.
If processes do not fit in memory, swapping
moves them in and out to run
Virtual memory allows execution of
processes not completely in memory
MODES OF OPERATION
A mechanism that allows the OS to protect itself
and other system components
Two modes:
User mode
Kernel mode
Mode bit (0 or 1) provided by hardware
Provides ability to distinguish when system is running
user code or kernel code
The dual mode operation provide us with the means
for protection operating system from errant users
and errant users from one another.
Some instructions designated as privileged, only
executable in kernel mode.
Systems call by a user asking the OS to perform
some function changes from user mode to kernel
mode.
Return from a system call resets the mode to user
mode.
TRANSITION FROM USER TO KERNEL MODE
TIMER
To prevent process to be in infinite loop , a timer is used,
which is a hardware device.
Timer is a counter that is decremented by the physical
clock.
Timer is set to interrupt the computer after some time
period
Operating system sets the counter (privileged
instruction)
When counter reaches the value zero, and interrupt is
generated.
The OS sets up the value of the counter before
scheduling a process to regain control or terminate
program that exceeds allotted time
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, etc.
Initialization data
When the Process termination requires reclaim of any reusable
resources
A thread is a basic unit of CPU utilization within a process.
Single-threaded process. Instructions are executed sequentially, one at a
time, until completion
Process has one program counter specifying location of next
instruction to execute
Multi-threaded process has one program counter per thread.
A process is the unit of work in the system .A system consists of
a collection of processes.
Typically, a system has many processes, some user, some
operating system running concurrently on one or more CPUs
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
PROTECTION AND SECURITY
Protection – A mechanism for controlling access of
processes (or users) to resources defined by the
OS
Security – A 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 is associated with all files and 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
Stand-alone general purpose machines
But blurred as most systems interconnect
with others (i.e., the Internet)
Portals provide web access to internal
systems
Network computers (thin clients) are like
Web terminals
Mobile computers interconnect via wireless
networks
Networking becoming ubiquitous – even
home systems use firewalls to protect home
computers from Internet attacks
COMPUTING ENVIRONMENTS - MOBILE
Handheld smartphones, tablets, etc
What is the functional difference between them
and a “traditional” laptop?
Extra features – more OS features.
Allows new types of apps like augmented
reality
Use IEEE 802.11 wireless, or cellular data
networks for connectivity
Leaders are Apple iOS and Google Android
COMPUTING ENVIRONMENTS – DISTRIBUTED
Collection of separate, possibly heterogeneous,
systems networked together
Network is a communications path, TCP/IP most
common
Local Area Network (LAN)
Wide Area Network (WAN)
Metropolitan Area Network (MAN)
Personal Area Network (PAN)
Network Operating System provides features to
allow sharing of data between systems across a
network.
Communication scheme allows systems to exchange
messages
Illusion of a single system
COMPUTING ENVIRONMENTS – CLIENT-SERVER
Dumb terminals supplanted by smart PCs
Many systems now servers, responding to
requests generated by clients
Compute-server system provides an interface to
client to request services (i.e., database)
File-server system provides interface for clients to
store and retrieve files
COMPUTING ENVIRONMENTS - PEER-TO-PEER
Another model of distributed system. P2P does not distinguish clients and
servers
Instead all nodes are considered peers
Each node may act as client, server, or both
Node must join P2P network
Registers its service with central lookup service on network, or
Broadcast request for service and respond to requests for service
via discovery protocol
Examples include Napster and Gnutella, Voice over IP (VoIP) such as
Skype
COMPUTING ENVIRONMENTS – CLOUD COMPUTING
Delivers computing, storage, even apps as a service across a network
Logical extension of virtualization because it uses virtualization as the base
for it functionality.
Amazon Elastic Compute cloud has thousands of servers, millions of
virtual machines, petabytes of storage available across the Internet, pay
based on usage
Many types
Public cloud – available via Internet to anyone willing to pay
Private cloud – run by a company for the company’s own use
Hybrid cloud – includes both public and private cloud components
Software as a Service (SaaS) – one or more applications available via
the Internet (i.e., word processor)
Platform as a Service (PaaS) – software stack ready for application use
via the Internet (i.e., a database server)
Infrastructure as a Service (IaaS) – servers or storage available over
Internet (i.e., storage available for backup use)
COMPUTING ENVIRONMENTS – CLOUD COMPUTING
Cloud computing environments composed of traditional
OSes, plus VMMs, plus cloud management tools
Internet connectivity requires security like firewalls
Load balancers spread traffic across multiple applications
COMPUTING ENVIRONMENTS – REAL-TIME SYSTEMS
Real-time embedded systems most prevalent form of
computers
Vary considerable, special purpose, limited purpose OS,
real-time OS
Use expanding
Many other special computing environments as well
Some have OSes, some perform tasks without an OS
Real-time OS has well-defined fixed time constraints
Processing must be done within constraint
Correct operation only if constraints met