Date post: | 12-Jul-2015 |
Category: |
Education |
Upload: | peter-troeger |
View: | 143 times |
Download: | 1 times |
Operating Systems I PT / FF 14
Computer Systems Today
�2
UsersApplication Programs
System Programs Operating System
FirmwareHardware
Cont
rol e
xecu
tion
of p
rogr
ams
Abst
ract
from
ha
rdw
are
Operating Systems I PT / FF 14
Classes of Operating Systems• Desktop / Server Operating Systems
• Distributed Operating Systems
• Implements a single operating system instance spanning multiple machines
• Applications have single memory space view
• No significant real-world adoption, mainly research topic
• Real-Time Operating System (RTOS)
• Deterministic timing behavior of operating system services
• Support for real-time application scheduling and resource management
• Wide adoption for industry applications
• Examples: LynxOS, OSE, QNX, RTLinux, VxWorks
• Embedded Operating System�3
Operating Systems I PT / FF 14
Main Concepts• Processes
• Process table, core image, fork, command interpreter, shell, child processes, scheduling, signals, user authorization, group identification, process tree, ...
• Memory
• Swapping, paging, segmentation, virtual address, security, device access, ...
• I/O
• Files, directories, root directory, working directory, path, protection, rwx bits, file descriptor, handle, special files, I/O devices, block I/O, character I/O, standard input/output/error, pipes, mailslots, sockets, ...
• ... all abstracting hardware concepts to some extend�4
Main Concepts:Main Concepts: pprorocecessessess
ProProccesseessess, process table, core image, process table, core imageCommand interpreter, shellCommand interpreter, shellChild processesChild processes
A
B C
41
Scheduling, signalsScheduling, signalsUser identification, group identificationUser identification, group identification
ready running
blocked
finishednew
B C
FED
Process tree
Main Concepts:Main Concepts: pprorocecessessess
ProProccesseessess, process table, core image, process table, core imageCommand interpreter, shellCommand interpreter, shellChild processesChild processes
A
B C
41
Scheduling, signalsScheduling, signalsUser identification, group identificationUser identification, group identification
ready running
blocked
finishednew
B C
FED
Process tree
Main Concepts:Main Concepts: FilesFiles
Files, directories, rootFiles, directories, rootPath, working directoryPath, working directoryProtection, rwx bitsProtection, rwx bitsFile descriptor, handleFile descriptor, handle
Root directory
tmp usretc
42
File descriptor, handleFile descriptor, handleSpecial files, I/O devicesSpecial files, I/O devicesBlock I/O, character I/OBlock I/O, character I/OStandard input/output/errorStandard input/output/errorpipespipes
pitmia
Operating Systems I PT / FF 14
Hardware Basics
• Central Processing Units (CPUs) + volatile memory + I/O devices
• Fetch instruction and execute it - typically memory access, computation, and / or I/O
�6
(C) Stallings
• I/O devices and memory controller may interrupt the instruction processing
• Improve processor utilization by asynchronous operations
Operating Systems I PT / FF 14
Hardware Basics• Symmetric Multi-Processing (SMP)
• Two or more processors in one system, can perform the same operations (symmetric)
• Processors share the same main memory and all devices
• Increased performance and scalability for multi-tasking
• No master, any processor can cause another to reschedule
• Multi-Core / many-core processor combines computational cores on one chip with shared caches
• Challenges for an SMP operating system:
• Reentrant kernel, scheduling policies, synchronization, memory re-use, ...�7
(C) Stallings
Operating Systems I PT / FF 14
Hardware Basics
• Hyperthreading
• Make a single processor appear to be two virtual processors by maintaining separate CPU states, while execution engine and caches are still shared
• Also called Simultaneous multithreading (SMT)
• Operating systems must consider them separately in scheduling (in Windows since XP)
�9
(C) Intel
Operating Systems I PT / FF 14
Hardware Basics
• Parallelism
• Inside the processor (instruction-level parallelism, multicore)
• Through multiple processors in one machine (multiprocessing)
• Through multiple machines (multicomputer)
�10
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
"#$%&'()!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
*)#+(,,#)!"-.%!
!
!
!
!
!
"#$%&'/'.#0/1!
203.0(!
4/,5!
4/,5!
4/,5!
4/,5!
!"#$%
&"'"(()(*#+%
,-#.'/0.*1-%
2.')"+%
6#3.+/1!!
*)#+(,,#)!
6#3.+/1!
*)#+(,,#)!
"-.%!7&1'.84-)(/9.03!:"74;!
<=$$(').+!7&1'.8*)#+(,,.03!:<7*;!
7&1'.+#$%&'()!
!
!
!
!
!
"#$%&'/'.#0/1!
203.0(!
6#3.+/1!
*)#+(,,#)!
6#3.+/1!
*)#+(,,#)!
*)#+(,,#)!"-.%!
>>>!
>>>!
"#$%&'()!
"-.%!7&1'.8*)#+(,,.03!:"7*;!
>>>!
<.$&1'/0(#&,!
7&1'.84-)(/9.03!
:<74;!
?0,')&+'.#086(@(1!
%/)/11(1.,$!:?6*;!
A/'/!
A/'/!
A/'/!
A/'/!
3"."%
&"'"(()(*#+%
%
%
Figure 1: Hardware parallelism hierarchy
3
Operating Systems I PT / FF 14
Hardware Basics
�11
Intel Core i7SPARC64™ VIIIfx All Rights Reserved,Copyright© FUJITSU LIMITED 200912
SPARC64™ VIIIfx Chip Overview• Architecture Features
• 8 cores• Shared 5 MB L2$• Embedded Memory Controller• 2 GHz
• Fujitsu 45nm CMOS• 22.7mm x 22.6mm• 760M transistors• 1271 signal pins
• Performance (peak)• 128GFlops• 64GB/s memory throughput
• Power• 58W (TYP, 30Ԩ)• Water Cooling – Low leakage
power and High reliability
Core5
Core4
Core1
Core0
Core7
Core6
Core3
Core2
DD
R3
inte
rfac
e
DD
R3
inte
rfac
e
L2$ Data
L2$ Data
HSIO
L2$ ControlMACMAC
MACMAC
SPARC64 VIIIfx
Operating Systems I PT / FF 14
Hardware Basics
• NUMA (non uniform memory architecture) systems
• Groups of physical processors (called “nodes”) that have local memory
• Connected to the larger system through a cache-coherent interconnect bus
• Still an SMP system (e.g. any processor can access all of memory),but node-local memory is faster
• Operating system tries to schedule close activities on the same node
• Became the default model in all recent architectures
�12
Processor A Processor B
Cache Cache
Memory
Processor C Processor D
Cache Cache
MemoryHigh-Speed Interconnect
Operating Systems I PT / FF 14
Hardware Basics
�13
Core Core
Core Core
Q P I
Core Core
Core Core
Q P I
Core Core
Core Core
Q P I
Core Core
Core Core
Q P I L3
Cac
heL3
Cac
he
L3 C
ache
Mem
ory
Cont
rolle
r
Mem
ory
Cont
rolle
rM
emor
y Co
ntro
ller
L3 C
ache
Mem
ory
Cont
rolle
r
I/O I/O
I/OI/O
Mem
ory
Mem
ory
Mem
ory
Mem
ory
Intel Nehalem
Operating Systems I PT / FF 14
Hardware Basics
• Major constraints in memory as a resource are amount, speed, and costs
• Faster access time results in greater costs per bit
• Greater capacity results in smaller costs per bit
• Greater capacity results in slower access
• Idea: Going down a memory hierarchy
• Decreasing costs per bit
• Increasing capacity for fixed costs
• Increasing access time
�14
http
://tjli
u.m
yweb
.hine
t.net
/
Operating Systems I PT / FF 14
(C) Stallings
Hardware Basics
• Principle of Locality
• Memory referenced by a processor (program and data) tends to cluster
• Iterative loops and subroutines, small set of instructions inside
• Operations on tables and arrays involve access to clustered data sets
• Data should be organized so that the percentage of accesses to lower levels is substantially less than to the level above
• Typically implemented by caching concept
• I/O devices provide non-volatile memoryon lower levels, which is an additional advantage
�15
Operating Systems I PT / FF 14
Hardware Basics
• Caching
• Offer a portion of lower level memory as copy in the faster smaller memory
• Leverages the principle of locality
• Processor caches work in hardware, but must be considered by an operating system
�16
(C) Stallings
Operating Systems I PT / FF 14
Hardware Basics
• Conflicting caching design goals
• Cache size per level
• Number of cache levels
• Block size exchanged withlower level memory
• Replacement algorithm
• Mapping function
• Write policy for modified cache lines
• All decisions made by hardwarevendor, considerable by software
�17
(C) Stallings
Operating Systems I PT / FF 14
Hardware Basics
• All computers have mechanisms to let I/O and memory modules interrupt the current processor work
• Consider the speed aspect of I/O devices in the memory hierarchy
• Different classes of interrupt
• Program interrupt: Condition from program execution leads to exceptional situation, such as arithmetic overflow, division by zero, illegal instruction
• Timer interrupt: Programmed hardware time signals the time event,e.g. for regular operating system activities
• I/O interrupt: Generated by any kind of hardware unit to signal I/O completion or an error condition
• Hardware failure interrupt: Hardware module signals permanent issue
�18
Operating Systems I PT / FF 14
Hardware Basics
�19
• I/O program prepares an I/O operation, waits for finalization and prepares the result for further processing
• Usage of interrupts reduces the application I/O wait time to the pre- and post phases of I/O processing
• Interrupt can occur at any point in the execution of the user program, must be managed by the operating system
Operating Systems I PT / FF 14
Hardware Basics
• Summary
• Modern operating systems have to deal with many execution units (cores) and processors (SMP) in the same box
• Memory is organized in a deep hierarchy
• Differences in speed and amount at the order of magnitudes
• Devices and other sources can interrupt the current processing at any point
• All of this is permanently changing
• New processors, memory technology, hardware devices, ...
• Operating system must allow applications to use old and new hardware
• Example: Windows Vista supports approx. 4200 printers out of the box
�21