class 1: what is an operating system?

73
Class 1: Introduc0on cs4414 Spring 2014 rustclass.org University of Virginia David Evans

Upload: david-evans

Post on 28-Jan-2015

106 views

Category:

Education


1 download

DESCRIPTION

cs4414: Operating Systems http://rust-class.org/class-1-what-is-an-operating-system.html Class 1: What is an Operating System? Why so many programming languages? Introducing Rust

TRANSCRIPT

Page 1: Class 1: What is an Operating System?

Class  1:  Introduc0on  

cs4414  Spring  2014  rust-­‐class.org  

University  of  Virginia  David  Evans  

Page 2: Class 1: What is an Operating System?

Plan  for  Today  

•  What  is  an  Opera0ng  System?  •  Course  Overview  •  Introducing  Rust  

2  

Page 3: Class 1: What is an Operating System?

What  is  an  Opera0ng  System?  

3  

Page 4: Class 1: What is an Operating System?

An  opera&ng  system  is  a  program  that  manages  a  computer’s  hardware.  It  also  provides  a  basis  for  applica0on  programs  and  acts  as  an  intermediary  between  the  computer  user  and  the  computer  hardware.  An  amazing  aspect  of  opera0ng  systems  is  how  they  vary  in  accomplishing  these  tasks.  Mainframe  opera0ng  systems  are  designed  primarily  to  op0mize  u0liza0on  of  hardware.  Personal  computer  (PC)  opera0ng  systems  support  complex  games,  business  applica0ons,  and  everything  in  between.  Opera0ng  systems  for  mobile  computers  provide  an  environment  in  which  a  user  can  easily  interface  with  the  computer  to  execute  programs.  Thus,  some  opera0ng  systems  are  designed  to  be  convenient,  others  to  be  efficient,  and  others  to  be  some  combina0on  of  the  two.  

4  

Page 5: Class 1: What is an Operating System?

It  is  hard  to  pin  down  what  an  opera0ng  system  is  other  than  saying  it  is  the  so2ware  that  runs  in  kernel  mode  –  and  even  that  is  not  always  true.  Part  of  the  problem  is  that  opera0ng  systems  perform  two  basically  unrelated  func0ons:  providing  applica0on  programmers  (and  applica0on  programs,  naturally)  a  clean  abstract  set  of  resources  instead  of  the  messy  hardware  ones  and  managing  these  hardware  resources.  

5  

$186.00  

Page 6: Class 1: What is an Operating System?

What’s  an  opera0ng  system?  You  might  say  it’s  what’s  between  you  and  the  hardware,  but  that  would  cover  pre\y  much  all  so]ware.  So  let’s  say  it’s  the  so]ware  that  sites  between  your  so]ware  and  the  hardware.  But  does  that  mean  that  the  library  you  picked  up  from  some  web  site  is  part  of  the  opera0ng  system?  We  probably  want  our  opera0ng-­‐system  defini0on  to  be  a  bit  less  inclusive.  So,  let’s  say  that  it’s  that  so2ware  that  almost  everything  else  depends  upon.  This  is  s0ll  vague,  but  then  the  term  is  used  in  a  rather  nebulous  manner  throughout  the  industry.    Perhaps  we  can  do  be\er  by  describing  what  an  opera0ng  system  is  actually  supposed  to  do.  From  a  programmer’s  point  of  view,  opera&ng  systems  provide  useful  abstrac&ons  of  the  underlying  hardware  facili&es.  Since  many  programs  can  use  these  facili0es  at  once,  the  opera&ng  system  is  also  responsible  for  managing  how  these  facili&es  are  shared.  

6  

$149.95  

Page 7: Class 1: What is an Operating System?

7  

There  is  a  body  of  so]ware,  in  fact,  that  is  responsible  for  making  it  easy  to  run  programs  (even  allowing  you  to  seemingly  run  many  at  the  same  0me),  allowing  programs  to  share  memory,  enabling  programs  to  interact  with  devices,  and  other  fun  stuff  like  that.  That  body  of  so]ware  is  called  the  opera&ng  system,  as  it  is  in  charge  of  making  sure  the  system  operates  correctly  and  efficiently  in  an  easy-­‐to-­‐use  manner.    

$0.00  ($29)  

Page 8: Class 1: What is an Operating System?

Do  we  like  any  of  these  defini0ons?  

8  

Page 9: Class 1: What is an Operating System?

9  

h\p://www.merriam-­‐webster.com/dic0onary/defini0on  

Page 10: Class 1: What is an Operating System?

Simplis0c  View  of  Compu0ng  Systems  

10  

Hardware  

Opera0ng  System  

Applica0ons  

Page 11: Class 1: What is an Operating System?

More  Realis0c  View  

11  

Hardware  

Opera0ng  System  

Applica0ons  

Page 12: Class 1: What is an Operating System?

cs4414  OS  Defini0on  

An  opera&ng  system  is  a  program  that  manages  resources  and  provides  abstrac&ons.  

12  

Page 13: Class 1: What is an Operating System?

Main  Ideas  in  cs4414  

Managing  Resources    How  do  you  share  processors,  memory,  and    hardware  devices  among  programs?  

 Providing  Abstrac&ons    How  do  you  provide  programs  with  clean  and    easy  to  use  interfaces  to  resources,  without    sacrificing  (too  much)  efficiency  and  flexibility?  

13  

Page 14: Class 1: What is an Operating System?

Does  it  have  an  Opera0ng  System?  

14  

Page 15: Class 1: What is an Operating System?

15  

Apple  II  1977  

Page 16: Class 1: What is an Operating System?

16  

Page 17: Class 1: What is an Operating System?

17  

✖ Manage  Resources  ✔      Provide  Abstrac0ons  

Page 18: Class 1: What is an Operating System?

18  

Page 19: Class 1: What is an Operating System?

19  

Not  just  one  opera0ng  system,  but  dozens  of  them!  

Page 20: Class 1: What is an Operating System?

Does  it  have  an  Opera0ng  System?  

20  

Page 21: Class 1: What is an Operating System?

21  

Page 22: Class 1: What is an Operating System?

Course  Overview  

22  

Page 23: Class 1: What is an Operating System?

Minimizing  Magic  23  

Its  all  magic!  

Physics  

Cool  Compu0ng  Stuff  

Page 24: Class 1: What is an Operating System?

Minimizing  Magic  24  

Its  all  magic!  

Physics  

Four  Years  Studying  Compu0ng  at  an  

Elite  Public  University  

Cool  Compu0ng  Stuff  

Page 25: Class 1: What is an Operating System?

Minimizing  Magic  25  

Its  all  magic!  

Physics  

Four  Years  Studying  Compu0ng  at  an  

Elite  Public  University  

Its  all  understandable!  (and  I  can  do  m

agical  things!)  

Cool  Compu0ng  Stuff  

Page 26: Class 1: What is an Operating System?

Minimizing  Magic  26  

Its  all  magic!  

Physics  

Cool  Compu0ng  Stuff  

cs1110  

By  the  0me  you  graduate,  nothing  should  be  “magic”  other  than  how  transistors  work  and  NP-­‐Completeness.    

Page 27: Class 1: What is an Operating System?

Minimizing  Magic  27  

Its  all  magic!  

Physics  

Cool  Compu0ng  Stuff  

cs1110  cs2110  

cs2150  

cs2150  

cs2330  

cs3330  

cs3102  

By  the  0me  you  graduate,  nothing  should  be  “magic”  other  than  how  transistors  work  and  NP-­‐Completeness.    

Page 28: Class 1: What is an Operating System?

Minimizing  Magic  28  

Its  all  magic!  

Physics  

Cool  Compu0ng  Stuff  

cs1110  cs2110  

cs2150  

cs2150  

cs2330  

cs3330  

cs3102  

cs4414  

cs4414  

cs4414  By  the  0me  you  graduate,  nothing  should  be  “magic”  other  than  how  transistors  work  and  NP-­‐Completeness.    

Page 29: Class 1: What is an Operating System?

Minimizing  Magic  29  

Its  all  magic!  

Physics  

Cool  Compu0ng  Stuff  

cs1110  cs2110  

cs2150  

cs2150  

cs2330  

cs3330  

cs3102  

cs4414  

cs4610  

cs4414  

cs4414  

elec0ves  

By  the  0me  you  graduate,  nothing  should  be  “magic”  other  than  how  transistors  work  and  NP-­‐Completeness.    

Page 30: Class 1: What is an Operating System?

(Academic)  Goal  of  the  Class  

30  

Improve  our  understanding  of  how  

computers  work.    

Page 31: Class 1: What is an Operating System?

(Academic)  Goal  of  the  Class  

31  

Improve  our  understanding  of  how  

computers  work.    

Not:  

Page 32: Class 1: What is an Operating System?

Why  bother?  1.  Be\er  understanding  of  how  computers  work  

make  you  a  beEer  programmer  which  will  help  you  build  something  cool,  succeed  in  grad  school,  or  get  a  more  interes0ng  job.  

2.  Be\er  understanding  of  how  computers  work  (and  why)  is  intellectually,  culturally,  and  scien&fically  interes&ng.  

32  

Page 33: Class 1: What is an Operating System?

Why  bother?  1.  Be\er  understanding  of  how  computers  work  

make  you  a  beEer  programmer  which  will  help  you  build  something  cool,  succeed  in  grad  school,  or  get  a  more  interes0ng  job.  

2.  Be\er  understanding  of  how  computers  work  (and  why)  is  intellectually,  culturally,  and  scien&fically  interes&ng.  

33  

Page 34: Class 1: What is an Operating System?

Why  bother?  1.  Be\er  understanding  of  how  computers  work  

make  you  a  beEer  programmer  which  will  help  you  build  something  cool,  succeed  in  grad  school,  or  get  a  more  interes0ng  job.  

2.  Be\er  understanding  of  how  computers  work  (and  why)  is  intellectually,  culturally,  and  scien&fically  interes&ng.  

34  

Page 35: Class 1: What is an Operating System?

Why  bother?  1.  Be\er  understanding  of  how  computers  work  

make  you  a  beEer  programmer  which  will  help  you  build  something  cool,  succeed  in  grad  school,  or  get  a  more  interes0ng  job.  

2.  Be\er  understanding  of  how  computers  work  (and  why)  is  intellectually,  culturally,  and  scien&fically  interes&ng.  

35  

If  these  reasons  don’t  apply  for  you  and  you  are  only  in  this  class  because  there  is  a  bureaucra&c  requirement  that  you  take  it  so  some  Dean  will  hand  you  a  nice  bit  of  paper  in  front  of  your  parents,  you  should  meet  with  me  to  figure  out  an  alterna0ve.  

Page 36: Class 1: What is an Operating System?

36  

What  Mr.  Jefferson  Wants  

Page 37: Class 1: What is an Operating System?

37  

What  Mr.  Jefferson  Wants  

“We  wish  to  establish  in  the  upper  country  of  Virginia,  and  more  centrally  for  the  State,  a  University  on  a  plan  so  broad  and  liberal  and  modern,  as  to  be  worth  patronizing  with  the  public  support,  and  be  a  tempta&on  to  the  youth  of  other  States  to  come  and  drink…”    TJ’s  le\er  to  Joseph  Priestly,  1800  

No  Majors  No  Degrees  No  President  

Page 38: Class 1: What is an Operating System?

38  

:  Thomas  Jefferson  enrolled  in  the  College  of  William  and  Mary  on  March  25,  1760,  at  the  age  of  16…    By  the  0me  he  came  to  Williamsburg,  the  young  scholar  was  proficient  in  the  classics  and  able  to  read  Greek  and  La0n  authors  in  the  original…  He  was  instructed  in  natural  philosophy  (physics,  metaphysics,  and  mathema&cs)  and  moral  philosophy  (rhetoric,  logic,  and  ethics).  A  keen  and  diligent  student,  he  displayed  an  avid  curiosity  in  all  fields  and,  according  to  family  tradi0on,  he  frequently  studied  fi2een  hours  a  day.    

Note:  this  does  not  mean  he  wants  you  to  be  lazy:  

h\p://www.wm.edu/about/history/tjcollege/tjcollegelife/  

Page 39: Class 1: What is an Operating System?

What  is  my  goal  for  lectures?  

Convey  some  complex  technical  ideas      

Teach  you  what  you  need  to  know  to  do  the  projects  Avoid  being  fired  Keep  most  of  you  awake  for  75  minutes  Get  you  to  laugh  at  dumb  jokes  

39  

Page 40: Class 1: What is an Operating System?

Convey  some  complex  technical  ideas      

Teach  you  what  you  need  to  know  to  do  the  projects  Avoid  being  fired  Keep  most  of  you  awake  for  75  minutes  Get  you  to  laugh  at  dumb  jokes  

What  is  my  goal  for  lectures?  

40  

Lectures  are  a  horrible  medium  for  learning  complex  ideas.      Be\er  to  read  wikipedia.  

Page 41: Class 1: What is an Operating System?

Convey  some  complex  technical  ideas      

Teach  you  what  you  need  to  know  to  do  the  projects  Avoid  being  fired  Keep  most  of  you  awake  for  75  minutes  Get  you  to  laugh  at  dumb  jokes  

What  is  my  goal  for  lectures?  

41  

Lectures  are  a  horrible  medium  for  learning  complex  ideas.      Be\er  to  read  wikipedia.  

The  point  of  the  projects  is  to  teach  you  things  I  want  you  to  learn  in  the  class  (mostly  by  sugges0ng  things  you  should  learn  on  your  own).  

Page 42: Class 1: What is an Operating System?

Convey  some  complex  technical  ideas      

Teach  you  what  you  need  to  know  to  do  the  projects  Avoid  being  fired  Keep  most  of  you  awake  for  75  minutes  Get  you  to  laugh  at  dumb  jokes  

What  is  my  goal  for  lectures?  

42  

Lectures  are  a  horrible  medium  for  learning  complex  ideas.      Be\er  to  read  wikipedia.  

The  point  of  the  projects  is  to  teach  you  things  I  want  you  to  learn  in  the  class  (mostly  by  sugges0ng  things  you  should  learn  on  your  own).  

I  have  tenure  already  

Page 43: Class 1: What is an Operating System?

Convey  some  complex  technical  ideas      

Teach  you  what  you  need  to  know  to  do  the  projects  Avoid  being  fired  Keep  most  of  you  awake  for  75  minutes  Get  you  to  laugh  at  dumb  jokes  

What  is  my  goal  for  lectures?  

43  

Lectures  are  a  horrible  medium  for  learning  complex  ideas.      Be\er  to  read  wikipedia.  

The  point  of  the  projects  is  to  teach  you  things  I  want  you  to  learn  in  the  class  (mostly  by  sugges0ng  things  you  should  learn  on  your  own).  

You  probably  should  be  gerng  more  sleep!  

I  have  tenure  already  

Page 44: Class 1: What is an Operating System?

Convey  some  complex  technical  ideas      

Teach  you  what  you  need  to  know  to  do  the  projects  Avoid  being  fired  Keep  most  of  you  awake  for  75  minutes  Get  you  to  laugh  at  dumb  jokes  

What  is  my  goal  for  lectures?  

44  

Lectures  are  a  horrible  medium  for  learning  complex  ideas.      Be\er  to  read  wikipedia.  

The  point  of  the  projects  is  to  teach  you  things  I  want  you  to  learn  in  the  class  (mostly  by  sugges0ng  things  you  should  learn  on  your  own).  

You  probably  should  be  gerng  more  sleep!  

Monty  Python  is  funnier  (unless  you  are  Kevin  Redmon)  

I  have  tenure  already  

Page 45: Class 1: What is an Operating System?

My  Real  Goal  for  Lectures  

45  

Provide  context  and  meaning  for  the  things  you  have  or  will  later  learn  on  your  own.  

(I  also  have  an  insidious  goal  for  lectures,  that  I  won’t  tell  you  about  un0l  later…)  

Page 46: Class 1: What is an Operating System?

Course  Assignments  

46  

Page 47: Class 1: What is an Operating System?

47  

The  Problem  Sets  are  Sugges&ons  

If  you  have  a  beEer  idea,  convince  me,  and  you  should  do  that  instead.    

Page 48: Class 1: What is an Operating System?

Plan  for  Projects  

PS0  (Friday):  Rust  tutorial  and  course  survey  PS1  (23  Jan):  zhEpto  web  server  PS2  (9  Feb):  gash  (learn  about  processes)  PS3  (3  March):  zhEa  web  server  (learn  about    synchroniza0on,  memory  management)  

PS4  (2  April):  hacking  a  (rela0vely  simple)  kernel    

48  

Page 49: Class 1: What is an Operating System?

49  

This  genera0on  of  students  got  into  “UVa”  by  doing  exactly  and  precisely  what  teacher  wants.  If  teacher  is  vague  about  what  he  wants,  they  work  a  lot  harder  to  figure  out  what  they  want  and  whether  or  not  it  is  good.  The  vaguer  the  direc&ons,  the  more  likely  the  opportunity  for  serendipity  to  happen.  It  drives  them  nuts!  

Harvard  Professor  John  S0lgoe    (on  "60  Minutes",  4  January  2004)  

Page 50: Class 1: What is an Operating System?

Final  Project  

50  

Final  Project  (29  April):    (almost*)  anything  you  want!      *  must  be  at  least  two  of:        fun,  technically  interes0ng,        useful,  relevant  

Start  thinking  of  ideas  now  –  if  you  come  up  with  something  sufficiently  worthwhile,  can  subs0tute  for  PS4/PS3/PS2/etc.  

Page 51: Class 1: What is an Operating System?

Some  Examples  

51  

h\p://uvasear.ch/  

Nishant  Shukla  Jasdev  Singh  

Page 52: Class 1: What is an Operating System?

Norvigtorious  

52  

Alex  Fabian  Daniel  Nizri  Renee  Seaman  Casey  Silver  

Page 53: Class 1: What is an Operating System?

IronKernel  

53  

Kevin  Broderick    Alex  Lamana    Zeming  Lin  John  Stevans  Wil  Thomason  

We  will  use  this  for  PS4!  

Page 54: Class 1: What is an Operating System?

54  

Page 55: Class 1: What is an Operating System?

55  

Page 56: Class 1: What is an Operating System?

56  

Kiet  Tran  

Page 57: Class 1: What is an Operating System?

Why  learn  a  new  

programming  language?  

57  

Page 58: Class 1: What is an Operating System?

J  S  Bach,  “Coffee  Cantata”,  BWV  211  (1732)    www.npj.com/homepage/teritowe/jsbhand.html    

“Jamais  Jamais  Jamais”  from  Harmonice  Musices  Odhecaton  A.  (1501)  

58  

Page 59: Class 1: What is an Operating System?

Modern  Music  Nota0on  

Roman  Haubenstock-­‐Rama0,  Concerto  a  Tre    

John  Cage,  Fontana  Mix  h\p://www.medienkunstnetz.de/works/fontana-­‐mix/audio/1/  

59  

Page 60: Class 1: What is an Operating System?

60  

Page 61: Class 1: What is an Operating System?

61  

Page 62: Class 1: What is an Operating System?

Thought  and  Ac0on  

Languages  change  the  way  we  think  BASIC:  think  about  GOTO  Algol,  Python:  think  about  assignments,  control  blocks  Scheme,  Haskell:  think  about  procedures  Java,  C++:  think  about  types,  objects  

Languages  provide  abstrac&ons  of  machine  resources  –  Hide  dangerous/confusing  details:  memory  loca0ons,  instruc0on  opcodes,  number  representa0ons,  calling  conven0ons,  etc.  

–  Hiding  more  increases  simplicity,  but  limits  control  

62  

Page 63: Class 1: What is an Operating System?

Why  so  many  programming  languages?  

63  

Page 64: Class 1: What is an Operating System?

Fundamental  Differences  

All  equivalently  powerful!  –  Universal  languages:  all  capable  of  simula0ng  each  other  

Fundamental  differences  Expressiveness:  how  easy  it  is  to  describe  a  computa0on  Control:  how  much  programmer  can  control  machine  “Truthiness”:  likelihood  program  means  programmer  wants  Safeness:  impact  of  programmer  mistakes  

Difficult  to  achieve  all  of  these  at  once  

64  

Page 65: Class 1: What is an Operating System?

Fundamental  Differences  

All  equivalently  powerful!  –  Universal  languages:  all  capable  of  simula0ng  each  other  

Fundamental  differences  Expressiveness:  how  easy  it  is  to  describe  a  computa0on  Control:  how  much  programmer  can  control  machine  “Truthiness”:  likelihood  program  means  programmer  wants  Safeness:  impact  of  programmer  mistakes  

Difficult  to  achieve  all  of  these  at  once  

65  

Page 66: Class 1: What is an Operating System?

Fundamental  Differences  

All  equivalently  powerful!  –  Universal  languages:  all  capable  of  simula0ng  each  other  

Fundamental  differences  Expressiveness:  how  easy  it  is  to  describe  a  computa0on  Control:  how  much  programmer  can  control  machine  “Truthiness”:  likelihood  program  means  programmer  wants  Safeness:  minimize  impact  of  programmer  mistakes  

Difficult  to  achieve  all  of  these  at  once  

66  

Page 67: Class 1: What is an Operating System?

Fundamental  Differences  

All  equivalently  powerful!  –  Universal  languages:  all  capable  of  simula0ng  each  other  

Fundamental  differences  Expressiveness:  how  easy  it  is  to  describe  a  computa0on  Control:  how  much  programmer  can  control  machine  “Truthiness”:  likelihood  program  means  programmer  wants  Safeness:  minimize  impact  of  programmer  mistakes  

Difficult  to  achieve  all  of  these  at  once  

67  

What  do  we  want  for  systems  programming?  

Page 68: Class 1: What is an Operating System?

Programming  Language  Design  Space  Expressiv

eness  

“Truthiness”  

low  

high  

more  mistake  prone   less  mistake  prone  

68  

Page 69: Class 1: What is an Operating System?

Programming  Language  Design  Space  Expressiv

eness  

“Truthiness”  

Scheme

Python

Java

C++ C

low  

high  

Spec#

Ada

strict  typing,  sta0c  

BASIC

more  mistake  prone   less  mistake  prone  

print ("Hello!")

(display “Hello!”)

69  

Page 70: Class 1: What is an Operating System?

Programming  Language  Design  Space  Co

ntrol  

Safety  

low  

high  

very  risky   fairly  safe  

70  

Page 71: Class 1: What is an Operating System?

Programming  Language  Design  Space  Co

ntrol  

Safety  

low  

high  

very  risky   fairly  safe  

71  

Python

Java

C

Page 72: Class 1: What is an Operating System?

“a  safe,  concurrent,  prac0cal  language”  

72  

     

Its  design  is  oriented  toward  concerns  of  “programming  in  the  large”,  that  is,  of  crea0ng  and  maintaining  boundaries  –  both  abstract  and  opera0onal  –  that  preserve  large-­‐system  integrity,  availability  and  concurrency.  

from  h\p://www.rust-­‐lang.org/     Rust  

Advances  in  programming  language  design  and  compiler  implementa0on  make  it  possible  to  get  both  control  and  safety,  and  mostly  get  expressiveness  and  “truthiness”  all  at  the  same  0me!  

Page 73: Class 1: What is an Operating System?

Charge  

•  Do  (or  at  least  a\empt)  everything  on  the  Class  1  notes  Ac&on  Items  before  class  Thursday  – Download  and  setup  your  compu0ng  environment  for  cs4414  

–  Setup  your  github  account  •  Next  class:  – Help  gerng  everything  working  on  your  machine  – Help  gerng  started  with  Rust  (Rust  tutorial)  

73  

Bring  a  laptop  to  use  in  Thursday’s  class!