Title: EE110300 ???????? Lecture 3 ?????? II ---- Operating Systems ????? ??? ??
1EE110300 ????????Lecture 3 ?????? II ----
Operating Systems????? ??? ??
2What is an operating system?Definition
- An operating system is the permanent software
that controls/abstracts hardware - User applications can thus be simpler and
device-independent
User Applications
virtual machine interface
Operating System
physical machine interface
Architecture
3What is an operating system?Definition (cont)
- Manages resources and processes to support
different user applications - Provides Applications Programming Interface (API)
for user applications
User Application
User Application
Operating System
Architecture
4Modern operating systems
- x86 platform
- Linux
- Windows
- Mac platform Mac OS
- Sun Solaris Unix (Sun workstations)
- IBM AIX (mainframes)
- Embedded systems (special-purpose OS)
- Palm, PocketPC, etc
- Xbox, etc
5Linus Torvalds
- 1991, Finland, Linux Project
- 1992, Linux Kernel 0.02
- Bash v1.08
- GCC v1.40
- 1997, Moves to Transmeta
- 1998, Linux Kernel v2.2
- 2001, Linux Kernel v2.4
- Pronunciation Linn-ucks
6Windows 2000 XP
- 1989 10 developers left DEC VMS team and joined
Microsoft ? Windows NT 1.0 - 1996 Windows NT 4.0
- 1999 Windows 2000
- 2001 Windows XP
- 2002 Microsoft .Net Server
7Linux vs. Windows NT
- Linux is kernel only, free and open source
- Windows is full-loaded OS and pricy
- Linux requires minimum HW, Windows not
- Web server
- (Win2K SWC ) beats (Linux TUX)
- File server printer server
- Windows supports a wider range of HW
- Linux has more stable drivers
8Operating System Interfaces
9Software hardware layer
user
User Program
Executable Binary
compiler
Compiler
Linker
user mode
OS interface
System library
kernel
OS
Operating System
device drivers
Hardware
Architecture
10Device Driver
- Device driver????????????????.
- ????????????????????.
- ?????????????????????, ????????,?ISR???????????.
11System service call (monitor)
- C Programs
- main()
- // call printf, provided
- // by the C library, to
- // print on the screen
- printf(Hello World!)
Borland C library Int printf() // call
SysOutputString, // provided by NT // system
library, to // print on the screen SysOutputString
()
NT library Void SysOutputString() // call
NtOutputString, that in turn will call // video
card driver to output strings to // the
screen NtOutputString()
12System service call (disk)
- C Programs
- main()
- // call CreateFile
- // by the C library, to
- // create a file on disk
- CreateFile(a.txt)
Borland C library Int CreateFile() // call
NtCreateFile, // provided by NT to // create a
file NtCreateFile()
NT library Void NtCreateFile() // call
NtInternalCreateFile, that in turn will //
call the file system driver and the disk //
driver to create a file on a disk
NtInternalCreateFile()
13System service calls (network)
- C Programs
- main()
- so createsocket()
- send(so, text)
- close(so)
Borland C library int createsocket()
NtCreateSocket() int send()
NtSocketSend()
NT library Void NtCreateSocket()
NtAfdCreateSocket()
14(No Transcript)
15Virtual computer concept
Virtual C Computer
C compiler
LISP interpreter
Operating system
Operating System Command interpreter
FORTRAN compiler
Macroinstruction interpreter
Bare machine
C compiler
Assembler
Virtual C Computer
Java compiler
16Importance of operating system
- System API are the only interface between user
applications and hardware - API are designed for general-purpose, not
performance driven (e.g. network applications) - OS code cannot allow any bug
- Any break (e.g. invalid access) causes reboot
- The owner of OS technology controls the software
industry
17What is Embedded System?
- ????????????,???????????????????????,??????????.
- ?? PDA, ???, ??????, ????? ?.
18Embedded system architecture
- 3-layered device
- Palm, PocketPC
User Applications
Embedded OS
Application
Hardware
Hardware
19General-purpose embedded OS
General-purpose Embedded OS
Examples Linux, Windows WinCE, Palm OS
Hardware General-purpose Special device
OS code size Large Small
Stability req. Strong Weak
Develop. cost Huge Medium
20Operating system concepts
21Process Thread
- How do different applications run on the same
machine at the same time without interfering each
other? - Protection between processes
- Protection between a process and the OS
- Process an execution of a program, consisting of
a virtual address space, one or more threads, and
some OS states.
22Virtual memory (address space)
page 0
pp 0
page 1
pp 1
page 2
pp 2
x
pp N
paging file
pp 212
physical memory (16MB)
page 220
virtual address space (4GB)
23Virtual memory (address space)
page 0
pp 0
page 1
pp 1
page 2
pp 2
pp N
paging file
pp 212
physical memory (16MB)
page 220
virtual address space (4GB)
24Memory manager
pp 0
pp 1
pp 2
PT
process VA
pp N
paging file
pp 212
physical memory
PT
process VA
25Memory manager
pp 0
pp 1
pp 2
PT
process VA
pp N
paging file
pp 212
physical memory
PT
process VA
26Memory manager (w/ constraint)
pp 0
x
pp 1
pp 2
PT
process VA
memory manager
pp N
paging file
pp 212
physical memory
PT
process VA
27Protectiondual mode operation
- Can application modify its own page table? If it
could, could get access to all physical memory. - Dual Mode
- Kernel/protected model no restriction, can touch
any physical memory page - User mode where you program runs, can only touch
part of the virtual address space - Applications can enter the kernel mode through
systems calls (traps)
28Mode change system call trap
1. System call traps to the kernel (kernel
mode) 2. Kernel determines service routine
required 3. Kernel services the call. 4. Control
is returned to user program (user mode)
29Thread
- A process starts with one thread (main thread),
and can initialize more threads by CreateThread()
calls - A thread represents an execution stream of
instructions and its CPU register context - A thread is the unit used in the scheduler
- Kill a process ?? kill its all threads
30Scheduler
- A component in OS that decides which thread in
the thread pool gets the CPU - Priority-based scheduler
- Context switch
new thread
terminating threads
signal events
31Synchronization
- All threads in the same process share all global
data - Synchronization among these threads is necessary
to maintain data integrity - Resource lock is commonly used to guarantee
thread mutual exclusive - abuse of such locks decreases scalability
- ignorance of such locks decreases stability
- Deadlock issues
32File Systems
- A hard disk is just a raw media storage
- A hard disk device driver allows OS to
communicate with the hardware - But, it is the responsibility of the OS to
organize disk sectors/tracks for storing files - such component is called the file system
- E.g. A hard disk that stores NTFS information
cannot be read with the FAT32 driver - example paper with Moses code
33Operating Systems and System Software
Example web server software
34User-mode web server architecture
User Mode
I/O module
Kernel Mode
35User-mode web server commons
- User-mode application architecture
- e.g. Microsoft Internet Information Server (IIS),
Netscape Enterprise Server, Apache HTTP Server,
etc. - Dependent on generally system API
- Stand-alone web content cache limited by virtual
address space - Time-to-live cache replacement algorithm
- Memory-less dynamic code execution
36SWC web server architecture
User Mode
Kernel Mode
miss
System Cache
network card
37SPECWEB99 Performance
estimated scaling data
38Kernel vs. user-based web server
- Increase peak capacity by five times
- Web cache size be limited by physical memory size
- Web cache be shared by both static dynamic web
requests - Remove I/O overhead and Socket creation
- Fast TCPIP data transmission
39Summary
A.D. 1492 Columbus discovers America --- The new
and free land is on your grip!!