0% found this document useful (0 votes)
40 views70 pages

Chapter 1

This chapter introduces operating systems including their definition, components, and roles. It discusses how operating systems abstract hardware resources, manage shared resources, and act as an intermediary between hardware and users. The chapter also covers why operating systems are important to study.

Uploaded by

robinshrestha089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views70 pages

Chapter 1

This chapter introduces operating systems including their definition, components, and roles. It discusses how operating systems abstract hardware resources, manage shared resources, and act as an intermediary between hardware and users. The chapter also covers why operating systems are important to study.

Uploaded by

robinshrestha089
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 70

Chapter 1: Introduction

Slides was adopted from Silberschatz, Operating System Concepts, 10th ed.

CSCI 3453 Operating Systems Concepts 1


Objectives

 Questions will be answered in this lecture:


 What is an operating system?
 How have operating systems evolved?
 Why study operating systems?

CSCI 3453 Operating Systems Concepts 2


Chapter 1: Introduction
 What Operating Systems Do
 Computer-System Organization
 Computer-System Architecture
 Operating-System Structure
 Operating-System Operations
 Resource Management
 Security and Protection
 Virtualization
 Distributed Systems
 Kernel Data Structures
 Computing Environments
 Open-Source Operating Systems
CSCI 3453 Operating Systems Concepts 3
Four Components of a Computer System

CSCI 3453 Operating Systems Concepts 4


What is an Operating System?

CSCI 3453 Operating Systems Concepts 5


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
 System & 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
CSCI 3453 Operating Systems Concepts 6
What is an Operating System?
 Not easy to define precisely…

Users
compilers
Applications databases
word processors
Operating System
CPU
Hardware memory
I/O devices
 OS:
Everything in system that isn’t an application or hardware
 OS:
Software that converts hardware into a useful form for
applications
CSCI 3453 Operating Systems Concepts 7
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.
 Maximize resource performance and utilization

 Use the computer hardware in an efficient


manner.

CSCI 3453 Operating Systems Concepts 8


What is the role of the OS?
 Role #1: Provide standard Library (I.e., abstract
resources)
 What is a resource?
 Anything valuable (e.g., CPU, memory, disk)
 Advantages of standard library
 Allow applications to reuse common facilities
 Make different devices look the same
 Provide higher-level abstractions
 Challenges
 What are the correct abstractions?
 How much of hardware should be exposed?

CSCI 3453 Operating Systems Concepts 9


Example: Disk Abstractions
OS Programmer Application
Programmer

int fprintf(…) {
...
void write() { write(…)
load(…); load(…); …
seek(…); seek(…) }
out(…); out(…)
}

(a) Direct Control


(b) write() (c) fprintf()
abstraction abstraction
CSCI 3453 Operating Systems Concepts 10
What is the role of the OS?
 Role #2: Resource coordinator (I.e.,
manager)

 Advantages of resource coordinator


 Virtualized resources so multiple users or
applications can share
 Protect applications from one another
 Provide efficient and fair access to resources

 Challenges
 What are the correct mechanisms?
 What are the correct policies?

CSCI 3453 Operating Systems Concepts 11


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
 OS is designed for ease of use
 OS is designed for individual usability

CSCI 3453 Operating Systems Concepts 12


Operating System Definition (Cont.)

 No universally accepted definition


 “Everything a vendor ships when you order an
operating system” is good approximation
 But varies wildly, not accepted in our class
 “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

CSCI 3453 Operating Systems Concepts 13


What Functionality belongs in OS?
 No single right answer
 Desired functionality depends on outside
factors
 OS must adapt to both user expectations and
technology changes
• Change abstractions provided to users
• Change algorithms to implement those abstractions
• Change low-level implementation to deal with
hardware

 Current operating systems driven by


evolution
CSCI 3453 Operating Systems Concepts 14
OS Components
 Kernel: Core components of the OS

 Process scheduler
 Determines when and for long each process executes

 Memory manager
 Determines when and how memory is allocated to
processes
 Decides what to do when main memory is full

 File system
 Organizes named collections of data in persistent
storage
 Networking
 Enables processes to communicate with one another

 I/O Device Manager


CSCI 3453 Operating Systems Concepts 15
Why study Operating Systems? (1)
 Build, modify, or administer an operating
system

 Understand system performance


 Behavior of OS impacts entire machine
 Challenge to understand large, complex system
 Tune workload performance
 Apply knowledge across many areas
• Computer architecture, programming languages, data
structures and algorithms, and performance modeling

CSCI 3453 Operating Systems Concepts 16


Why study Operating Systems? (2)
 Application benefits
 programming simplicity
• see high-level abstractions (files) instead of low-level hardware
details (device registers)
• abstractions are reusable across many programs
 portability (across machine configurations or architectures)
• device independence: 3com card or Intel card?
 User benefits
 safety
• program “sees” its own virtual machine, thinks it “owns” the
computer
• OS protects programs from each other
• OS fairly multiplexes resources across programs
 efficiency (cost and speed)
• share one computer across many users
• concurrent execution of multiple programs

CSCI 3453 Operating Systems Concepts 17


Chapter 1: Introduction
 What Operating Systems Do
 Computer-System Organization
 Computer-System Architecture
 Operating-System Structure
 Operating-System Operations
 Resource Management
 Security and Protection
 Virtualization
 Distributed Systems
 Kernel Data Structures
 Computing Environments
 Open-Source Operating Systems
CSCI 3453 Operating Systems Concepts 18
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

CSCI 3453 Operating Systems Concepts 19


Computer-System Operation
 I/O devices and the CPU can execute concurrently.
 Each device controller is in charge of a particular device type.
 Each device controller has a local buffer.

 CPU moves data from/to main memory to/from local


buffers
 I/O is from the device to local buffer of controller.

 Device controller informs CPU that it has finished its


operation by causing an interrupt.

CSCI 3453 Operating Systems Concepts 20


Common Functions of Interrupts
 Interrupt transfers control to the interrupt service
routine generally, through the interrupt vector, which
contains the addresses of all the service routines.
 Interrupt architecture must save the address of the
interrupted instruction.
 Incoming interrupts are disabled while another
interrupt is being processed to prevent a lost interrupt.
 A trap is a software-generated interrupt caused either
by an error or a user request.
 An operating system is interrupt driven.

CSCI 3453 Operating Systems Concepts 21


Interrupt Handling

 The operating system preserves the state of


the CPU by storing registers and the
program counter
 Determines which type of interrupt has
occurred:
 polling
 vectored interrupt system

 Separate segments of code determine what


action should be taken for each type of
interrupt

CSCI 3453 Operating Systems Concepts 22


Interrupt Timeline

CSCI 3453 Operating Systems Concepts 23


I/O Structure
 After I/O starts, control returns to user
program only upon I/O completion
 Wait instruction idles the CPU until the next interrupt
 Wait loop (contention for memory access)
 At most one I/O request is outstanding at a time, no
simultaneous I/O processing
 After I/O starts, control returns to user
program without waiting for I/O completion
 System call – request to the OS to allow user to wait
for I/O completion
 Device-status table contains entry for each I/O device
indicating its type, address, and state
 OS indexes into I/O device table to determine device
status and to modify table entry to include interrupt

CSCI 3453 Operating Systems Concepts 24


Storage Structure
 Main memory – only large storage media that the CPU
can access directly
 Random access
 Typically volatile
 Secondary storage – extension of main memory that
provides large nonvolatile storage capacity
 Hard disks – rigid metal or glass platters covered
with magnetic recording material
 Disk surface is logically divided into tracks, which are subdivided
into sectors
 The disk controller determines the logical interaction between the
device and the computer
 Solid-state disks – faster than hard disks,
nonvolatile
 Various technologies
 Becoming
CSCI 3453 more popular
Operating Systems Concepts 25
Storage Hierarchy
 Storage systems organized in hierarchy
 Speed
 Cost
 Volatility

 Caching – copying information into faster


storage system; main memory can be
viewed as a cache for secondary storage
 Device Driver for each device controller
to manage I/O
 Provides uniform interface between controller
and kernel

CSCI 3453 Operating Systems Concepts 26


Storage-Device Hierarchy

CSCI 3453 Operating Systems Concepts 27


Performance of Various Levels of Storage
 Movement between levels of storage
hierarchy can be explicit or implicit

CSCI 3453 Operating Systems Concepts 28


Migration of data “A” from Disk to Register
 Multitasking environments must be careful to use most
recent value, no matter where it is stored in the
storage hierarchy

 Multiprocessor environment must provide cache


coherency in hardware such that all CPUs have the
most recent value in their cache
 Distributed environment situation even more complex
 Several copies of a datum can exist
 Various solutions covered in Chapter 17

CSCI 3453 Operating Systems Concepts 29


Storage Structure
 Main memory – only large storage media that
the CPU can access directly.
 Secondary storage – extension of main memory
that provides large nonvolatile storage
capacity.
 Magnetic disks – rigid metal or glass platters
covered with magnetic recording material
 Disk surface is logically divided into tracks, which
are subdivided into sectors.
 The disk controller determines the logical
interaction between the device and the computer.

CSCI 3453 Operating Systems Concepts 30


Storage Hierarchy
 Storage systems organized in hierarchy.
 Speed
 Cost
 Volatility

 Caching – copying information into faster


storage system; main memory can be
viewed as a last cache for secondary
storage.

CSCI 3453 Operating Systems Concepts 31


Caching
 Important principle, performed at many levels in a
computer (in hardware, operating system, software)
 Information in use copied from slower to faster
storage temporarily
 Faster storage (cache) checked first to determine
if information is there
 If it is, information used directly from the cache (fast)
 If not, data copied to cache and used there
 Cache smaller than storage being cached
 Cache management important design problem
 Cache size and replacement policy

CSCI 3453 Operating Systems Concepts 32


Direct Memory Access Structure

 Used for high-speed I/O devices able to


transmit information at close to memory
speeds
 Device controller transfers blocks of data
from buffer storage directly to main
memory without CPU intervention
 Only one interrupt is generated per block,
rather than the one interrupt per byte

CSCI 3453 Operating Systems Concepts 33


Chapter 1: Introduction
 What Operating Systems Do
 Computer-System Organization
 Computer-System Architecture
 Operating-System Structure
 Operating-System Operations
 Resource Management
 Security and Protection
 Virtualization
 Distributed Systems
 Kernel Data Structures
 Computing Environments
 Open-Source Operating Systems
CSCI 3453 Operating Systems Concepts 34
How a Modern Computer Works

CSCI 3453 Operating Systems Concepts 35


Single-Processor System
 Most systems use a single processor
 Only one general-purpose CPU
 Executing user processes

1. Mouse & keyboard


2. USB
3. Parallel port
4. CPU Chip
5. RAM slots
6. Floppy controller
7. IDE controller
8. PCI slot
9. ISA slot
10. CMOS Battery
11. AGP slot
12. CPU slot
13. Power supply plug in

CSCI 3453 Operating Systems Concepts 36


Multi-core architectures
 Put two or more independent cores into a single
integrated circuit (IC), called a die.
 OS operates each core as a separate processor
 OS scheduler maps threads/processes
to different cores
 Windows, Linux, Mac OS X, …

Core 1 Core 2 Core 3 Core 4

CSCI 3453 Operating Systems Concepts 37


Multi-Core Architecture
PCI-E
PCI-E
Expansion
Bridge
HUB
Core 1 Core 2

FB DDR2 DDR2
ESB2
Memory Controller Core 1 Core 2
I/O

PCI Express PCI-X


Bridge

Intel Woodcrest AMD Opterons


Intel Xeon 5100 Socket F
CSCI 3453 Operating Systems Concepts 38
Multiprocessor Systems
 System with several CPUs in close
communication.
 Tightly coupled system:
 processors share memory and a clock.
 communication usually takes place through the
shared memory.
 Advantages:
 Increased throughput
 Economical
 Increased reliability
• graceful degradation
• fail-soft systems

CSCI 3453 Operating Systems Concepts 39


Symmetric Multiprocessing Architecture

CSCI 3453 Operating Systems Concepts 40


Multiprocessor Architecture

CSCI 3453 Operating Systems Concepts 41


Multiprocessor Systems
Asymmetric multiprocessing
 master processor schedules and allocates work to
slave processors.
Symmetric multiprocessing (SMP)
 Each processor runs an identical copy of the
operating system.
 Typically each processor does self-scheduling form
the pool of available process.
 Most modern operating systems support SMP.

CSCI 3453 Operating Systems Concepts 42


Symmetric Multiprocessing (SMP)
 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 parallelism).
 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.

CSCI 3453 Operating Systems Concepts 43


Symmetric Multiprocessor Organization

Processor Processor Processor


Cache Cache
. . . Cache

Main
Memory I/O
Subsystem

CSCI 3453 Operating Systems Concepts 44


Clustered Systems
 Clustering allows two or more systems to
share storage.
 Provides high reliability.
 Asymmetric clustering: one server runs the
application while other servers standby.
 Symmetric clustering: all N hosts are
running the application.

CSCI 3453 Operating Systems Concepts 45


Clustered Systems

CSCI 3453 Operating Systems Concepts 46


Chapter 1: Introduction
 What Operating Systems Do
 Computer-System Organization
 Computer-System Architecture
 Operating-System Structure
 Operating-System Operations
 Resource Management
 Security and Protection
 Virtualization
 Distributed Systems
 Kernel Data Structures
 Computing Environments
 Open-Source Operating Systems
CSCI 3453 Operating Systems Concepts 47
Operating System Structure
 Multiprogramming needed for efficiency
 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
 One job selected and run via job scheduling
 When it has to wait (for I/O for example),
OS switches to another job

CSCI 3453 Operating Systems Concepts 48


Memory Layout for Multiprogrammed
System

CSCI 3453 Operating Systems Concepts 49


Multi-programmed Systems
 If memory can hold several programs, then CPU can
switch to another one whenever a program is awaiting
for an I/O to complete
 This is multiprogramming.

CSCI 3453 Operating Systems Concepts 50


OS Features Needed for Multiprogramming
 I/O routine supplied by the system.
 Memory management – the system must
allocate the memory to several jobs.
 CPU scheduling – the system must
choose among several jobs ready to run.
 Allocation of devices.

CSCI 3453 Operating Systems Concepts 51


Operating System Structure
 Timesharing (multitasking) is logical extension
in which CPU switches jobs so frequently that
users can interact with each job while it is
running, creating interactive computing
 Response time should be < 1 second
 Each user has at least one program executing in
memory process
 If several jobs ready to run at the same time
CPU scheduling
 swapping moves
them in and out to run
 Virtual memory allows execution of processes not
completely in memory

CSCI 3453 Operating Systems Concepts 52


Chapter 1: Introduction
 What Operating Systems Do
 Computer-System Organization
 Computer-System Architecture
 Operating-System Structure
 Operating-System Operations
 Resource Management
 Security and Protection
 Virtualization
 Distributed Systems
 Kernel Data Structures
 Computing Environments
 Open-Source Operating Systems
CSCI 3453 Operating Systems Concepts 53
Operating-System Operations (1)
 Interrupt driven by hardware
 Software error or request creates exception
or trap
 Division by zero, request for operating system
service
 Other process problems include infinite loop,
processes modifying each other or the
operating system

CSCI 3453 Operating Systems Concepts 54


Operating-System Operations (2)
 Dual-mode operation allows OS to protect
itself and other system components
 User mode and kernel mode
 Mode bit provided by hardware
• Provides ability to distinguish when system is running user
code or kernel code
• Some instructions designated as privileged, only executable
in kernel mode
• System call changes mode to kernel, return from call resets
it to user
 Increasingly CPUs support multi-mode
operations
 i.e. Virtual Machine Manager (VMM) mode for guest
VMs

CSCI 3453 Operating Systems Concepts 55


Transition from User to Kernel Mode
 Timer to prevent infinite loop / process
hogging resources
 Set interrupt after specific period
 Operating system decrements counter
 When counter zero generate an interrupt
 Set up before scheduling process to regain control or
terminate program that exceeds allotted time

CSCI 3453 Operating Systems Concepts 56


Types of Operating Systems
 Five categories
 Batch
 Interactive
 Real-time
 Hybrid
 Embedded

 Three distinguishing features


 Response time
 Throughput
 How data enters into the system

CSCI 3453 Operating Systems Concepts 89


Types of Operating Systems
(continued)
 Batch Systems
 Input relied on punched cards or tape
 Efficiency measured in throughput

 Interactive Systems
 Faster turnaround than batch systems
 Slower than real-time systems
 Introduced to provide fast turnaround when
debugging programs
 Time-sharing software developed for operating
system
CSCI 3453 Operating Systems Concepts 90
Types of Operating Systems
(continued)
 Real-time systems
 Reliability is key
 Fast and time limit sensitive
 Used in time-critical environments
• Space flights, airport traffic control, high-speed
aircraft
• Industrial processes
• Sophisticated medical equipment
• Distribution of electricity
• Telephone switching
 Must be 100% responsive, 100% of the time
CSCI 3453 Operating Systems Concepts 91
Types of Operating Systems
(continued)
 Hybrid systems
 Combination of batch and interactive
 Accept and run batch programs in the background
• Interactive load is light
 Embedded systems
 Computers placed inside other products
 Adds features and capabilities
 Operating system requirements
• Perform specific set of programs
• Not interchangeable among systems
• Small kernel and flexible function capabilities

CSCI 3453 Operating Systems Concepts 92


Migration of Operating-System Concepts and
Features

CSCI 3453 Operating Systems Concepts 93


What Is an OS?
“Code” that:

 Sits between programs & hardware


 Sits between different programs
 Sits betweens different users

But what does it do?

CSCI 3453 Operating Systems Concepts 95


What Is an OS?
Resources Services
 Allocation  Abstraction
 Protection  Simplification
 Reclamation  Convenience
 Virtualization  Standardization

Makes computers simpler

CSCI 3453 Operating Systems Concepts 96


What Is an OS?
Resources
 Allocation Finite resources
 Protection Competing demands
 Reclamation
 Virtualization Examples:
 CPU
 Memory
 Disk
 Network

CSCI 3453 Operating Systems Concepts 97


What Is an OS?
Resources
 Allocation
 Protection
 Reclamation Implies some degree of
 Virtualization safety & security

CSCI 3453 Operating Systems Concepts 98


What Is an OS?
Resources
The OS give resources
 Allocation
The OS take resources away
 Protection
 Reclamation
Voluntary at run time
 Virtualization
Implied at termination
Involuntary
Cooperative

CSCI 3453 Operating Systems Concepts 99


What Is an OS?
Resources
 Allocation Illusion of infinite,
 Protection
private resources
 Reclamation
 Virtualization
Memory versus disk
Timeshared CPU

More extreme cases


possible (& exist)

CSCI 3453 Operating Systems Concepts 100


The major OS issues
 structure: how is the OS organized?
 sharing: how are resources shared across users?
 naming: how are resources named (by users, by programs)?
 protection: how is one user/program protected from another?
 security: how is the integrity of the OS and its resources
ensured?
 performance: how do we make it all go fast?
 availability: can you always access the services you need?
 reliability: what happens if something goes wrong (either with
hardware or with a program)?
 extensibility: can we add new features?
 communication: how do programs exchange information, including
across a network?

CSCI 3453 Operating Systems Concepts 101


More OS issues…
 concurrency: how are parallel activities (computation and
I/O) created and controlled?
 scale: what happens as demands or resources increase?
 persistence: how do you make data last longer than program
executions?
 distribution: how do multiple computers interact with each
other?
 accounting: how do we keep track of resource usage, and
perhaps charge for it?
 auditing: can we reconstruct who did what to whom?

There are tradeoffs – not right and wrong!

CSCI 3453 Operating Systems Concepts 102


End of Chapter 1

CSCI 3453 Operating Systems Concepts 103

You might also like