1
Operating
System CHAPTER 2
Overview
2
Operating System
A program that
controls the execution of application programs
acts as an interface between applications and
hardware
OS
masks the details of the hardware from the
programmer
provides the programmer with a convenient interface
for using the system
3
User/Computer Interface
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
Figure 2.1 Computer Hardware and Software Structure
4
User/Computer Interface (2)
Services Provided by the Operating System
Program development
Program execution
Access I/O devices
Controlled access to files
System access
Error detection and response
Accounting
5
Resource Manager
OS is responsible for controlling the use of a
computer’s resources
I/O
Main memory
Secondary memory
Processor execution time
Kernel
Portion of operating system that is in main memory
Contains most frequently used functions
6
Evolution of Operating Systems
Time
Sharing
Multiprogramme Systems
d Batch Systems
Simple
Batch
Serial Systems
Processing
7
Uniprogramming
Processor must wait for I/O instruction to complete
before preceding
Program A Run Wait Run Wait
Time
(a) Uniprogramming
Program A Run Wait Run Wait
Program B Wait Run Wait Run Wait
Run Run Run Run
Combined Wait Wait
A B A B
Time
(a) Uniprogramming
8
Multiprogramming
Program A Run Wait Run Wait
Program B Wait Run Wait Run Wait
Run Run Run Run
Combined Wait Wait
A B A B
When one job needs Timeto wait for I/O, the processor
can switch to the other job (multitasking)
(b) Multiprogramming with two programs
Program A Run Wait Run Wait
Program B Wait Run Wait Run Wait
Program C Wait Run Wait Run Wait
Run Run Run Run Run Run
Combined Wait Wait
A B C A B C
Time
(c) Multiprogramming with three programs
Figure 2.5 Multiprogramming Example
9
Time Sharing
Using multiprogramming to handle multiple
interactive jobs
Processor’s time is shared among multiple users
Multiple users simultaneously access the system
through terminals
Batch Multiprogramming Time Sharing
Principal objective Maximize processor use Minimize response time
Source of directives to Job control language Commands entered at the
operating system commands provided with the terminal
job
10
Major Achievements
Processes
memory management
information protection and security
scheduling and resource management
11
Modern Operating Systems
Microkernel architecture
Assigns only a few essential function to the kernel and
other OS services are provided by processes that run in
user mode
Multithreading
A technique in which a process, executing an
application, is divided into threads that can run
concurrently
12
Modern Operating Systems (2)
Symmetric multiprocessing (SMP)
OS must provide tools and functions to exploit the parallelism of
an SMP system
SMP Multicore Many-core
Distributed operating systems
Provides the illusion of a single main memory space and a single
secondary memory space, plus other unified access facilities,
such as a distributed file system
Object-oriented design
13
Windows Architecture
Service processes
System support Applications
processes
Service control
SVChost.exe Environment
manager
Task manager subsystems
Lsass Winmgmt.exe Windows
Winlogon Spooler Explorer POSIX
User
Session Services.exe application
manager Win32
Subsytem DLLs
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)
Lsass = local security authentication server Colored area indicates Executive
POSIX = portable operating system interface
GDI = graphics device interface
DLL = dynamic link libraries
Figure 2.14 Windows Architecture
14
UNIX Architecture
User Programs
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
Figure 2.16 Traditional UNIX Kernel
15
Modern UNIX Architecture
coff
a.out elf
exec
switch
NFS
file mappings
FFS
virtual
device memory vnode/vfs
mappings framework interface
s5fs
anonymous
RFS
mappings
Common
Facilities
disk driver time-sharing
block processes
device scheduler
switch framework
tape driver system
processes
STREAMS
network tty
driver driver
Figure 2.17 Modern UNIX Kernel [VAHA96]
16
Linux Kernel Components
user level
processes
signals system calls
processes
& scheduler
file network
systems protocols
virtual
kernel
memory
char device block device network de-
drivers drivers vice drivers
traps & physical
interrupts
faults memory
hardware
system network inter-
CPU terminal disk
memory face controller
Figure 2.19 Linux Kernel Components
17
Android System Architecture