41
EECS 482 Introduction to Operating Systems Winter 2018 Baris Kasikci [email protected] (Thanks, Harsha Madhyastha for the slides!) January 3, 2018 EECS 482 – Lecture 1 1

EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

EECS 482Introduction to

Operating Systems

Winter 2018

[email protected]

(Thanks,HarshaMadhyastha fortheslides!)

January3,2018 EECS482– Lecture1 1

Page 2: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

AboutMe

•Prof.Kasikci(Prof.K.),Prof.Baris(Prof.Barish)•AssistantProfessor• JoinedMichiganinFall’17• PhDfromEPFL• Previously,researcheratMicrosoftResearch• Previously,anembeddedsystemsdeveloper

• Interests:systemreliability,security,performance• EmployamixofmethodsfromOperatingSystems,ProgrammingLanguages,SoftwareEngineering,ComputerArchitecture

EECS482– Lecture1January3,2018 2

Page 3: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

AboutYou

[email protected][email protected] ifyouneedspecialarrangementforanydisabilities•Cometalktome• BBB4816,mydoorisalwaysopen• Anytimeaboutcareer,life,anydifficultiesyouarefacing,harddecisions,etc.• Duringofficehoursabout482

January3,2018 EECS482– Lecture1 3

Page 4: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

EECS482Staff

• Instructors•GSIs&IAs

January3,2018 EECS482– Lecture1 4

Page 5: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

AgendaforToday

•Whydoweneed482?

•Coursesyllabusandlogistics

•WhydoweneedanOSandwhatdoesitdo?

•HowdidOSesevolvetowhatwehavetoday?

EECS482– Lecture1January3,2018 5

Page 6: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Neuronstosilicon?

Ideas

High-LevelCode

MachineInstructions

Processors

Gates

EECS280,281(programming)

EECS483(compilers)

EECS370(comp.organization)

EECS270(digitaldesign)

EECS482– Lecture1January3,2018 6

Page 7: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Whatismissing?

•Bootstrapping:• Howdoesacomputerstartwhenyouturniton?• HowtogetaprogramintomemoryandhavetheCPUstartexecutingit?

•ConcurrentexecutionwithI/O:• Howtoreadkeyboardormouse?Printoutputtoscreen?• Howtorunmultipleprogramsatthesametime,withoutonebreakingtheother?

•Persistenceandsecurity:• Howtosaveyourdatawhenyouturnthecomputeroff?• Howtopreventotherusersfromaccessingyourdata?• Howcanmultipleusersusethesamecomputersecurely?

EECS482– Lecture1January3,2018 7

Page 8: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Whatismissing?

•Bootstrapping:• Howdoesacomputerstartwhenyouturniton?• HowtogetaprogramintomemoryandhavetheCPUstartexecutingit?

•ConcurrentexecutionwithI/O:• Howtoreadkeyboardormouse?Printoutputtoscreen?• Howtorunmultipleprogramsatthesametime,withoutonebreakingtheother?

•Persistenceandsecurity:• Howtosaveyourdatawhenyouturnthecomputeroff?• Howtopreventotherusersfromaccessingyourdata?• Howcanmultipleusersusethesamecomputersecurely?

EECS482– Lecture1January3,2018 8

YouwillbeabletoanswerallthesequestionsbytheendofEECS482

Page 9: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Objectivesofthisclass

•Wewillunderstandprinciplesofconcurrency• Oneparadigm:multi-threadedprogram• Principlesapplytootherforms(e.g.,event-based)

•WewillstudydesignprinciplesofanOS• ThiscourseisnotaboutspecificsofanyparticularOS

•WewilldevelopanunderstandingofOSimpactonapplicationperformanceandreliability• WhatcausesyourprogramtocrashwhenyoudereferenceNULL?• Howcanmultithreadedcodebeslowerthansingle-threadedcode?

EECS482– Lecture1January3,2018 9

Page 10: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Prerequisites

•EECS281•EECS370•ExtensiveC/C++programmingexperience(STL)•FamiliaritywithUNIX•Understandingofcomputerarchitecture

• Stackpointer• Programcounter• Low-levelexecutionofaprogram• Etc.

•Someunderstandingofpaging,TLB,caching

January3,2018 EECS482– Lecture1 10

Page 11: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

ClassHomepageandTools

•Classwebpage• http://web.eecs.umich.edu/~harshavm/eecs482/• Syllabus,slides,homework,etc.postedonclasswebpage• SubscribetoPiazza!• Announcementsandclassdiscussion

EECS482– Lecture1January3,2018 11

Page 12: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

LectureSchedule

•CPU(threadsandconcurrency)•Memory(addressspaces)•Midterm•Network(sockets)•Storage(filesystems)•Aggregation:distributedsystemsandcasestudies

EECS482– Lecture1January3,2018 12

Page 13: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Lectures

•2sections• Mostlysynchronized,examswillhaveafewdifferentquestions

• Lecturecaptured(videosonline)

•Slidesandlecturenoteswillbepostedonthewebpage

•Textbook(highlyrecommended):• AndersonandDahlin,“OperatingSystems:PrinciplesandPractice”• Additionalreadingspostedonthewebpage

EECS482– Lecture1January3,2018 13

Page 14: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Lab/DiscussionSections

•OKtoattendanydiscussion• Aslongasthereareseats

Questionspostedseveraldaysinadvance• Dothembefore goingtoyoursection• Thispreparesyouwellforexams• Coverssomebackgroundknowledge

•NoDiscussionSessionsThisFriday!

EECS482– Lecture1January3,2018 14

Page 15: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Projects

•4projects• Writingaconcurrentprogram• Threadmanager• Virtualmemorypager• Multi-threadedsecurenetworkfilesystem

•Firstisindividual,doothersingroupsof2-3• RegisteryourGitHubid– we’llassignrepositories• Declareyourgroup(by1/22)viacoursewebpage• [email protected] iftaken482before• Can’treuseanycodeexceptforproject1.

EECS482– Lecture1January3,2018 15

Page 16: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Projectrecommendations

•Choosegroupmemberscarefully• Checkschedule,classgoals,style,etc.• UsePiazzatofindgroupmembers

•We’llevaluateeverymember’scontributions• Peerfeedback• gitlogandGitHubstatistics

•Groupcanfireoneofitsmembers(seesyllabus)

EECS482– Lecture1January3,2018 16

Page 17: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

ProjectsareHARD!

•ProbablythehardestclassyouwilltakeatUMintermsofdevelopmenteffort• Projectswilltake95%ofyourtimeinthisclass

•Reasonforbeinghard:• Notnumberoflinesofcode!• Instead,newconcepts:threads,interrupts,addressspaces,namespacesetc.

EECS482– Lecture1January3,2018 17

Page 18: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Projectrecommendations

•Donotstartworkingonprojectsatlastminute!• Projectsareautograded(mustbemostlycorrect)• No.ofhoursyouputinorlinesofcodedon’tcount• Testingisintegralprocessofdevelopment

•Makegooduseofhelpavailable• ~20officehoursperweek(extrahourswhenprojectsaredue)• Therewillbelongqueues• MonitorandparticipateindiscussiononPiazza• Hintsduringlectures,discussions(alsointextbook!)

EECS482– Lecture1January3,2018 18

Page 19: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Policies

•Submission• 1submissionperdaytoautograder+3bonus• Dueatmidnight(harddeadline!)• 3latedaysbudgetacrossallprojects(ifyouhandinyourprojecttwodayslate,youwillhaveonelatedayleft)

•Collaboration• OkaytoclarifyproblemordiscussC++syntax• Notokaytodiscusssolutions• Pastsolutionsarealproblem(severalHCcases)

EECS482– Lecture1January3,2018 19

Page 20: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Exams(Tentative!)

•Midterm:February21st (6:30-8:30pm)

•Final:April23th (7-9pm)

•Nomakeupexams• Unlessdirecircumstances• Makesureyouscheduleinterviewsappropriately• E-mailme([email protected])withexceptions/conflicts

EECS482– Lecture1January3,2018 20

Page 21: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Gradingbreakdown

•Projects:• Project1:3%• Projects2,3,and4:15%each

•Mid-term:26%•Final:26%

EECS482– Lecture1January3,2018 21

Page 22: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Enrollment

Musthaveprerequisites(281&370orequivalent)

Overrides• Currentlynearcapforcoursestaffing• Hopemanycanenrollduetonormalchurn

EECS482– Lecture1January3,2018 22

Page 23: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Protipsforsuccessin482

•Startearlyonprojects

• LeverageGitHubandcommunicatewithteam

•Takeadvantageofavailablehelp• Gotoofficehours,post/monitorquestionsonPiazza

•Attendlecturesanddiscussions• Readtextbook,solvequestionsbeforediscussion

•Askquestionswhensomethingisunclear

EECS482– Lecture1January3,2018 23

Page 24: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

WhyhaveanOS?

•Whatifapplicationsrandirectlyonhardware?

•Problems• Portability• Resourcesharing

Applications

Hardware

EECS482– Lecture1January3,2018 24

Page 25: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

WhatisanOS?

•Theoperatingsystemisthesoftwarelayerbetweenuserapplicationsandthehardware

•OSis“allthecodethatyoudon’thavetowrite” toimplementyourapplication

OperatingSystem

Hardware

ApplicationsVirtualMachineInterface

PhysicalMachineInterface

EECS482– Lecture1January3,2018 25

Page 26: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

RolesoftheOS

• Illusionist:Createabstractions• CPUà Threads• Memoryà Addressspace

•Government:Managesharedhardwareresources• Butatacost(taxes)

•ForanyareaofOS,ask• Whatinterfacedoeshardwarepresent?• WhatinterfacedoesOSpresenttoapplications?

EECS482– Lecture1January3,2018 26

Page 27: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

OSandApps:2Perspectives

•Perspective1:applicationismainprogram• Getsservicesbycallingkernel(OS)• Example:printthistothescreen

•Problemswiththisview:• Howdoesapplicationstart?• Howdotasksoccurringoutsideanyprogram(e.g.receivingnetworkpackets)getdone?• Howdomultipleprogramsrunsimultaneouslywithoutmessingeachotherup?

EECS482– Lecture1January3,2018 27

Page 28: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

OSandApplications

•Perspective2:OSismainprogram• Callsapplicationsassubroutines• Illusion:everyapprunsonitsowncomputer

• Lowerlayer(OS)invokeshigherlayer(apps)!•ApporprocessorreturnscontroltoOS•Correctperspective,butwhatisitthatmakestheOSthe“main”program?

EECS482– Lecture1January3,2018 28

Page 29: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

WhytakeanOSclass?- 1

•Masteringconcurrency• Performancetodayachievedthroughparallelism• Masteryrequiredtobeatop-notchdeveloper

•Understandingwhatyouuse• UnderstandingtheOShelpsyouwritebetterapps• Functionality,performancetuning,simplicity,etc.

•Universalabstractionsandoptimizations• Caching,indirection,naming,atomicity,protection,…• Examples:Cloudcomputing,Webservices,mobile

EECS482– Lecture1January3,2018 29

Page 30: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

WhytakeanOSclass?- 2

•BuildanOS•Conceptsreusedinmanyapplications• Google’swebserverfarm• AmazonWebServices(time-shared)• Hypervisors(VMWareESXserver)• NVDIAdevicedriver

•Softwaredevelopment• Designanabstraction• Makeitefficientlyusablebyothers

•Design-relatedinterviewquestions

January3,2018 EECS482– Lecture1 30

Page 31: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•Singleoperatoratconsole

•Positives:• Interactive• Verysimple

•Downside:• Poorutilizationofexpensivehardware

time

humanI/OCPUI/OhumanI/OCPU

EECS482– Lecture1January3,2018 31

Page 32: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•Batchprocessing(usingpunchcards)• Goal:ImproveCPUandI/Outilizationbyremovinguserinteraction

•OSisbatchmonitor+libraryofstandardservices•Protectionbecomesanissue• Whywasn’tthisanissueforsingleoperatoratconsole?

•Notinteractive

timeI/OCPUI/OCPUI/OCPU

EECS482– Lecture1January3,2018 32

Page 33: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

January3,2018 EECS482– Lecture1 33

https://www.wired.com/2015/07/hackers-remotely-kill-jeep-highway/

Page 34: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•Multi-programmedbatch• ImproveutilizationbyoverlappingCPUandI/O

time

P1:CPUDiskCPUPrint

P2:DiskCPUPrintCPUPrint

P3:DiskCPU

EECS482– Lecture1January3,2018 34

Page 35: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•Multi-programmedbatch• ImproveutilizationbyoverlappingCPUandI/O

time

P1:CPUDiskCPUPrint

P2:DiskCPUPrintCPUPrint

P3:DiskCPU

OSbecomesmorecomplex!• Runsmultipleprocessesconcurrently• EnablessimultaneousCPUandI/O•MultipleI/Ostakeplacesimultaneously• Protectsprocessesfromeachother• But,stillnotinteractive

EECS482– Lecture1January3,2018 35

Page 36: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•Timesharing• Goal:Allowpeopletointeractwithprogramsastheyrun• Insight:Usercanbemodeledasa(veryslow)I/Odevice• Switchbetweenprocesseswhilewaitingforuser

time

P1:CPUDiskCPUPrint

P2:UserCPUUserCPUUser

P3:User DiskCPU

EECS482– Lecture1January3,2018 36

Page 37: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•Timesharing• Goal:Allowpeopletointeractwithprogramsastheyrun• Insight:Usercanbemodeledasa(veryslow)I/Odevice• Switchbetweenprocesseswhilewaitingforuser

time

P1:CPUDiskCPUPrint

P2:UserCPUUserCPUUser

P3:User DiskCPU

EECS482– Lecture1January3,2018 37

OSisnowevenmorecomplexLotsofsimultaneousjobsMultiplesourcesofnewjobs(peoplecanstartnewjobs)Interactivityisrestored

Page 38: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Historyofoperatingsystems

•OSstartedoutverysimple• Becamecomplextousehardwareefficiently

•ConsiderPCsandworkstations:• Isthemainassumption(hardwareisexpensive)stilltrue?

•HowdoesthisaffectOSdesign?• Don’tPCsneedtotimesharebetweenmultiplejobs?• Don’tPCsneedprotectionbetweenmultiplejobs?

PCsgraduallyaddedbacktime-sharingfeatures

EECS482– Lecture1January3,2018 38

Page 39: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

Whatabouttoday?

•Cloudcomputing(e.g.AmazonEC2)• Ishardwareexpensive?• WhatotherOSfeaturesareneeded?

•Mobilecomputing(e.g.,Android/iOS)• Whatdrivesefficiency?• WhatOSfeaturesareneeded?

EECS482– Lecture1January3,2018 39

Page 40: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

QuestionstoPonder

•Somewhatsurprisingly,OSescontinuetoevolve• WhatarethedriversofOSchange?• Newhardware,security,energy

•WhatispartofanOS?Whatisnot?• IsthewindowingsystempartofanOS?• OSresearchhasbecomeDist.Systemsresearch

EECS482– Lecture1January3,2018 40

Linuxvirtualmemorysystemoverhaul:https://www.theregister.co.uk/2018/01/02/intel_cpu_design_flaw/

Page 41: EECS 482 Introduction to Operating Systemsweb.eecs.umich.edu/~harshavm/eecs482/lec1_handouts/lec1-intro.pdf · EECS 482 Introduction to Operating Systems Winter2018 Baris Kasikci

TODOs

•Browsethecoursewebpage

•SubscribetoPiazza

•RegisteryourGitHubid

•Startfindingpartnersforprojectgroup(Jan22)

EECS482– Lecture1January3,2018 41