Course Introduction and OS Overview
CS 321 2007 Lecture, Dr. Lawlor
Why should you care about the OS?
Your Application does NOT want to Deal with the Complexity of "Real Life"
- Funky hardware:
- Just the basic CPU is complicated:
- Got RAM? Somebody needs to write code to set it up for access.
- Got SSE? Then you need to initialize it, and save and restore the SSE registers.
- Got two CPUs? They need to coordinate--figure out who's who, and who's going to do each step.
- Talk to displays, mice, disks, printers, USB keydrives, sound
cards, TV cards, ethernet cards, wireless cards, radio reception
hardware, fan speed controllers, noise generation hardware, terminal
concentrators, and REALLY weird stuff. Sadly, almost every one of these talks to the CPU in a slightly different manner!
- The OS's main job is to hide the madness of hardware behind
uniform interfaces. The madness is encapsulated in a "hardware
driver".
- For example, here's the list of different printers the UNIX
print rasterizer GhostScript talks to (with "gs -help"):
alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 ap3250 appledmp atx23
atx24 atx38 bbox bff bit bitcmyk bitrgb bj10e bj10v bj10vh bj200 bjc600
bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m bmp256
bmp32b bmpa16 bmpa16m bmpa256 bmpa32b bmpamono bmpasep1 bmpasep8 bmpgray
bmpmono bmpsep1 bmpsep8 ccr cdeskjet cdj1600 cdj500 cdj550 cdj670 cdj850
cdj880 cdj890 cdj970 cdjcolor cdjmono cfax cgm24 cgm8 cgmmono chp2200 cif
cljet5 cljet5c cljet5pr coslw2p coslwxl cp50 cups declj250 deskjet
dfaxhigh dfaxlow dj505j djet500 djet500c djet820c dl2100 dmprt dnj650c
epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 eps9high
eps9mid epson epsonc epswrite escp escpage escpc faxg3 faxg32d faxg4
fmlbp fmpr fs600 hl1240 hl1250 hl7x0 hpdj hpdj1120c hpdj310 hpdj320
hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c
hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c
hpdj870c hpdj890c hpdjplus hpdjportable ibmpro ijs imagen inferno iwhi
iwlo iwlq jetp3852 jj100 jpeg jpeggray la50 la70 la75 la75plus laserjet
lbp310 lbp320 lbp8 lex2050 lex3200 lex5700 lex7000 lips2p lips3 lips4
lips4v lj250 lj3100sw lj4dith lj4dithp lj5gray lj5mono ljet2p ljet3
ljet3d ljet4 ljet4d ljet4pjl ljetplus ln03 lp1800 lp1900 lp2000 lp2200
lp2400 lp2500 lp2563 lp3000c lp7500 lp7700 lp7900 lp8000 lp8000c lp8100
lp8200c lp8300c lp8300f lp8400f lp8500c lp8600 lp8600f lp8700 lp8800c
lp8900 lp9000b lp9000c lp9100 lp9300 lp9400 lp9500c lp9600 lp9600s lq850
lxm3200 lxm5700m m8510 mag16 mag256 md1xMono md2k md50Eco md50Mono md5k
mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24 mj500c mj6000c
mj700v2c mj8000c ml600 necp6 npdl nullpage oce9050 oki182 oki4w okiibm
omni paintjet pbm pbmraw pcl3 pcx16 pcx24b pcx256 pcx2up pcxcmyk pcxgray
pcxmono pdfwrite pgm pgmraw pgnm pgnmraw photoex picty180 pj pjetxl pjxl
pjxl300 pkm pkmraw pksm pksmraw plan9bm png16 png16m png256 pnga pngalpha
pnggray pngmono pnm pnmraw ppm ppmraw pr1000 pr1000_4 pr150 pr201 psgray
psmono psrgb pswrite pxlcolor pxlmono r4081 rpdl samsunggdi sgirgb sj48
st800 stcolor stp sunhmono t4693d2 t4693d4 t4693d8 tek4696 tiff12nc
tiff24nc tiffcrle tiffg3 tiffg32d tiffg4 tifflzw tiffpack uniprint x11
x11alpha x11cmyk x11cmyk2 x11cmyk4 x11cmyk8 x11gray2 x11gray4 x11mono
x11rg16x x11rg32x xes
- Fault tolerance--lots of hardware can just vanish, but the machine should still keep running
- For example, consider networking: there are 50+ kinds of network card. Any decent OS will talk to any of them.
- Here's a list of the different network devices Linux supports ("ls /usr/src/linux/drivers/net/"):
3c501.c
declance.c
lasi_82596.c sgiseeq.h
3c501.h
defxx.c
LICENSE.SRC sha1.c
3c503.c
defxx.h
lne390.c
sha1.h
3c503.h
depca.c
loopback.c
shaper.c
3c505.c
depca.h
lp486e.c
sis190.c
3c505.h
dgrs_asstruct.h
mac8390.c
sis900.c
3c507.c
dgrs_bcomm.h
mac89x0.c
sis900.h
3c509.c
dgrs.c
mace.c
sk98lin
3c515.c
dgrs_es4h.h
mace.h
skfp
3c523.c
dgrs_ether.h
macmace.c
sk_g16.c
3c523.h
dgrs_firmware.c
macsonic.c
sk_g16.h
3c527.c
dgrs.h
Makefile
sk_mca.c
3c527.h
dgrs_i82596.h
meth.c
sk_mca.h
3c59x.c
dgrs_plx9060.h
meth.h
slhc.c
7990.c
dl2k.c
mii.c
slip.c
7990.h
dl2k.h
mvme147.c
slip.h
8139cp.c
dummy.c
myri_code.h
smc9194.c
8139too.c
e1000
myri_sbus.c
smc9194.h
82596.c
e100.c
myri_sbus.h
smc-mca.c
8390.c
e2100.c
natsemi.c
smc-mca.h
8390.h
eepro100.c
ne2.c
smc-ultra32.c
a2065.c
eepro.c
ne2k_cbus.c
smc-ultra.c
a2065.h
eexpress.c
ne2k_cbus.h
sonic.c
ac3200.c
eexpress.h
ne2k-pci.c
sonic.h
acenic.c
epic100.c
ne3210.c
Space.c
acenic_firmware.h
eql.c
ne.c
starfire.c
acenic.h
es3210.c
netconsole.c
starfire_firmware.pl
amd8111e.c
eth16i.c
net_init.c
stnic.c
amd8111e.h
ethertap.c
ni5010.c
sun3_82586.c
apne.c
ethtool.c
ni5010.h
sun3_82586.h
appletalk
ewrk3.c
ni52.c
sun3lance.c
arcfour.c
ewrk3.h
ni52.h
sunbmac.c
arcfour.h
fc
ni65.c
sunbmac.h
arcnet
fealnx.c
ni65.h
sundance.c
ariadne.c
fec.c
ns83820.c
sungem.c
ariadne.h
fec.h
oaknet.c
sungem.h
arm
fmv18x.c
pci-skeleton.c sungem_phy.c
at1700.c
forcedeth.c
pcmcia
sungem_phy.h
atari_bionet.c
gt96100eth.c
pcnet32.c
sunhme.c
atarilance.c
gt96100eth.h
plip.c
sunhme.h
atari_pamsnet.c
hamachi.c
ppp_async.c
sunlance.c
atp.c
hamradio
ppp_deflate.c sunqe.c
atp.h
hp100.c
ppp_generic.c sunqe.h
au1000_eth.c
hp100.h
ppp_mppe_compress.c tc35815.c
au1000_eth.h
hp.c
pppoe.c
tg3.c
auto_irq.c
hplance.c
pppox.c
tg3.h
b44.c
hplance.h
ppp_synctty.c tlan.c
b44.h
hp-plus.c
r8169.c
tlan.h
bagetlance.c
hydra.c
rcif.h
tokenring
bcm
hydra.h
rclanmtl.c
tulip
bcm44
ibmlana.c
rclanmtl.h
tun.c
bmac.c
ibmlana.h
rcpci45.c
typhoon.c
bmac.h
ibmveth.c
rrunner.c
typhoon-firmware.h
bnx2.c
ibmveth.h
rrunner.h
typhoon.h
bnx2_fw.h
ioc3-eth.c
s2io.c
via-rhine.c
bnx2.h
irda
s2io.h
wan
bonding
isa-skeleton.c
s2io-regs.h wd.c
bsd_comp.c
iseries_veth.c
saa9730.c
wireless
cs89x0.c
iseries_veth.h
saa9730.h
xpnet.c
cs89x0.h
ixgb
sb1000.c
yellowfin.c
de600.c
jazzsonic.c
sb1250-mac.c znet.c
de600.h
kcompat.h
seeq8005.c
zorro8390.c
de620.c
Kconfig seeq8005.h
de620.h
lance.c sgiseeq.c
- Networks are more than TCP over Ethernet. They can be PPPoe, ATM, NetBEUI, AppleTalk, etc. Each of these sends and receives a different set of bytes on the network.
- Hardware usually provides the bare minimum possible to get the
job done. For example, disks and memory just store one long
string of bytes. Applications want to store files. The OS
bridges this gap (with the filesystem).
- The bottom line: the world is complicated. The OS's main
job is to hide enough of that complexity that applications can actually
get work done!
The OS is what gets your computer out of bed in the morning
- Boot sequence (PC BIOS)
- POST: the Power-On Self Test. "Sanity check"
- Figure out what kind of hardware you've got
- Figure out how to talk to it
- Set up the hardware to actually get work done
- Find a disk & start the "real" operating system; repeat steps 2 - 4 (possibly repeatedly!)
The OS can make your life a lot easier!
We'll be covering a bunch of techniques that can use the OS for weird and crazy stuff to make programs faster or simpler:
- Hardware interfacing
- Diverse hardware, uniform interface (that's the idea, at least...)
- Memory interfacing
- Virtual memory paging
- Cache control
- Direct hardware access
- Concurrency
- Processes
- Signals
- Events
- Kernel threads
- User-level threads
The OS can make your life miserable!
If your code isn't at least somewhat aware of how the OS works, the OS can interfere with your program:
- Timeslicing for multiprogramming can screw up your program's timing
- Paging for virtual memory can bring the machine to a standstill
- Hardware protection can keep your program from getting at the hardware it needs