36
Computer Systems Organization Recitation CSCI-UA 0201-007 R01: Introduction & Environment Setup Many slides are based on John Westhoff’s Fall 2019 CSO recitation

Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at [email protected] - Include your name,

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

ComputerSystemsOrganizationRecitation

CSCI-UA0201-007

R01:Introduction&EnvironmentSetup

ManyslidesarebasedonJohnWesthoff’s Fall2019CSOrecitation

Page 2: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Beforewegetstarted

• Gotohttps://nyu-cso.github.io/labs/ andstartthedownloadfortheversionofVirtualBox relevanttoyou• StartthedownloadfortheclassVMimage

2

Page 3: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

LogisticsImportantthingsyoushouldknow

3

Page 4: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Whatisthisrecitationfor?

• Helpyoubetterunderstandthecoursecontents,includingbutnotlimitedto:- Reinforcethisweek’slecturecontent- Reviewpreviousweek’sassessment- Someexercisesmeanttohelpwiththelabs/assessments

• Makeusallsufferbyforcingusoutofbedearly

4

Page 5: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Wherewereleasecoursematerials

• Coursewebsite- https://nyu-cso.github.io/- Recitationslidesalsoonthecourseschedulepage

• NYUClasses- Zoomlinks/recording

• CampusWire- It’syourresponsibilitytoreadInstructor’sNoteonCampuswire- YouareencouragedtoaskquestionsonCampuswire

• GitHub- AlllabsarereleasedonGitHub- YouwillsubmitalllabsonbothGitHubandGradescope

• Gradescope- Weeklymini-quizonGradescope

5

Page 6: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Howtocontactus

• Don’tbeafraidtoaskquestions!• Ifyouhavegeneralquestionsaboutcoursecontentsorlabs

- AskonCampuswire- Cometoofficehours- Registerthein-personrecitation

• Ifyouwanttosendusaprivatemessage- [email protected]

- Includeyourname,yourGitHubusername,andyourNYUNetID

Ifyouwantmorepersonaltutorialorquestionanswering

6

Page 7: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Howarewegoingtoproceed?

• Forthefirsttwoweeks,wewillfocusonenvironmentsetups,usageofbasictools,etc.- Todaywewillcoverenvironmentrelatedsetups- Nextrecitationwillcoverprogrammingtools(6labs,bonus)

• Fromthethirdweek- Wewillreviewweeklyassessment,reinforcesomecoursecontents,exercisestoprepareforyourlabs

• WeeklyassessmentswillbedueFriday9pmEST- DoneonGradescope,doitearly- Nolatesubmission

7

Page 8: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

AcademicIntegrity

• Allworkmustbeyourown– donotcopyorevenlookatassignmentsdonebyothers- Don’taskStackOverflow orChegg forhelp- ifyouneedit,askus!- Don’thiresomeonetodoyourworkforyou

• WereservetherighttousesoftwareplagiarismdetectiontoolssuchasMoss• It’snotworththerisk,justdon’tcheatandmakeussad

8

Page 9: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

GettingStartedImportantthingsyoumustdo

9

Page 10: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Today’sTopics

• Settingupyourvirtualmachine• Settingupyourgit repositories• BasicUnixcommands• Programdevelopment• Editor(Sublime)• Versioncontrol(Git)

10

Page 11: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Today’sGoal

• Bytheendoftoday’srecitation,yourshould• Havetheclassvirtualmachineinstalled• HaveGitHubreadyforyoutosubmitwork

• Anaccount• Lab-1repository• Knowhowtosubmitassignments

11

Page 12: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Basicvirtualmachinesetup

• Followhttps://nyu-cso.github.io/labs/ instructionsto• DownloadVirtualBox 6.0.10• DownloadourVirtualBox image• LaunchVirtualBox andimporttheimage• LaunchLubuntu Linux

• Username“lab”,password“lab12345”

12

Page 13: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

AdvancedVMsetup

• Afterfinishingthebasicsetup,youaregoodtogo• Butifyouwantto• ResizetheVMwindowtofullscreennicely• CopyandpastebetweentheVMandyourlaptop• MovefilesbetweenyourlaptopandtheVM

• ThencheckourtheLabinstructionpage!• https://nyu-cso.github.io/labs/• Recommendit!

13

Page 14: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Attention: YouMUST testyourcodeinyourclassvirtualmachine• Werecommendyoutodoyourlabsinyourvirtualmachineweprovidetoyou,andtestitbeforesubmission• MoretoolsareavailablefordebugginginVM(gdb etc.)• Gradescope runsthesametestscript• Ingeneral,thereshouldbenosurprises

• Ifyouchoosetodoyourlabsoutsideoftheclassvirtualmachine,wewillnotprovideanytechnicalsupportshouldyouencounteranyOS-relatedissuesindoingthelabs

14

Page 15: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Openupaterminal

• Clickthe“LXterminal”icononthedesktop• ORclickstarticon(thebottomlefticon)• Click“SystemTools”andthen“LXterminal”

• ORusethekeyboardshortcut• Ctrl+Alt+T

• Tocopypasteinaterminal,youneedtouse• Ctrl+Shift+Ctocopy• Ctrl+Shift+Vtopaste• Orjustrightclick

15

Page 16: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

BasicCommands

• Someusefulcommandstoknow:• man• ls,cd,pwd,mkdir• cp,mv,rm• echo,cat• wc• grep• ctrl-c,ctrl-d,ctrl-z,fg,bg• |,>,<,>>• aptinstall/search• history,ctrl-r

16

Page 17: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

BasicCommands

• Wheneveryouwanttofindouthowtodosomethingusingcommandline,askGooglefirst• Hereisalinkcontainsusefulcommand,forbothbeginnersandexperiencedusers:• https://github.com/jlevy/the-art-of-command-line

17

Page 18: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Editor

• Youneedagoodeditortocodewithforproductivity• Populareditorsusedbyprogrammers:• vim• emacs• vscode• sublime

• WerecommendyouuseSublimeText• WhichshouldbealreadyinstalledontheVMimage

18

Page 19: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

SetupGitHub/lab1repo

• CreateaGitHubaccountifyoudon’thaveone• WehavecreatedforyouacorrespondingprivatelabrepositoryonGithub.com• EnrollyourselfintheGitHubclassroom• Createyourlab-1repositorybyclickingthelinkbelow

• https://classroom.github.com/a/RvmnAdGI• SelectyourNYUNetID

• Veryimportant!• Don’tselectsomeoneelse’sNetID!

• IfyoucannotfindyourNetID,letmeknow!

19

Page 20: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Git Overview

• Distributedversioncontrol system• Whatisversioncontrol?• Manageschanges todocuments,sourcefilesandothercollectionsofinformation

• Whyisversioncontrolindispensable?• Historytracking:trackcodechanges• Rollbacktoolderversion• Collaborate withothers(collaborativehistorytracking)

• Wearegoingtousethepopular“Git”asourversioncontrolsystem

Create things

Save things

Edit things

Savethethingagain

20

Page 21: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Youneedtoconfig git first!

• git config --globaluser.email “<YourEmail>”• git config --globaluser.name “<YourName>”• Youcanissue“git config --list”tocheckyourconfiguration• Here,the<YourEmail> shouldbetheoneassociatedwithyourGitHubaccount

21

Page 22: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Alistofgit commandsyouneed

• git clone• git status• git remote• git add<filename>• git commit-m<commitmessages>• git pushoriginmaster• git pullupstreammaster

22

Page 23: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Git Overview

• GitHub:• provideshostingforsoftwaredevelopmentandversioncontrolusingGit.

YourVM

Makechangeslocally

SubmitassignmentstoGitHub

PullassignmentsfromGitHub(clonelabrepo)

GitHub

23

Page 24: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Cloneyourlabrepolocally

• Incommandline,type:• mkdir cso-labs• cdcso-labs• git clonehttps://github.com/nyu-cso-fa20/clab-part1-<YourGithubUsername>.git lab1• Ifyoucopytheabovecommandtocommandline,don’tletthelinebreak• Replace<YourGitHubUsername>(includingtheanglebrackets)withyourGitHubusername.

• cdlab1

24

Page 25: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Git SetupTheremotecopyisstoredinsomeefficientformat

25

Page 26: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Acloserlookatyourlocalrepository

Localrepository26

Page 27: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

HowtointeractwithGit

• git addhello_world.c• Tellgit totrackchangestohello_world.c

• git commit• Storetrackedfileto.git

• git pushoriginmaster• Submitcommitstoyourremoterepository

27

Page 28: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Foreachnewassignment

• CreatelabrepoonGitHub(clicklink,selectyourself)• Cloneyourlabrepolocally

• cdcso-labs• git clonehttps://github.com/nyu-cso-fa20/clab-part1-<YourGithubUsername>.git lab1

• ThenmakechangeslocallyintheVM• Tellgit totrackchanges

• git addfilenames

• Commityourchanges• git commit-m“commitmessages”

• Pushtoyourremoterepository(onGitHub)• git pushoriginmaster

28

Page 29: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Git commit

• Whenyouissue“git commit”,youneedtoprovideamessagewhichisashortdescriptionofthechangesyoumade• Youcanuse“-m”optiontoprovidethecommitmessage• E.g.:git commit-m“myfirstcommit”

• Ifyoudon’tuse“-m”option,ancommandlineeditorwillpopupforyoutoeditthecommitmessage• Bydefault,nano

29

Page 30: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

HowtogetoutofNanoEditor

• ThedefaulteditoriscalledNano

• Toaddacommitmessagefromnano• Firsttypeinsomecommitmessage• HitCtrl+O tosaveyourcommitmessage(^meansCtrl)• HitCtrl+X toexit

30

Page 31: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Doublecheckwith“git status”

• Sometimes,youmightforgettodosome(orall)of• git add,git commit,git push

• It’salwaysgoodtocheckthestatusofyourrepository• git statustellsyou• Whatfilesaregoingtocommit• Whatfilesarenottracked• Whetheryouforgettopushcommitstoremote

31

Page 32: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

TriplecheckwithGitHub

• Stillnotsure/confidentaboutwhetherassignmentwassubmittedproperly?• Gotogithub.com,thengotoyourrepo• Manuallycheckifeveryfilecontainstheup-to-dateinformation

32

Page 33: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Git ismuchpowerfulthanthat

• Ourgit introductiononlycoversasmallpartofGit• Git tutorial:• https://www.atlassian.com/git/tutorials/what-is-versioncontrol• https://try.github.io/levels/1/challenges/1

33

Page 34: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Allthegit commandsyouneedforCSO

• Forbeginners,it’ssupereasytomessupGit• Aftersettinglabrepository,youONLYneedtousethefollwing gitcommands:• git addfilenames• git commit-m“commitmessage”• git pushoriginmaster• git cloneyour-lab-repolab• git status

Warning:unlessyouknowwhatyouaredoing,donotuseanyothergit commandsorgit commandflags

34

Page 35: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

Askthestaffforhelp

• Ifyoureallycannotfixconflictsorothergit problems,youshouldaskcoursestaffforhelp• Youneedtoemailthestafforattendofficehours

• Onlinemakesthingsharder..• Youshouldstartyourlabearlier

• Don’trandomlyissuecommandstofurthermessthingsup

35

Page 36: Computer Systems Organization Recitation - GitHub Pages · • If you want to send us a private message - Email cso-staff mailing list at cso-staff@cs.nyu.edu - Include your name,

ThingsyoushouldNEVER do

• Don’tusegit add*,git add.• Instead,youshouldalwaysspecifythefilenamesyouwanttocommit• Pleasedon’taddcompliedprogramstogit

• Don’tmodifyanyfileusingGitHubwebsite• Instead,youshouldalwaysmakechangeslocallyonyourlaptopandthenpushcommitstoGitHub• Otherwise,therewillbeconflicts,whichwillleadtosadness

36