CSE 513 I ntroduction to Operating Systems Class 1 - History and I ntro to OS- related Hardware and Sof tware Jonathan Walpole Dept. of Comp. Sci. and Eng. Oregon Health and Science University
About the I nstructor & TA � I nstructor - Jonathan Walpole � P h.D. Comp. Science. – Lancast er Uni., UK, 1987 � P rof essor and Direct or of Syst ems Sof t ware Lab – OGI (1998 -) � Research I nt erest s: Operat ing Syst em Design, Dist ribut ed Comput ing Syst ems, Mult imedia Comput ing and Net working � TA - Chris Chambers � P h.D. St udent - Syst ems Sof t ware Lab, (2002-) � Research I nt erest s: Dist ribut ed Games
About CSE 513 � Goals of the class � core class primarily f or non-syst ems st udent s � may be your f irst and last exposure t o OS � underst and t he basic concept s � gain some pract ical experience � Expectations � reading assignment s should be read bef ore class � act ive part icipat ion in class discussions � no cheat ing � be nice t o t he inst ruct or and TA ;-)
Grading � Exams � Mid-t erm - 20% � Final - 30% � Coursework � proj ect - 30% � Participation � in-class discussions - 20%
Books Moder n Oper at ing Syst ems Under st anding t he Linux Ker nel A. Tannenbaum Daniel Bovet & Mar co Cesat i 2 nd Edit ion 2 nd Edit ion
The Project � We will be using Linux on real systems … ugh!! � The computer labs are equipped with Linux that can be downloaded f resh when you turn them on +) You will be modif ying a real O. S. +) I t’s the real deal! - ) More complicated than emulated systems - ) Mistakes you make can cause catastrophic f ailure � the blue screen of death will look f riendly � TA � Chris Chambers will be t he primary cont act f or t he proj ect
Administrative � Course web site � ht t p:/ / www.cse.ogi.edu/ class/ cse513/ � Assignment 0 � mail me a brief descript ion of who you are, and a pict ure of yourself … so I know who t o assign credit t o f or your in-class discussion! � Assignment 1 � due next week! See class web sit e f or proj ect assignment s.
Lecture 1 - I ntroduction
Lecture overview � What is an Operating System? � A review of OS- related hardware � History of operating systems � Types of operating systems
What is an operating system? � Operating system - - “is a program that controls the execution of application programs and acts as an interf ace between the user of a computer and the computer hardware” � Narrow view • Traditional computer with applications running on it (e. g. PCs, Workstations, Servers) � Broad view • Anything that needs to manage resources (e. g. router OS, embedded devices, pagers, . . . )
Two Key OS Functions Abstract Machine � � Hide det ails of t he under lying har dwar e � Pr ovide “common” API t o applicat ions and ser vices � Simplif ies applicat ion wr it ing Resource Manager � � Cont r ols accesses t o “shar ed” r esour ces • CPU, memory, disks, network, . . . � Allows f or “global” policies t o be implement ed
Why is Abstraction I mportant? Without OSs and abstract interf aces a pplication writers � program all device access directly � load device command codes int o device r egist er s � handle init ializat ion, recalibrat ion, sensing, t iming et c f or physical devices � under st and physical char act er ist ics and layout � cont r ol mot or s � int er pr et r et ur n codes … et c � Applications suf f er severe code bloat! � ver y complicat ed maint enance and upgr ading � wr it ing t his code once, and shar ing it , is how OS began!
Providing Abstraction via System Calls Application Operating System Memory CPU Network Video Card Hardware Disk Monitor Printer
Providing Abstraction via System Calls Application System Calls: read(), open(), write(), mkdir(), kill() ... Operating System Process Mgmt Device Mgmt File System Network Comm. Security Protection Memory CPU Network Video Card Hardware Disk Monitor Printer
OS as a Resource Manager � Sharing resources among applications across space and time � scheduling � allocat ion � Making ef f icient use of limited resources � improving ut ilizat ion � minimizing overhead � improving t hroughput / good put � Protecting applications f rom each other � enf orcement of boundaries
Problems an OS Must Solve � Time sharing the CPU among applications � Space sharing the memory among applications � Space sharing the disk among users � Time sharing access to the disk � Time sharing access to the network
More Problems an OS Must Solve � Protection � of applicat ions f rom each ot her � of user dat a f rom ot her users � of hardware/ devices � of t he OS it self ! � The OS needs help f rom the hardware to accomplish these tasks!
Lecture overview � What is an Operating System? � A review of OS- related hardware � History of operating systems � Types of operating systems
Overview of computer system layers Hardware - CPU, memory, I/O devices - disk, network ...
Basic anatomy on a CPU (1) � Some key CPU Components � P rogram Count er (P C) • holds memory address of next instruction � I nst ruct ion Regist er (I R) • holds instruction currently being executed � Regist ers (Reg. 1..n) • hold variables and temporary results � Arit hmet ic and Logic Unit (ALU) • perf orms arithmetic f unctions and logic operations
Basic anatomy on a CPU (2) � Some key CPU Components � Memory Address Regist er (MAR) • contains address of memory to be read/ written � Memory Dat a Regist er (MDR) • contains memory data read or to be written � St ack P oint er (SP ) • holds memory address of stack with a f rame f or each procedure’s local variables & parameters � Processor St at us Word (PSW) • contains the mode bit and various control bits
Program execution � I nstruction sets � dif f erent f or dif f erent machines � all have load and st ore inst ruct ions f or moving it ems bet ween memory and regist ers � many inst ruct ions f or comparing and combining values in regist ers and put t ing result in a regist er � Fetch/ Decode/ Execute cycle � f et ch next inst ruct ion point ed t o by P C � decode it t o f ind it s t ype and operands � execut e it � repeat
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }
Fetch/ Decode/ Execute Cycle Memory CPU PC IR MAR Reg. 1 MDR … Reg. n ALU While (1) { Fetch instruction from memory Execute instruction (Get other operands if necessary) Store result }
The OS is just a program! � How can the OS cause application programs to run? � How can applications programs cause the OS to run? � How can the OS switch the CPU to run a dif f erent application and later resume the f irst one? � How can the OS maintain control? � I n what ways can application code try to cheat? � And how can the OS stop the cheating?
How Can the OS invoke an Application? � The computer boots and begins running the OS � f et ch/ decode/ execut e OS inst ruct ions � OS can request user input to identif y an application to run � OS loads t he address of t he applicat ion’s st art ing inst ruct ion int o t he P C � CP U f et ches/ decodes/ execut es t he applicat ion’s inst ruct ions
How Can Applications I nvoke the OS? � Trap instruction changes PC to point to an OS entry point instruction � applicat ion calls a library procedure t hat includes t he appropriat e t rap inst ruct ion � f et ch/ decode/ execut e cycle begins at a specif ied OS ent ry point called a syst em call
How can the OS run a new Application? � To suspend execution of an application simply capture its memory state and processor state � copy values of all regist ers int o a dat a st ruct ure and save it t o memory � preserve t he memory values of t his applicat ion so it can be rest art ed lat er
Recommend
More recommend