ch01 -m- Introduction
ch01 -m- Introduction
Operating System Concepts – 10th Edition Silberschatz, Galvin and Gagne ©2018
What is an Operating System?
Operating System Concepts – 10th Edition 2.2 Silberschatz, Galvin and Gagne ©2018
Computer System Components
Operating System Concepts – 10th Edition 2.3 Silberschatz, Galvin and Gagne ©2018
Abstract View of System Components
Operating System Concepts – 10th Edition 2.4 Silberschatz, Galvin and Gagne ©2018
Operating System Definitions
OS is a resource allocator
Manages and allocates all resources (CPU time, memory space,
file-storage space, I/O devices, etc.)
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 (control operations of I/O devices)
Parts of the OS
The one program running at all times on the computer is the
kernel.
Shell – Operating systems such as Windows and Unix include a
command interpreter as a special program. It is an interface
between user and the kernel which can also be used to start an
application program. GUI is an alternative interface for the OS.
Everything else is
either a system program (ships with the operating system),
or an application program.
Operating System Concepts – 10th Edition 2.5 Silberschatz, Galvin and Gagne ©2018
Kernel Services
I/O Management
Process Management
Memory Management
File Systems Management
Device Drivers Management
System Calls (Application Program Interface)
Interprocess Communication
Protection System
Networking
Operating System Concepts – 10th Edition 2.7 Silberschatz, Galvin and Gagne ©2018
Computer System Organization
A modern general purpose computer-system consists of
One or more CPUs and device controllers (disk controller,
USB controller, etc.) are connected through common bus
providing access between components and shared memory
CPU and the device controllers can execute in parallel (i.e.
concurrently)
Memory controller synchronizes access to the memory to
ensure orderly accessing
memory controller
Operating System Concepts – 10th Edition 2.8 Silberschatz, Galvin and Gagne ©2018
Computer System Organization
The device controller is responsible for moving the data between the
peripheral devices that it controls and its local buffer storage.
Operating System Concepts – 10th Edition 2.9 Silberschatz, Galvin and Gagne ©2018
Computer System Operation
The occurrence of an event is usually signaled by an interrupt from
either the hardware or the software.
Hardware may trigger an interrupt at any time by sending a signal to
the CPU, usually by way of the system bus. When the CPU is
interrupted, it stops what it is doing and immediately transfers
execution to the address where the service routine for the interrupt
is located.
Software may trigger an interrupt by executing a special operation
called a system call
Operating System Concepts – 10th Edition 2.10 Silberschatz, Galvin and Gagne ©2018
Simple Batch Systems (1960’s)
Operating System Concepts – 10th Edition 2.12 Silberschatz, Galvin and Gagne ©2018
Multiprogrammed Batch Systems (1970’s)
Operating System Concepts – 10th Edition 2.13 Silberschatz, Galvin and Gagne ©2018
Spooling
Spooling: Simultaneous Peripheral Operation on-line is another major feature
of multiprogramming operating systems
Jobs are not read directly into memory but onto the disk. Since reading is time
consuming, some other jobs can be performed during reading.
Overlap I/O of one job with computation of another job. While executing one
job,
Next job can be read from card reader into a storage area
Print the output of previous job from disk to printer
The main goal is reduce CPU idle time since I/O speed is slower than CPU
speed
By using spooling technique, a printer could be used by users without waiting
Operating System Concepts – 10th Edition 2.14 Silberschatz, Galvin and Gagne ©2018
OS Features Needed for Multiprogramming
A single user cannot keep CPU and I/O devices busy at all times. In
multiprogramming systems there are several jobs in memory at the same
time. They organize jobs (code and data) so that CPU always has one to
execute. One job selected and run via job scheduling. When it has to wait
(for I/O for example), OS switches to another job. In order to accomplish
these, some features are needed:
Operating System Concepts – 10th Edition 2.15 Silberschatz, Galvin and Gagne ©2018
Time-Sharing (multitasking) Systems-Interactive Computing
Operating System Concepts – 10th Edition 2.16 Silberschatz, Galvin and Gagne ©2018
Parallel or Multiprocessor Systems
The failure of one processor does not halt the system (also
known as fault tolerance). The rest continues to do the
task. The ability to continue providing service proportional
to the level of surviving hardware is called graceful
degradation.
Operating System Concepts – 10th Edition 2.17 Silberschatz, Galvin and Gagne ©2018
Multiprocessor Systems
Asymmetric multiprocessing
Each processor is assigned a specific task; master or boss
processor schedules and allocates work to slave or worker
processors.
More common in extremely large systems
Operating System Concepts – 10th Edition 2.18 Silberschatz, Galvin and Gagne ©2018
Symmetric Multiprocessing Architecture
A typical SMP architecture. Notice that each processor has its own set
of registers, as well as a private—or local—cache. However, all
processors share physical memory.
More efficient than multiple chips with single core because on-
chip communication is faster than between-chip communication
Figure shows dual-core design with two cores on the same chip
Operating System Concepts – 10th Edition 2.20 Silberschatz, Galvin and Gagne ©2018
Distributed Systems
A collection of physically separate, possibly heterogeneous,
computer systems that are networked to provide users with access
to the various resources that the system maintains.
Distribute the computation among several physical processors
referred to as sites, nodes, computers etc.
Unlike tightly-coupled parallel systems, these are loosely coupled
systems
each processor has its own local memory
processors communicate with one another through various
communications lines, such as high-speed buses or telephone
lines.
Advantages of distributed systems.
Resources Sharing (printers, files etc.)
Computation speed up – load sharing
Reliability
Communications – information exchange
Operating System Concepts – 10th Edition 2.21 Silberschatz, Galvin and Gagne ©2018
Distributed Systems
Collection of separate, possibly heterogeneous systems require
a networking structure
Operating System Concepts – 10th Edition 2.22 Silberschatz, Galvin and Gagne ©2018
Distributed Systems
Networking support is necessary in distributed systems.
Network Operating System is a computer operating system
that facilitates to connect and communicate various autonomous
computers over a network. Provide features such as file sharing
across the network, along with a communication scheme that
allow
Different processes on different computers to exchange
messages.
The different computers communicate closely enough to
provide the illusion that only a single operating system
controls the network
Operating System Concepts – 10th Edition 2.23 Silberschatz, Galvin and Gagne ©2018
Distributed Computing Environments
Operating System Concepts – 10th Edition 2.24 Silberschatz, Galvin and Gagne ©2018
Distributed Computing Environments
Peer-to-Peer Computing is another model of
distributed systems
P2P does not distinguish clients and servers
All nodes are considered as peers
Each 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, that
allow users to exchange files. Voice over IP
(VoIP) used by Skype allows clients to make
voice calls and video calls and to send text
messages over the Internet.
Operating System Concepts – 10th Edition 2.25 Silberschatz, Galvin and Gagne ©2018
Cloud Computing Systems
Cloud computing is a
type of computing that
delivers computing,
storage, and even
applications as a service
across a network.
Public clouds are
available via the Internet
to anyone willing to pay
for the services
Cloud computing
environments are
composed of traditional
OS’s, plus cloud
management tools
Operating System Concepts – 10th Edition 2.26 Silberschatz, Galvin and Gagne ©2018
Real-Time Embedded Systems
Special-purpose systems that are often used as a control
device in a dedicated application such as controlling
scientific experiments, medical imaging systems, industrial
control systems, and some display systems (car engines,
manufacturing robots, DVDs, microwave ovens,
firewalls,etc.)
Embedded systems run real-time operating systems.
Generally there is no user interface. They perform managing
and monitoring of the hardware.
Real-time OS has well-defined fixed time constraints
Processing must be done within the defined constraint.
Data brought by sensors to the computer, must be
analyzed and corresponding control adjustments must be
done in a small time interval
Correct operation only if constraints met
Operating System Concepts – 10th Edition 2.27 Silberschatz, Galvin and Gagne ©2018
Personal Computer Systems
Operating System Concepts – 10th Edition 2.28 Silberschatz, Galvin and Gagne ©2018
Mobile Systems
Operating System Concepts – 10th Edition 2.29 Silberschatz, Galvin and Gagne ©2018
History of Operating Systems
First Generation: Fourth Generation:
*1945-1955 *1980-present
*Vacuum Tubes *Large scale integration
*OS: Plugboards *Personal computers
*OS: personal systems
Second Generation:
*1955-1965
Next Generation:
*Transistors
*????
*OS: Batch Systems
*System connected to high
speed networks
Third Generation: *Wide area resource control
*1965-1980 *OS: net-centric computing,
*Integrated circuits embedded systems.
*OS: Multiprogramming
Operating System Concepts – 10th Edition 2.30 Silberschatz, Galvin and Gagne ©2018
Storage Structure
Main memory (primary storage, RAM) – only large storage media that the
CPU can access directly (so any programs must first be loaded into
memory to run).
Random access
Typically volatile (it loses its contents when power is turned off or otherwise
lost)
Disks (secondary storage) – extension of main memory that provides
large nonvolatile storage capacity
Secondary storage is also much slower than main memory.
Hard disks – rigid metal or glass platters covered with magnetic
recording material (Hard Disk Drives-HDDs)
Solid-state disks (SSDs)– faster than hard disks, nonvolatile
Various technologies
Becoming more popular
Optical disks, mahnetic tapes (tertiary storage) They are slow enough
and large enough and used only for special purposes (to store backup
copies of material).
Operating System Concepts – 10th Edition 2.31 Silberschatz, Galvin and Gagne ©2018
Storage Structure (cont.)
Notes:
The programs must be in the main memory to be executed.
CPU automatically loads instruction from main memory for
execution
Main memory is an array of words or bytes ranging in size. Each
word has it own size.
Secondary storage provides storage for programs and data
Most programs (web browsers, compilers, word processors) are
stored on the disk until they are loaded into memory.
Instruction-execution cycle: fetch the instruction from memory,
decode instruction, execute instruction, store instruction back in
memory.
Operating System Concepts – 10th Edition 2.32 Silberschatz, Galvin and Gagne ©2018
Storage Definitions and Notation Review
The basic unit of computer storage is the bit. A bit can contain one of two values, 0 and 1. All
other storage in a computer is based on collections of bits. Given enough bits, it is amazing
how many things a computer can represent: numbers, letters, images, movies, sounds,
documents, and programs, to name a few.
A byte is 8 bits, and on most computers it is the smallest convenient chunk of storage. For
example, most computers don’t have an instruction to move a bit but do have one to move a
byte.
A less common term is word, which is a given computer architecture’s native unit of data. A
word is made up of one or more bytes. For example, a computer that has 64-bit registers
and 64-bit memory addressing typically has 64-bit (8-byte) words. A computer executes many
operations in its native word size rather than a byte at a time.
Computer storage, along with most computer throughput, is generally measured and
manipulated in bytes and collections of bytes.
A kilobyte, or KB, is 1,024 bytes
a megabyte, or MB, is 1,0242 bytes
a gigabyte, or GB, is 1,0243 bytes
a terabyte, or TB, is 1,0244 bytes
a petabyte, or PB, is 1,0245 bytes
Computer manufacturers often round off these numbers and say that a megabyte is 1 million
bytes and a gigabyte is 1 billion bytes.
Networking measurements are an exception to this general rule; they are given in bits
e.g. 1 Kbps (because networks move data a bit at a time).
Operating System Concepts – 10th Edition 2.33 Silberschatz, Galvin and Gagne ©2018
Metric Units
Operating System Concepts – 10th Edition 2.34 Silberschatz, Galvin and Gagne ©2018
Storage Hierarchy
Storage systems organized in hierarchy according to
Speed
Cost
Volatility
Operating System Concepts – 10th Edition 2.35 Silberschatz, Galvin and Gagne ©2018
Storage-Device Hierarchy
Operating System Concepts – 10th Edition 2.36 Silberschatz, Galvin and Gagne ©2018
Memory Protection
We must protect the OS from access by user
programs and protect user programs from one
another.
We must provide memory protection at least for
the interrupt vector and the interrupt service
routines of the operating system.
In order to have memory protection, add two
registers that determine the range of legal
addresses a program may access:
Base register – holds the smallest legal physical
memory address.
Limit register – contains the size of the range
Memory outside the defined range is protected.
Operating System Concepts – 10th Edition 2.37 Silberschatz, Galvin and Gagne ©2018
Use of A Base and Limit Registers
Kernel mode
(Supervisor mode,
System mode,
Privilaged mode,
Monitor mode)
User mode
Operating System Concepts – 10th Edition 2.38 Silberschatz, Galvin and Gagne ©2018
Hardware Address Protection
Operating System Concepts – 10th Edition 2.39 Silberschatz, Galvin and Gagne ©2018
Operating System Operations
Dual-mode operation allows OS to protect itself and other system
components
User mode and kernel mode (see next slide)
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 (I/O instructions, instruction to
modify the memory-management registers or the timers,
halt instructions).
System call changes mode to kernel, return from call resets
it to user mode
If an attempt is made to execute a privileged instruction in user
mode, the hardware does not execute the instruction but rather
treats it as illegal and traps it to the operating system.
Operating System Concepts – 10th Edition 2.40 Silberschatz, Galvin and Gagne ©2018
Operating System Operations(cont.)
Operating System Concepts – 10th Edition 2.41 Silberschatz, Galvin and Gagne ©2018
Common System Components
Resource Management
Process Management
Main Memory Management
File Management
Secondary Storage Management
I/O System Management
Networking
Protection System
Operating System Concepts – 10th Edition 2.42 Silberschatz, Galvin and Gagne ©2018
Process Management
A program can do nothing unless its instructions are executed by a CPU.
A process is a program in execution. It is a unit of work within the system.
Program is a passive entity (content of a file stored on the disk), process is
an active entity (with a program counter specifying the next instruction to
execute).
A process needs certain resources, including CPU time, memory, files, and
I/O devices, to accomplish its task (also needs input, instructions).
Single-threaded process has one program counter specifying location of
next instruction to execute (threads are covered later)
The execution of such a process must be sequential. The CPU executes
one instruction of the process after another, until the process completes..
Multi-threaded process has one program counter per thread (thread is a unit
of execution). A process is the unit of work in a system.
Typically system has many processes, some user (execute user code), some
operating system (execute system code), running concurrently on one or
more CPUs (see next slide)
Concurrency by multiplexing the CPUs among the processes/threads
Operating System Concepts – 10th Edition 2.43 Silberschatz, Galvin and Gagne ©2018
More on processes
A program such as a compiler is a process, and
a word-processing program being run by an
individual user on a PC is a process. Similarly, a
social media app on a mobile device is a
process.
For now, you can consider a process to be an
instance of a program in execution, but later
you will see that the concept is more general. It
is possible to provide system calls that allow
processes to create subprocesses to execute
concurrently (will be described later).
Operating System Concepts – 10th Edition 2.45 Silberschatz, Galvin and Gagne ©2018
Process Management Activities
The operating system is responsible for the following
activities in connection with process management:
Operating System Concepts – 10th Edition 2.46 Silberschatz, Galvin and Gagne ©2018
Main Memory Management
Main memory is central to the operation of a modern computer system
Main memory is a large array of words or bytes, each with its own address.
Memory is a repository of quickly accessible data shared by the CPU and I/O
devices.
To execute a program, all (or part) of the instructions must be in memory.
All (or part) of the data that is needed by the program must be in memory.
Main memory is a volatile storage device. It loses its contents in the case of
system failure.
Memory management determines what is in memory and where they are
located
Memory management activities:
Keeping track of which parts of memory are currently being used and by
whom (which process)
Deciding which processes (or parts of processes) and data to move into
and out of memory
Allocating and deallocating memory space as needed
Operating System Concepts – 10th Edition 2.47 Silberschatz, Galvin and Gagne ©2018
File-System Management
To make the computer system convenient for users, the operating system
provides a uniform, logical view of information storage. The operating system
abstracts from the physical properties of its storage devices to define a logical
storage unit, file.
A file is a collection of related information defined by its creator. Commonly,
files represent programs (both source and object forms) and data
Each medium is controlled by device (i.e., disk drive, tape drive) having
varying properties that 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 and how (read,
write, execute, append)
OS activities include
Creating and deleting files and directories
Primitives to manipulate (control) files and directories
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
Operating System Concepts – 10th Edition 2.48 Silberschatz, Galvin and Gagne ©2018
Secondary-Storage Management
Since main memory (primary storage) is volatile and too small to
accommodate all data and programs permanently, the computer
system must provide secondary storage to back up main memory.
Usually disks are used to store data and programs that does not
fit in main memory or data that must be kept for a “long” period of
time.
The operating system is responsible for the following activities in
connection with disk management:
Free space management
Storage allocation
Disk scheduling
Partitioning
Protection
Operating System Concepts – 10th Edition 2.49 Silberschatz, Galvin and Gagne ©2018
Characteristics of Various Types of Storage
Operating System Concepts – 10th Edition 2.50 Silberschatz, Galvin and Gagne ©2018
Cache Management
Important principle, performed at many levels in a computer (in
hardware, operating system, software)
Use of high-speed memory to hold recently-accessed data.
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
Requires a cache management policy, since caches have
limited memory size.
Caching introduces another level in storage hierarchy. This
requires data that is simultaneously stored in more than one
level to be consistent.
Ex: Value of a variable can be different in register and in the
various storage systems.
Operating System Concepts – 10th Edition 2.51 Silberschatz, Galvin and Gagne ©2018
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
Operating System Concepts – 10th Edition 2.52 Silberschatz, Galvin and Gagne ©2018
Migration of data “A” from Disk to Register
In a hierarchical storage structure, the same data may appear in
different levels of the storage system.
For example, suppose that an integer A that is to be incremented by
1 is located in file B, and file B resides on hard disk.
The increment operation proceeds by first issuing an I/O operation
to copy the disk block on which A resides to main memory.
This operation is followed by copying A to the cache and to an
internal register. Thus, the copy of A appears in several places: on
the hard disk, in main memory, in the cache, and in an internal
register (see figure in previous slide).
Once the increment takes place in the internal register, the value of
A differs in the various storage systems.
The value of A becomes the same only after the new value of A is
written from the internal register back to the hard disk.
Operating System Concepts – 10th Edition 2.53 Silberschatz, Galvin and Gagne ©2018
I/O System Management
One purpose of OS is to hide peculiarities (properties) of
hardware devices from the user.
Operating System Concepts – 10th Edition 2.54 Silberschatz, Galvin and Gagne ©2018
Networking (Distributed Systems)
A distributed system is a collection of processors that do not share memory
or a clock. Each processor has its own local memory and clock.
The processors in the system are connected through a communication
network.
Communication takes place using protocols.
A distributed system provides user access to various system resources.
Access to a shared resource allows:
Computation speed-up
Increased data availability
Enhanced(improved) reliability
Operating System Concepts – 10th Edition 2.55 Silberschatz, Galvin and Gagne ©2018
Protection and Security
If a computer system has multiple users and allows the concurrent execution
of multiple processes, then access to data must be regulated (controlled)
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
Protection and security require the system to be able to distinguish
(differentiate) among all its users. User identities (user Ids or security IDs)
include name and associated number are unique, one per user
Each 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/thread.
For example, the owner of a file on a UNIX system may be allowed to
issue all operations on that file, whereas a selected set of users may
be allowed only to read the file.
Privilege escalation allows user to change to effective ID with more
rights
Operating System Concepts – 10th Edition 2.56 Silberschatz, Galvin and Gagne ©2018