EECS 482 Introduction to Operating...

Post on 15-Aug-2020

5 views 0 download

Transcript of EECS 482 Introduction to Operating...

EECS 482Introduction to

Operating Systems

Winter 2018

BarisKasikcibarisk@umich.edu

(Thanks,HarshaMadhyastha fortheslides!)

January3,2018 EECS482– Lecture1 1

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

AboutYou

•Pleasetakeaselfieansendmenowtobarisk@umich.edu•Pleasecontacteecs482@umich.edu ifyouneedspecialarrangementforanydisabilities•Cometalktome• BBB4816,mydoorisalwaysopen• Anytimeaboutcareer,life,anydifficultiesyouarefacing,harddecisions,etc.• Duringofficehoursabout482

January3,2018 EECS482– Lecture1 3

EECS482Staff

• Instructors•GSIs&IAs

January3,2018 EECS482– Lecture1 4

AgendaforToday

•Whydoweneed482?

•Coursesyllabusandlogistics

•WhydoweneedanOSandwhatdoesitdo?

•HowdidOSesevolvetowhatwehavetoday?

EECS482– Lecture1January3,2018 5

Neuronstosilicon?

Ideas

High-LevelCode

MachineInstructions

Processors

Gates

EECS280,281(programming)

EECS483(compilers)

EECS370(comp.organization)

EECS270(digitaldesign)

EECS482– Lecture1January3,2018 6

Whatismissing?

•Bootstrapping:• Howdoesacomputerstartwhenyouturniton?• HowtogetaprogramintomemoryandhavetheCPUstartexecutingit?

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

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

EECS482– Lecture1January3,2018 7

Whatismissing?

•Bootstrapping:• Howdoesacomputerstartwhenyouturniton?• HowtogetaprogramintomemoryandhavetheCPUstartexecutingit?

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

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

EECS482– Lecture1January3,2018 8

YouwillbeabletoanswerallthesequestionsbytheendofEECS482

Objectivesofthisclass

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

•WewillstudydesignprinciplesofanOS• ThiscourseisnotaboutspecificsofanyparticularOS

•WewilldevelopanunderstandingofOSimpactonapplicationperformanceandreliability• WhatcausesyourprogramtocrashwhenyoudereferenceNULL?• Howcanmultithreadedcodebeslowerthansingle-threadedcode?

EECS482– Lecture1January3,2018 9

Prerequisites

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

• Stackpointer• Programcounter• Low-levelexecutionofaprogram• Etc.

•Someunderstandingofpaging,TLB,caching

January3,2018 EECS482– Lecture1 10

ClassHomepageandTools

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

EECS482– Lecture1January3,2018 11

LectureSchedule

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

EECS482– Lecture1January3,2018 12

Lectures

•2sections• Mostlysynchronized,examswillhaveafewdifferentquestions

• Lecturecaptured(videosonline)

•Slidesandlecturenoteswillbepostedonthewebpage

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

EECS482– Lecture1January3,2018 13

Lab/DiscussionSections

•OKtoattendanydiscussion• Aslongasthereareseats

Questionspostedseveraldaysinadvance• Dothembefore goingtoyoursection• Thispreparesyouwellforexams• Coverssomebackgroundknowledge

•NoDiscussionSessionsThisFriday!

EECS482– Lecture1January3,2018 14

Projects

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

•Firstisindividual,doothersingroupsof2-3• RegisteryourGitHubid– we’llassignrepositories• Declareyourgroup(by1/22)viacoursewebpage• Maileecs482@umich.edu iftaken482before• Can’treuseanycodeexceptforproject1.

EECS482– Lecture1January3,2018 15

Projectrecommendations

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

•We’llevaluateeverymember’scontributions• Peerfeedback• gitlogandGitHubstatistics

•Groupcanfireoneofitsmembers(seesyllabus)

EECS482– Lecture1January3,2018 16

ProjectsareHARD!

•ProbablythehardestclassyouwilltakeatUMintermsofdevelopmenteffort• Projectswilltake95%ofyourtimeinthisclass

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

EECS482– Lecture1January3,2018 17

Projectrecommendations

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

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

EECS482– Lecture1January3,2018 18

Policies

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

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

EECS482– Lecture1January3,2018 19

Exams(Tentative!)

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

•Final:April23th (7-9pm)

•Nomakeupexams• Unlessdirecircumstances• Makesureyouscheduleinterviewsappropriately• E-mailme(eecs482@umich.edu)withexceptions/conflicts

EECS482– Lecture1January3,2018 20

Gradingbreakdown

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

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

EECS482– Lecture1January3,2018 21

Enrollment

Musthaveprerequisites(281&370orequivalent)

Overrides• Currentlynearcapforcoursestaffing• Hopemanycanenrollduetonormalchurn

EECS482– Lecture1January3,2018 22

Protipsforsuccessin482

•Startearlyonprojects

• LeverageGitHubandcommunicatewithteam

•Takeadvantageofavailablehelp• Gotoofficehours,post/monitorquestionsonPiazza

•Attendlecturesanddiscussions• Readtextbook,solvequestionsbeforediscussion

•Askquestionswhensomethingisunclear

EECS482– Lecture1January3,2018 23

WhyhaveanOS?

•Whatifapplicationsrandirectlyonhardware?

•Problems• Portability• Resourcesharing

Applications

Hardware

EECS482– Lecture1January3,2018 24

WhatisanOS?

•Theoperatingsystemisthesoftwarelayerbetweenuserapplicationsandthehardware

•OSis“allthecodethatyoudon’thavetowrite” toimplementyourapplication

OperatingSystem

Hardware

ApplicationsVirtualMachineInterface

PhysicalMachineInterface

EECS482– Lecture1January3,2018 25

RolesoftheOS

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

•Government:Managesharedhardwareresources• Butatacost(taxes)

•ForanyareaofOS,ask• Whatinterfacedoeshardwarepresent?• WhatinterfacedoesOSpresenttoapplications?

EECS482– Lecture1January3,2018 26

OSandApps:2Perspectives

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

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

EECS482– Lecture1January3,2018 27

OSandApplications

•Perspective2:OSismainprogram• Callsapplicationsassubroutines• Illusion:everyapprunsonitsowncomputer

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

EECS482– Lecture1January3,2018 28

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

WhytakeanOSclass?- 2

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

•Softwaredevelopment• Designanabstraction• Makeitefficientlyusablebyothers

•Design-relatedinterviewquestions

January3,2018 EECS482– Lecture1 30

Historyofoperatingsystems

•Singleoperatoratconsole

•Positives:• Interactive• Verysimple

•Downside:• Poorutilizationofexpensivehardware

time

humanI/OCPUI/OhumanI/OCPU

EECS482– Lecture1January3,2018 31

Historyofoperatingsystems

•Batchprocessing(usingpunchcards)• Goal:ImproveCPUandI/Outilizationbyremovinguserinteraction

•OSisbatchmonitor+libraryofstandardservices•Protectionbecomesanissue• Whywasn’tthisanissueforsingleoperatoratconsole?

•Notinteractive

timeI/OCPUI/OCPUI/OCPU

EECS482– Lecture1January3,2018 32

January3,2018 EECS482– Lecture1 33

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

Historyofoperatingsystems

•Multi-programmedbatch• ImproveutilizationbyoverlappingCPUandI/O

time

P1:CPUDiskCPUPrint

P2:DiskCPUPrintCPUPrint

P3:DiskCPU

EECS482– Lecture1January3,2018 34

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

Historyofoperatingsystems

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

time

P1:CPUDiskCPUPrint

P2:UserCPUUserCPUUser

P3:User DiskCPU

EECS482– Lecture1January3,2018 36

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

Historyofoperatingsystems

•OSstartedoutverysimple• Becamecomplextousehardwareefficiently

•ConsiderPCsandworkstations:• Isthemainassumption(hardwareisexpensive)stilltrue?

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

PCsgraduallyaddedbacktime-sharingfeatures

EECS482– Lecture1January3,2018 38

Whatabouttoday?

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

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

EECS482– Lecture1January3,2018 39

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/

TODOs

•Browsethecoursewebpage

•SubscribetoPiazza

•RegisteryourGitHubid

•Startfindingpartnersforprojectgroup(Jan22)

EECS482– Lecture1January3,2018 41