Ch1 - Introduction OSC DragonBook
Ch1 - Introduction OSC DragonBook
Chapter 1: Introduction
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
Operating System Concepts – 10h Edition Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.4 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.2 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.5 Silberschatz, Galvin and Gagne ©2018
1
Defining Operating Systems Computer-System Operation
Operating System Concepts – 10th Edition 1.7 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.10 Silberschatz, Galvin and Gagne ©2018
No universally accepted definition Interrupt transfers control to the interrupt service routine
“Everything a vendor ships when you order an operating
generally, through the interrupt vector, which contains the
system” is a good approximation addresses of all the service routines
But varies wildly Interrupt architecture must save the address of the
interrupted instruction
“The one program running at all times on the computer” is
A trap or exception is a software-generated interrupt
the kernel, part of the operating system
caused either by an error or a user request
Everything else is either
An operating system is interrupt driven
a system program (ships with the operating system, but
not part of the kernel) , or
an application program, all programs not associated
with the operating system
Today’s OSes for general purpose and mobile computing also
include middleware – a set of software frameworks that
provide addition services to application developers such as
databases, multimedia, graphics
Operating System Concepts – 10th Edition 1.8 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.11 Silberschatz, Galvin and Gagne ©2018
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
Operating System Concepts – 10th Edition 1.9 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.12 Silberschatz, Galvin and Gagne ©2018
2
Computer Startup I/O Structure
bootstrap program is loaded at power-up or reboot After I/O starts, control returns to user program only upon I/O
completion
Typically stored in ROM or EPROM, generally known
as firmware Wait instruction idles the CPU until the next interrupt
Initializes all aspects of system Wait loop (contention for memory access)
At most one I/O request is outstanding at a time, no
Loads operating system kernel and starts execution
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
Operating System Concepts – 10th Edition 1.13 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.16 Silberschatz, Galvin and Gagne ©2018
The operating system preserves the state of the CPU by Main memory – only large storage media that the CPU can access directly
storing registers and the program counter Random access
Operating System Concepts – 10th Edition 1.14 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.17 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.15 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.18 Silberschatz, Galvin and Gagne ©2018
3
Storage Hierarchy Direct Memory Access Structure
Storage systems organized in hierarchy Used for high-speed I/O devices able to transmit
Speed information at close to memory speeds
Operating System Concepts – 10th Edition 1.19 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.22 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.20 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.23 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.21 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.24 Silberschatz, Galvin and Gagne ©2018
4
A Dual-Core Design Clustered Systems
Multi-chip and multicore
Systems containing all chips
Chassis containing multiple separate systems
Operating System Concepts – 10th Edition 1.25 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.28 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.26 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.29 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.27 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.30 Silberschatz, Galvin and Gagne ©2018
5
Multiprogramming and Multitasking Transition from User to Kernel Mode
Multiprogramming (Batch system) needed for efficiency Timer to prevent infinite loop / process hogging resources
Single user cannot keep CPU and I/O devices busy at all times Timer is set to interrupt the computer after some time period
Multiprogramming organizes jobs (code and data) so CPU always has one Keep a counter that is decremented by the physical clock
to execute
A subset of total jobs in system is kept in memory
Operating system set the counter (privileged instruction)
One job selected and run via job scheduling When counter zero generate an interrupt
When it has to wait (for I/O for example), OS switches to another job Set up before scheduling process to regain control or terminate
program that exceeds allotted time
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
If processes don’t fit in memory, swapping moves them in and out to run
Virtual memory allows execution of processes not completely in memory
Operating System Concepts – 10th Edition 1.31 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.34 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.32 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.35 Silberschatz, Galvin and Gagne ©2018
Dual-mode operation allows OS to protect itself and other system The operating system is responsible for the following activities in
components connection with process management:
User mode and kernel mode
Creating and deleting both user and system processes
Mode bit provided by hardware
Suspending and resuming processes
Provides ability to distinguish when system is running user
code or kernel code Providing mechanisms for process synchronization
Some instructions designated as privileged, only
Providing mechanisms for process communication
executable in kernel mode
Providing mechanisms for deadlock handling
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
Operating System Concepts – 10th Edition 1.33 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.36 Silberschatz, Galvin and Gagne ©2018
6
Memory Management Caching
To execute a program all (or part) of the instructions must be in Important principle, performed at many levels in a computer
memory (in hardware, operating system, software)
All (or part) of the data that is needed by the program must be in Information in use copied from slower to faster storage
memory temporarily
Memory management determines what is in memory and when Faster storage (cache) checked first to determine if
Optimizing CPU utilization and computer response to users information is there
Memory management activities If it is, information used directly from the cache (fast)
Keeping track of which parts of memory are currently being If not, data copied to cache and used there
used and by whom Cache smaller than storage being cached
Deciding which processes (or parts thereof) and data to Cache management important design problem
move into and out of memory Cache size and replacement policy
Allocating and deallocating memory space as needed
Operating System Concepts – 10th Edition 1.37 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.40 Silberschatz, Galvin and Gagne ©2018
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 Movement between levels of storage hierarchy can be explicit or implicit
Primitives to manipulate files and directories
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
Operating System Concepts – 10th Edition 1.38 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.41 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.39 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.42 Silberschatz, Galvin and Gagne ©2018
7
I/O Subsystem Virtualization (cont.)
One purpose of OS is to hide peculiarities of hardware devices Use cases involve laptops and desktops running multiple OSes
from the user for exploration or compatibility
I/O subsystem responsible for Apple laptop running Mac OS X host, Windows as a guest
Memory management of I/O including buffering (storing data Developing apps for multiple OSes without having multiple
temporarily while it is being transferred), caching (storing parts systems
of data in faster storage for performance), spooling (the
QA testing applications without having multiple systems
overlapping of output of one job with input of other jobs)
Executing and managing compute environments within data
General device-driver interface
centers
Drivers for specific hardware devices
VMM can run natively, in which case they are also the host
There is no general purpose host then (VMware ESX and
Citrix XenServer)
Operating System Concepts – 10th Edition 1.43 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.46 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.44 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.47 Silberschatz, Galvin and Gagne ©2018
Distributed computiing
Allows operating systems to run applications within other OSes
Collection of separate, possibly heterogeneous, systems
Vast and growing industry
networked together
Emulation used when source CPU type different from target
Network is a communications path, TCP/IP most common
type (i.e. PowerPC to Intel x86)
– Local Area Network (LAN)
Generally slowest method
– Wide Area Network (WAN)
When computer language not compiled to native code –
Interpretation – Metropolitan Area Network (MAN)
Virtualization – OS natively compiled for CPU, running guest – Personal Area Network (PAN)
OSes also natively compiled Network Operating System provides features between
Consider VMware running WinXP guests, each running systems across network
applications, all on native WinXP host OS Communication scheme allows systems to exchange
VMM (virtual machine Manager) provides virtualization messages
services Illusion of a single system
Operating System Concepts – 10th Edition 1.45 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.48 Silberschatz, Galvin and Gagne ©2018
8
Kernel Data Structures Computing Environments - Traditional
n Many similar to standard programming data structures Stand-alone general purpose machines
n Singly linked list 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
n Doubly linked list
Networking becoming ubiquitous – even home systems use
firewalls to protect home computers from Internet attacks
Operating System Concepts – 10th Edition 1.49 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.52 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.50 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.53 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.51 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.54 Silberschatz, Galvin and Gagne ©2018
9
Computing Environments - Peer-to-Peer Computing Environments – Real-Time Embedded Systems
Another model of distributed system Real-time embedded systems most prevalent form of computers
P2P does not distinguish clients and servers Vary considerable, special purpose, limited purpose OS,
real-time OS
Instead all nodes are considered peers
Use expanding
May each act as client, server or both
Many other special computing environments as well
Node must join P2P network
Some have OSes, some perform tasks without an OS
Registers its service with central
lookup service on network, or Real-time OS has well-defined fixed time constraints
Broadcast request for service and Processing must be done within constraint
respond to requests for service via Correct operation only if constraints met
discovery protocol
Examples include Napster and Gnutella,
Voice over IP (VoIP) such as Skype
Operating System Concepts – 10th Edition 1.55 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.58 Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.56 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.59 Silberschatz, Galvin and Gagne ©2018
Operating systems that are no longer commercially viable have been open-sourced as well, enabling
us to study how systems operated in a time of fewer CPU, memory, and storage resources.
An extensive but incomplete list of open-source operating-system projects is available
from https://curlie.org/Computers/Software/Operating_Systems/Open_Source/
In addition, the rise of virtualization as a mainstream (and frequently free) computer function
makes it possible to run many operating systems on top of one core system. For example, VMware
(http://www.vmware.com) providesa free “player” for Windows on which hundreds of free
“virtual appliances” can run. Virtualbox (http://www.virtualbox.com) provides a free, open-source
virtual machine manager on many operating systems. Using such tools, students can try out
hundreds of operating systems without dedicated hardware.
The advent of open-source operating systems has also made it easier to make the move from
student to operating-system developer. With some knowledge, some effort, and an Internet
connection, a student can even create a new operating-system distribution. Just a few years ago,
it was difficult or impossible to get access to source code. Now, such access is limited only by
how much interest, time, and disk space a student has.
Operating System Concepts – 10th Edition 1.57 Silberschatz, Galvin and Gagne ©2018 Operating System Concepts – 10th Edition 1.60 Silberschatz, Galvin and Gagne ©2018
10
End of Chapter 1
Operating System Concepts – 10h Edition Silberschatz, Galvin and Gagne ©2018
Operating System Concepts – 10th Edition 1.62 Silberschatz, Galvin and Gagne ©2018
11