Operating system concepts
Download
Report
Transcript Operating system concepts
Operating system concepts
Lin Zhong
ELEC424, Fall 2010
Outline
• What is operating system?
• Important OS concepts
• Embedded OS
2
What is OS?
• Different ways of computing implementation
Data Input
(1100101000)
Fully
customized
circuit
Program in high-level
language
Data Input
(1100101000)
Program in high-level
language
Output
(0101101010)
Programmable
circuit
(Processor)
Compilation
Program in high-level
language
Output
(0101101010)
Control Input
(1100101000)
Executable/binary
3
What is OS? (Contd.)
• A modern computer system
Data Input
(1100101000)
Precompiled
binaries
Output
(0101101010)
Programmable
circuit
(Processor)
Hard disk
Control Input
(1100101000)
BIOS
Basic I/O system to
jumpstart
4
What is OS?
• “Software that manages the sharing of the
resources of a computer”---Wikipedia
– Sharing by what?
• Independent executables (programs)
– What resources?
• Time-shared resources: CPU and network
• Space-shared resources: memory and disk
• Exhaustible: energy
5
OS concepts
•
•
•
•
•
•
Scheduling (Process management)
Memory management
File system
Networking
Device drivers
Power management
6
Scheduling
• Process
– Wiki: An instance (execution) of a computer
program that is being sequentially executed
• Wiki: a collection of instructions that describes a task,
or set of tasks, to be carried out by a computer
– Running program???
• Execution of a single control flow
be done
00000010 10000000 00000000 00000110
addcc %r1,-4,%r1
10000010 10000000 01111111 11111100
addcc %r1,%r2,%r4
10001000 10000000 01000000 00000010
ld %r4,%r5
11001010 00000001 00000000 00000000
ba loop
00010000 10111111 11111111 11111011
addcc %r3,%r5,%r3
10000110 10000000 11000000 00000101
7
Scheduling (Contd.)
Processes
Physical computer
OS creates the illusion that
every process can own the
whole computer
8
Scheduling (Contd.)
Time-sharing of CPU
Admission control
Mid-term scheduling
Who gets the CPU
Long-term scheduling
Memory loading
Ready
Run
Blocked
Short-term scheduling
Priority
Preemptive
Real-time
Process status
9
Thread vs. Process
Processes
OS creates the illusion that
every process can own the
whole computer
Physical computer
Process: execution of a single
control flow
Threads share the resources that is
designated to a single process
Process: execution of multiple
control flows that share the system
resource
10
Memory management
• Storage hierarchy
• Virtual memory
– Extend main memory beyond RAM
– Share memory space between
processes
– Organized in “pages”
• 64KB
• Page tables
• Translation lookaside buffer (TLB)
Registers
CPU
Cache
Main memory
(RAM)
Hard disk
11
Memory management & scheduling
Ready
Binary in main
memory
Run
Can get “swapped” out
to disk
Blocked
Process status
12
File system
• Organize the massive storage
– Directories
– Files
Registers
CPU
Cache
• Flash file system
– Block-wise erase
– Finite # of erase-write cycles (100K
times)
• Spread erase-write evenly (wear
levelling)
Main memory
File system cache
Hard disk
13
Networking
Application
Presentation
Application
IMAP, HTTP
Priority/Express/
Registration/Packages
Session
Transport
TCP, UDP
Zip code, street address
Transport
Network
IP
Find the best route
(Google map)
Network
Data link
CSMA
Traffic regulation
Data link
Physical
CDMA, TDMA
How to drive a mail truck
Physical
TCP/IP model
USPS analogy
OSI reference model
14
Device drivers
• Hardware abstraction
– Provide standard API for applications
• Share peripheral devices
• Even battery has a driver
15
No direct energy management
• Energy accounting
– How much energy has been consumed
• Battery energy model
– How much energy is left on battery
• System energy model
– How much energy is consumed by a component
or an activity
16
Power management
• Advanced Configuration and Power Interface (ACPI)
– Industrial standard
•7 global states
•G0-G3
•G1: S1-S4
•4 CPU states
•C0-C3
•Up to 16 Performance
states
•Pn
•4 device states
•D0-D3
P-States
Tian et al, 2007
17
Real-time operating system (RTOS)
• Guarantee meeting the hard deadlines
• Linux, Windows, Unix,…. are NOT RTOS
• Green Hills
– INTEGRITY
• Joint-strike fighter
• Eurofighter Typhoon
• Wind River
– VxWork 653 (Boeing 787)
• LynuxWorks
– LynxOS (Boeing 777 cabin service system)
• QNX
– Automotives
18
Smartphone Oses
2008
2007
Palm OS
OS X
Palm OS
Others
Others
Linux
Linux
OS X
Windows
Mobile
RIM
Windows
Mobile
Symbian
Symbian
RIM
Source: Gartner
19
2009
6.1
8.7
Symbian
Android
46.9
14.4
RIM
iOS
Windows
Others
19.9
3.9
2010
4.7
4.7
Symbian
15.4
40.1
Android
RIM
iOS
Windows
17.5
Others
17.7
Industrial profile
Services
Verizon, Sprint, AT&T etc.
Applications
Microsoft
Operating system
System
integration/manufacture
IC
Nokia
Apple
RIM
(Blackberry)
Samsung, LG,
HTC, Moto,…
Palm
TI, ARM, MIPS (Digital), Qualcom
Broadcom, Marvel (RF, Analog)
22
Symbian
• Owned by Nokia
• ARM processors only
• Target of multiple phone viruses
• Moving toward open-source
23
Embedded Linux
• Linux
– Initiated by Linus Torvalds (Swedish
Finnish) (but named after Linus
Pauling, an American)
•
•
•
•
Google Android
Palm WebOS
Meego (Nokia/Intel)
MontaVista Linux
– Most older Motorola Linux phones
• Trolltech Greenphone
24
OS for small embedded systems
• Often proprietary
– In-house simple OS-like firmware
• TinyOS is big for networked sensors
– Open source (http://www.tinyos.net/)
– Runs on microcontrollers like MSP430
25
New development
• All driven by more computing power
Intermediates
Intermediates
Run-time
Run-time
Executables
Executables
OS
OS1
OS2
Virtualization
OS1
OS2
Virtualization
Hardware
Hardware
Hardware
Executables
26