ìComputer Systems and NetworksECPE170– JeffShafer– UniversityofthePacific
LinuxBasics
Pre-Lab
ì EveryoneinstalledLinuxontheircomputer
ì Everyonelaunchedthecommandline(“terminal”)andranafewcommands
ì Whatproblemswereencountered?ì Virtualizationsupportinprocessornotenabled(BIOS)ì VMWare Player(currentversion)onlyrunsonWindows64ì 3Dgraphicsvirtualizationincompatiblewithspecifichardwareì Oldvirtualmachinesoftwareì Others?
ì Tip:IfyouhaveproblemsmaximizingyourVMtofullscreen,ordoingcopy-and-pastebetweenLinuxandWindows,makesureyouinstalledtheVMtools
Spring2017ComputerSystemsandNetworks
2
Person of the Day: Linus Torvalds
ì Creatorof LinuxKernelì Startedin1991ì Firstdeveloper– hobby
project(forfun!)ì Modernkernelisproductof
workbythousandsofprogrammers
ì Currently“finalauthority”onwhatisincludedinthekernel
ì CreatorofGit versioncontrolsystemì InitiallyforLinuxkerneldev
Spring2017ComputerSystemsandNetworks
3
Operating System Tasks
ì WhatdoestheOSneedtodo?ì Scheduleprocessestorunì Memorymanagementì Interrupthandling(managehardwareingeneral)ì Security(betweenprocesses)ì Networkaccessì Storagemanagement(filesystem)ì Graphicaluserinterface
ì MaybeamiddlewarelayerontopoftheOS
Spring2017ComputerSystemsandNetworks
4
Operating Systems – Processes
ì Processmanagementisakeyoperatingsystemtask
ì OSmustinitiallycreateprocesses whenyourunyourprogram
ì OScanallowprocessestoaccessresourcesì Mustschedule accesstoshared resources(e.g.,CPU)
ì OScanallowprocessestocommunicate witheachother
ì OSmustcleanupafterprocessfinishesì Deallocate resources(e.g.memory,networksockets,file
descriptors,etc…)thatwerecreatedduringprocessexecution
Spring2017ComputerSystemsandNetworks
5
Operating Systems – Scheduling
ì Theoperatingsystemschedulesprocessexecutionì Whatprocessesareallowedtorunatall?ì Whatprocessesareallowedtorunrightnow?
ì ContextswitchesoccurwhentheCPUistakenfromoneprocessandgiventoanotherprocessì CPUstate(registers,currentPC,etc…)ispreserved
duringacontextswitch
Spring2017ComputerSystemsandNetworks
6
Operating Systems – Scheduling
ì PreemptiveSchedulingì Eachprocessisallocatedatimeslice.ì Whenthetimeslice expires,acontextswitchoccurs
ì Acontextswitchcanalsooccurwhenahigher-priorityprocessneedstheCPU
Spring2017ComputerSystemsandNetworks
7
Operating Systems – Security
ì ProcessAisforbiddenfromreading/modifying/writingthememoryofProcessBì Virtualmemory isahugehelphere!ì Eachprocesshasaseparatevirtual addressspacethat
mapstodifferentregionsofphysicalmemory
ì ProcessAhasotherlimitsbesideswhichmemorypagesitcanaccessì Whataresomeotherlimits?ì Amountofmemoryconsumedì Numberofopenfilesondiskì Whichfilesondiskcanberead/written
Spring2017ComputerSystemsandNetworks
8
Operating Systems – Filesystem
ì OSisresponsibleformanagingdataonpersistentstorage
ì Jobofthefilesystem!ì Whatfilesexist?(i.e.names)ì Howaretheyorganized?(i.e.paths/folders)ì Whoownsandcanaccessthem?(i.e.usernames,
permissions)ì Whereareindividualfileblocksstoredonthedisk?
ì i.e.filename“database.dat”isreallycomposedof15823blocks,ofwhichblock1islocatedatlogicalblockaddress#...ontheharddrive.
Spring2017ComputerSystemsandNetworks
9
Operating Systems – Device Management
ì Managedevicesì HowdowesenddatatotheNICfortransmission?ì Howdowerenderanimagefordisplayonscreen?ì HowdowereadablockofdatafromourRAIDdisk
controller?
ì Operatingsystemscanbeextendedthroughdevicedrivers tomanagenewhardwareì Hardwarevendorswritesoftwaretomanagetheirdevicesì OSprovidesafixedinterface(API)thatdrivermustfollow
ì Commontaskforadevicedriverisrespondingtointerrupts(fromthatdevice)
Spring2017ComputerSystemsandNetworks
10
Operating Systems – The Kernel
ì Whodoesallthisessentialworkintheoperatingsystem?(besidestheGUI)ì Thekernel (i.e.theheartorcoreoftheOS)
ì Kernelperforms:ì Schedulingì Synchronizationì Memorymanagementì Interrupthandlingì Securityandprotection
Spring2017ComputerSystemsandNetworks
11
Operating Systems – GUI
ì Operatingsystemswithgraphicaluserinterfaces(GUI)werefirstbroughttomarketinthe1980s
AppleMacOS1.0(released1984)
MicrosoftWindows1.0(released1986)
Capturesfromhttp://www.guidebookgallery.org/screenshots
Spring2017ComputerSystemsandNetworks
12
Spring2017ComputerSystemsandNetworks
13
ì SignificantevolutioninGUIdesigninsubsequentdecades
Operating Systems – GUI
ì Technicalperspective:ì TheGUIisoneoftheleastimportantpartsofthe
operatingsystem
ì AGUIdoesnotevenhavetobepartofthetrue OSatallì Windows1.0wasjustaprogramthatranontopof
MS-DOS,thetrue operatingsystem(ofthatera)
ì Buttoauser,theGUIisoneofthemostimportantpartsoftheOS!
Spring2017ComputerSystemsandNetworks
14
Command-LineAdvantagesofCommandLine
AdvantagesofWindows/GUI
Spring2017ComputerSystemsandNetworks
15
ìLinux Command Line
Spring2017ComputerSystemsandNetworks
16
Shell
ì Whatistheshell?(e.g.BASH,CSH,SH)ì Programbetweenuserandthekernelì Command-lineinterpreter
ì Parsesuserinputandcarriesoutcommands
Spring2017ComputerSystemsandNetworks
17
Shell Shortcuts
ì <TAB>keytoauto-completecommands
ì <UPARROW>keytocyclethroughpreviouscommands
Spring2017ComputerSystemsandNetworks
18
Thesetwotipsmakeyourlifesomucheasier!
Linux: Sudo Command
ì sudo <<command>>
ì Commandisrunasrootuser
ì root=“Administrator”
Spring2017ComputerSystemsandNetworks
19
http://xkcd.com/149/
Linux: Apt-Get Command
ì Whatisapackagemanager?ì Wheredidtheseappscomefrom?
ì apt-get <<mode>> <<options>>
ì apt-get install gedit
ì Mode=installapackageì Option=Gedit (nameofpackage)
ì MustrunasROOTtouse!ì sudo apt-get …
Spring2017ComputerSystemsandNetworks
20
Linux: Directory Tree
ì Absolutepath:ì /home/hpotter/thesis/intro.txt
ì Relative path:ì IfIamalreadyin/home/potter/ì addresses.html
Spring2017ComputerSystemsandNetworks
21
http://osl.iu.edu/~pgottsch/swc2/lec/shell01.html
ìLabs
Spring2017ComputerSystemsandNetworks
22
Labs
ì Labshave(atmost)twogradedelements:
1. Pre-Lab“checkpoint”– quickverificationthatpre-labappears tobedone1. Dueatstartoffirstdayoflab
2. LabReport1. Submitallsourcecodeusedwithlabreport2. Duebyposteddateafterlab
Spring2017ComputerSystemsandNetworks
23
Lab Reports
ì Notreally“reports”,morelike“worksheets”
ì CreateinLibreOffice (akaOpenOffice)usingexampletemplateonwebsite
ì ExportinPDFformat
ì Submitì ViaCanvasAssignments sectionforLab1only!ì ViaVersioncontrolforLab2andbeyond
Spring2017ComputerSystemsandNetworks
24
Upcoming Schedule
ì Todayì Lab1– LinuxBasics
ì Thursdayì Lab2– VersionControl
ì Deadlinesì Lab2pre-labcheckpoint– StartofclassThursdayì Lab1Report– Jan28th,2017by5am
ì SubmitviaCanvasì Lab2Report– Jan30th,2017by5am
Spring2017ComputerSystemsandNetworks
25