CH 02 - OS8e
CH 02 - OS8e
CH 02 - OS8e
Systems:
Internals Chapter 2
and Design
Principles Operating System
Overview
Eighth Edition
By William Stallings
Operating System
A program that controls the execution of
application programs
An interface between applications and hardware
Main objectives of an OS:
• convenience
• efficiency
• ability to evolve
Application programs
Application
programming interface
Application Libraries/utilities Software
binary interface
Operating system
Instruction Set
Architecture
Execution hardware
Memory
System interconnect
translation Hardware
(bus)
I/O devices
Main
and
memory
networking
Program development
Program execution
Access I/O devices
Controlled access to files
System access
Error detection and response
Accounting
Key Interfaces
Programs
and Data
I/O Controller
Processor Processor
Storage
OS
Programs
Data
new services
Fixes
Evolution of
Operating Systems
Stages include:
Time
Sharing
Multiprogrammed Systems
Batch Systems
Simple Batch
Systems
Serial
Processing
Serial Processing
Earliest Computers: Problems:
Scheduling:
No operating system
most installations used a
programmers interacted
hardcopy sign-up sheet to
directly with the computer
reserve computer time
hardware
time allocations could
Computers ran from a console run short or long,
with display lights, toggle resulting in wasted
switches, some form of input computer time
device, and a printer
Setup time
Users have access to the
computer in “series” a considerable amount of
time was spent just on setting
up the program to run
Simple Batch Systems
Monitor
user no longer has direct access to processor
job is submitted to computer operator who batches
them together and places them on an input device
program branches back to the monitor when finished
Monitor Point of View
Interrupt
Processing
always in memory
Monitor reads in job and gives User
Program
control Area
• while the user program is executing, it must not alter the memory area
containing the monitor
Timer
Privileged instructions
Interrupts
Time
(a) Uniprogramming
Multiprogramming
Time
(a) Uniprogramming
Multiprogramming
Combined Wait Wait
A B A B
Time
(b) Multiprogramming with two programs
Multiprogramming
Figure 2.5 Multiprogramming Example
also known as multitasking
memory is expanded to hold three, four, or more programs
and switch among all of them
Multiprogramming
Example
CPU CPU
0% 0%
100% 100%
Memory Memory
0% 0%
100% 100%
Disk Disk
0% 0%
100% 100%
Terminal Terminal
0% 0%
100% 100%
Printer Printer
0% 0%
0 5 10 15
time
minutes
time
(a) Uniprogramming (b) Multiprogramming
0 0 0
Monitor Monitor Monitor
5000 5000 5000
JOB 4
JOB 1
15000 JOB 2
(JOB 1)
20000 20000
(JOB 2) (JOB 2)
25000 25000 25000
Free Free Free
32000 32000 32000
(d) (e) (f)
a program in execution
an instance of a running program
the entity that can be assigned to, and executed on, a processor
time sharing
• be responsive to the individual user but be able to support many users
simultaneously
Process
PC
i
Process Base b
list Limit h
j
Management Other
registers
Context
Process
The entire state of the A
Data
Program
process at any instant is (code)
contained in its context
b
New features can be Process
Context
Data
designed and incorporated B h
Program
into the OS by expanding (code)
the context to include any
new information needed to
support the feature
Figure 2.8 Typical Process Implementation
Memory Management
The
OS has five principal storage
management responsibilities:
automatic
support of protection
process allocation long-term
modular and access
isolation and storage
programming control
management
Virtual Memory
A facility that allows programs to address
memory from a logical point of view, without
regard to the amount of main memory
physically available
Conceived to meet the requirement of having
multiple user jobs reside in main memory
concurrently
Paging
Allows processes to be comprised of a number of fixed-
size blocks, called pages
Program references a word by means of a virtual address
consists of a page number and an offset within the page
each page may be located anywhere in main memory
User
program
A
B.5 B.6
Disk
Address
Secondary
Memory
Pass Control
to Process
• microkernel architecture
• multithreading
• symmetric multiprocessing
• distributed operating systems
• object-oriented design
Microkernel Architecture
Assigns only a few essential functions to the
kernel:
interprocess
address basic
communication
spaces scheduling
(IPC)
The approach:
is well suited to a
simplifies provides
distributed
implementation flexibility
environment
Multithreading
Technique in which a process, executing an application, is
divided into threads that can run concurrently
Thread
• dispatchable unit of work
• includes a processor context and its own data area to enable
subroutine branching
• executes sequentially and is interruptible
Process
• a collection of one or more threads and associated system resources
• programmer has greater control over the modularity of the application
and the timing of application related events
Symmetric
Multiprocessing (SMP)
Term that refers to a computer hardware architecture and also
to the OS behavior that exploits that architecture
Process 1
Process 2
Process 3
Process 1
Process 2
Process 3
Blocked Running
Ntdll.dll
System
threads User mode
Kernel mode
System service dispatcher
(Kernel-mode callable interfaces)
Win32 USER,
I/O manager GDI
manager (registry)
Security reference
File system cache
Local procedure
Object manager
Virtual memory
Power manager
Configuration
Processes and
Plug and play
manager
monitor
threads
call
Device
and file Graphics
system drivers
drivers
Kernel
Hardware abstraction layer (HAL)
Kernel
controls execution of the processors
Device Drivers
dynamic libraries that extend the functionality of the Executive
server processes may use multiple threads to process requests from more
than one client simultaneously
PDP-11was a milestone because it first showed that UNIX would be an OS for all
computers
First widely available version outside Bell Labs was Version 6 in 1976
Most important of the non-AT&T systems was UNIX BSD (Berkeley Software
Distribution)
UNIX Commands
and Libraries
System Call
Interface
Kernel
Hardware
User-written
Applications
Trap
Libraries
User Level
Kernel Level
System Call Interface
Inter-process
communication
File Subsystem
Process
Control Scheduler
Subsystem
Memory
Buffer Cache
management
character block
Device Drivers
Hardware Control
Kernel Level
Hardware Level
Hardware
exec
switch
NFS
file mappings
FFS
virtual
device memory vnode/vfs
mappings framework interface
s5fs
anonymous
RFS
mappings
Common
Facilities
network tty
driver driver
4.xBSD is widely used in academic installations and has served as the basis of a number of
commercial UNIX products
FreeBSD
one of the most widely used and best documented versions
popular for Internet-based servers and firewalls
used in a number of embedded systems
Mac OS X is based on FreeBSD 5.0 and the Mach 3.0 microkernel
Solaris 10
Sun’s SVR4-based UNIX release
value value
*name *name
processes
& scheduler
file network
systems protocols
virtual
kernel
memory
char device block device network de-
drivers drivers vice drivers
hardware
system network inter-
CPU terminal disk
memory face controller
Key components:
Called from the application framework and applications through a Java interface
Use Views to form graphical user interfaces that display information and
respond to user actions
Power Management
Alarms Wakelocks
Implemented in the Linux kernel Prevents an Android system from
and is visible to the app developer entering into sleep mode
through the AlarmManager in the
RunTime core libraries These locks are requested through
the API whenever an application
Is implemented in the kernel so requires one of the managed
that an alarm can trigger even if peripherals to remain powered on
the system is in sleep mode
this allows the system to go
An application can hold one of
into sleep mode, saving the following wakelocks:
power, even though there is Full_Wake_Lock
a process that requires a Partial_Wake_Lock
wake up
Screen_Dim_Wake_Lock
Screen_Bright_Wake_Lock
Summary
OS design considerations for
Operating system objectives and multiprocessor and multicore
functions Microsoft Windows overview
User/computer interface
Traditional Unix systems
Resource manager
History/description
Evolution of operating systems Modern Unix systems
Serial processing System V Release 4 (SVR4)
Simple/multiprogrammed/time- BSD
sharing batch systems Solaris 10
Major achievements Linux
Developments leading to modern History
operating systems Modular structure
Fault tolerance Kernel components
Fundamental concepts Android
Faults Software/system architecture
OS mechanisms Activities
Power management