CS考试辅导 Operating Systems – CSCI 402

Operating Systems – CSCI 402
1960s OS Issues
Multiprogramming (i.e., running things “in parallel” with one CPU) Time sharing (i.e., support interactive users)
Software complexity
Security
18
321 0
Copyright ý . Systems – CSCI 402
2010s OS Issues
Multiprogramming (i.e., running things “in parallel” with one CPU)
not just one computer, but server farms
Time sharing (i.e., support interactive users)
voice, video, sound, etc.
Software complexity
a bigger problem than could be imagined in the 1960s
Security
ditto
19
321 0
Copyright ý . Systems – CSCI 402
1.2 A Brief History of Operating Systems
The 1950¡¯s: The Birth of the Concept The 1980¡¯s: The Modern OS Takes Form Minicomputers & Unix
The Personal Computer
20
321 0
Copyright ý . Systems – CSCI 402
Where Do Things Evolve From?
Linux & Unix
AT&T Multics Unix BSD
Minix
R.I.P.
Vista
Linux
Android
Microsoft
MS-DOS, Windows 3.x OS/2?
MS?
Lisa & Mac
Mach FreeBSD
Windows NT
R.I.P. OS X iOS
21
321 0
Copyright ý . Systems – CSCI 402
History of C
Early 1960s: CPL (Combined Programming Language)
developed at Cambridge University and University of London
1966: BCPL (Basic CPL): simplified CPL
intended for systems programming
1969: B: simplified BCPL (stripped down so its compiler would run on minicomputer)
used to implement earliest Unix
Early 1970s: C: expanded from B
motivation: they wanted to play “Space Travel” on minicomputer used to implement all subsequent Unix OSes
Unix has been written in C ever since
22
321 0
Copyright ý . Systems – CSCI 402
Extra Slides
23
321 0
Copyright ý . Systems – CSCI 402
In the Beginning …
There was hardware
processor storage card reader tape drive drum
And not much else
no operating system
no libraries
no compilers
very little software in the beginning
24
321 0
Copyright ý . Systems – CSCI 402
1.3 A Simple OS
OS Structure
Processes, Address Spaces, & Threads Managing Processes
Loading Program Into Processes
Files
1
321 0
Copyright ý . Systems – CSCI 402
A Simple OS
The main focus of this class is on how to build an OS
since this is an intro class, we will focus on the fundamentals
occasionally, we will talk about the more advanced topics
this is not a “tech” class
Sixth-Edition Unix
source license available to universities in 1975 from Bell Labs had major influence on modern O Linux MacOS X Windows
Fits into 64KB of momory
single executable, completely stored in a single file loaded into memory as the OS boots
monolithic OS
2
321 0
Copyright ý . use the word “kernel” to mean the portion of the OS that runs in privileged mode
sometimes, a subset of this
321 0
Operating Systems – CSCI 402
Hardware Support – User vs. Privileged Modes
Processor modes: part of the processor state (recall from your computer organization/architecture class regarding “processor”)
most computers have at least two modes of execution
user mode: fewest privileges privileged mode: most privileges
the only code that runs in this mode is part of the OS
For Sixth-Edition Unix
the whole OS run in the privileged mode
everything else is an application and run in the user mode
For other systems
major subsystems providing OS functionality may run in the user mode
3
Copyright ý . Simple OS Structure
Application programs call upon the OS via traps
External devices call upon the OS via interrupts I/O completion interrupt
executes interrupt service routine
Traps
OS
Interrupts
Operating Systems – CSCI 402
4
321 0
Copyright ý . Systems – CSCI 402
A Simple OS Structure
Review of “Computer Organization”
Read Bus Cycle
bus architecture
A[0..31] D[0..31] RD
Memory
Device Controller
Device Controller
&x data
x86 Processor
Bus
idx regs
EIP
ESP EBP …
seg regs CS
SS …
gen regs EAX EBX

other flags

A0-A31
D0-D31 RD WR LOCK INT
interrupt enabled
processor mode
32 32
5
321 0
Copyright ý . Systems – CSCI 402
A Simple OS Structure
Review of “Computer Organization”
Write Bus Cycle
bus architecture
A[0..31] D[0..31] WR
Memory
Device Controller
Device Controller
&y data
x86 Processor
Bus
idx regs
EIP
ESP EBP …
seg regs CS
SS …
gen regs EAX EBX

other flags

A0-A31
D0-D31 RD WR LOCK INT
interrupt enabled
processor mode
32 32
6
321 0
Copyright ý . Cheng