CMPU224– ComputerOrganizationJasonWaterman
CourseOverview
Today
• Coursetheme• Courselogistics• Fourrealities
2/16/21 CMPU224-- ComputerOrganization 2
Whatisthiscourseabout?
• UnderstandingComputerSystems• Thehardwareandsystemsoftwarethatworktogethertorunapplicationprograms
Mainmemory
I/O bridgeBus interface
ALU
Register fileCPU
System bus Memory bus
Disk controller
Graphicsadapter
USBcontroller
MouseKeyboard DisplayDisk
I/O bus
executable stored on disk
PC
Expansionslotsforotherdevicessuchasnetworkadapters
2/16/21 CMPU224-- ComputerOrganization 3
Whatahappenswhenaprogramruns?• Arunningprogramexecutesinstructions• Theprocessorfetchesaninstructionfrommemory• Decode:Figureoutwhichinstructionthisis• Execute:i.e.,addtwonumbers,accessmemory,checkacondition,jumptofunction,andsoforth• Theprocessormovesontothenextinstructionandsoon
Mainmemory
I/O bridgeBus interface
ALU
Register fileCPU
System bus Memory bus
Disk controller
Graphicsadapter
USBcontroller
Mouse Keyboard DisplayDisk
I/O bus
executable stored on disk
PC
Expansionslotsforotherdevicessuchasnetworkadapters
2/16/21 CMPU334-- OperatingSystems 4
2/16/21 CMPU224-- ComputerOrganization 5
Whatiscomputerorganization?
2/16/21 CMPU224-- ComputerOrganization 6
Application
Physics
Whatiscomputerorganization?
2/16/21 CMPU224-- ComputerOrganization 7
Application
Physics
Gaptoolargetobridgeinonestep
Whatiscomputerorganization?
2/16/21 CMPU224-- ComputerOrganization 8
Application
Physics
Gaptoolargetobridgeinonestep
Initsbroadestdefinition,computerorganizationisthedesignoftheabstraction/implementationlayersthatallowustoexecuteinformationprocessing applicationsefficientlyusingmanufacturingtechnologies.
Whatiscomputerorganization?
2/16/21 CMPU224-- ComputerOrganization 9
ApplicationAlgorithm
ProgrammingLanguageOperatingSystem
InstructionSetArchitectureMicroarchitecture
Register-TransferLevelGatesCircuitsDevicesPhysics
Whatiscomputerorganization?
2/16/21 CMPU224-- ComputerOrganization 10
ApplicationAlgorithm
ProgrammingLanguageOperatingSystem
InstructionSetArchitectureMicroarchitecture
Register-TransferLevelGatesCircuitsDevicesPhysics
CMPU-224ComputerOrganization
CourseTheme:AbstractionIsGoodButDon’tForgetReality• MostCScoursesemphasizeabstraction• Abstractdatatypes• Asymptoticanalysis
• Theseabstractionshavelimits• Especiallyinthepresenceofbugs• Needtounderstanddetailsofunderlyingimplementations
• Usefuloutcomesfromtaking224• Becomemoreeffectivesoftwaredevelopers
• Abletofindandeliminatebugsefficiently• Abletounderstandandtuneforprogramperformance
• Prepareforlater“systems”classesinCS• Compilers,OperatingSystems,Networks,ComputerArchitecture,ParallelProgramming
2/16/21 CMPU224-- ComputerOrganization 11
Today
• Coursetheme• Courselogistics• Fourrealities
2/16/21 CMPU224-- ComputerOrganization 12
WebsiteandTextbooks
• https://cs224.cs.vassar.edu• Completescheduleoflectures,exams,andassignments
• RandalE.BryantandDavidR.O’Hallaron (Required)• ComputerSystems:AProgrammer’sPerspective,ThirdEdition2016• http://csapp.cs.cmu.edu• Thisbookreallymattersforthecourse!
• Howtosolveassignments• Practiceproblemstypicalofexamproblems
• BrianKernighanandDennisRitchie(Optional)• TheCProgrammingLanguage,SecondEdition1988• StillthebestbookaboutC,fromtheoriginatorsofthelanguage
2/16/21 CMPU224-- ComputerOrganization 13
CourseComponents
• Lectures• Higherlevelconcepts
• Assignments• Theheartofthecourse• 1-2weekseach• Providein-depthunderstandingofthematerial
• Exams(midterm+final)• Testyourunderstandingofconcepts&mathematicalprinciples
• Prerequisites(talktomeifyouhaven’tcompletedtheseclasses)• CMPU102
2/16/21 CMPU224-- ComputerOrganization 14
YourProfessor
• OfficeHours:• TuesdayandThursday3pm-5pm• VirtualOffice:Zoom• Ihaveanopendoorpolicy
• Ifmydoorisopen,feelfreetocomeinandtalktome
• Officehoursbyappointmentaswell–messagemeonslack
• Background• Research
2/16/21 CMPU224-- ComputerOrganization 15
Grading
• 30%Midterm• 40%Assignments• 30%Final
2/16/21 CMPU224-- ComputerOrganization 16
Attendance
• Ireallywanttoseeyouineachaneveryclassinpersonorremotely• We’llworkonproblemstogetherduringclassandlabs• I’llleavetimeforquestions
• OurclassesatVassararesmall• Comingtoclassisoneofthebestwaystolearnthematerial
2/16/21 CMPU224-- ComputerOrganization 17
ElectronicDevicesinClass
• Pleaseturnoffyourphoneorputin“donotdisturb”mode• It’sdistractingtoyouandyourclassmates• Ifyouwouldliketouseyourlaptopfortakingnotes• Youarewelcometodoso,butpleaseonlyuseitfornotes
• Theuseofelectronicdevicesfornon-classrelatedpurposesisstronglydiscouraged• Considerthisclasstobeanoasisfromyourdevice
2/16/21 CMPU224-- ComputerOrganization 18
CEQ’s• Givesmefeedbackabouthowthecourseisgoing• Awayforyouto“grade”thecourse
• Usedbythedepartmentandadministration• Mygoalistoearn“5s”fromeachandeveryoneofyou• IfIamnotlivinguptothoseexpectations,pleasecometalktomeASAP• Pleasedon’twaittilltheendofthecourse
• Helpmemakethecoursebetterforyouandyourclassmates
• IwillkeepworkinguntilIcanmeetthosegoals
2/16/21 CMPU224-- ComputerOrganization 19
StudentTeacherEngagedPedagogicalPartnership(STEPP)
• Pedagogicalpartnershipprogram• Semester-longfaculty-studentcollaboration• ANon-CSstudentobserverwillsitinandobserve• Opportunityformetoreceiveconstructivefeedbackonthecourse• Collaborativewithastudentpartnertoaddressteachinggoals
• Howyoucanhelp• ReachouttoMarkandshareyourfeedbackabouthowtheclassisgoing
MarkFossescaSecond-yearENSTmajor
2/16/21 CMPU224-- ComputerOrganization 20
• Allassignmentsareduebythedeadlinestatedontheassignmenthandout• Allstudentswillreceiveabudgetof5slipdaysforthecourse• Nomorethan2slipdayscanbeusedonanyassignment• Ifyouuseaslipdaythenewduedatewillbe24hoursfromtheoriginaldate• Slipdayscanonlyusedonassignment,notonthemidtermorfinals
SlipDays
2/16/21 CMPU224-- ComputerOrganization 21
• Ihopeeveryoneinthisclasswillremainhappyandhealthy• Ifyouhaveaseriouspersonalissue,talktoyouracademicadvisorassoonaspossible• Theyareequippedtocoordinateplansforgettingyoubackontrackinthisclassaswellasyourotherclasses• Iwillcooperatewithsuchplans,butIcannotconstructthemindependentlyoftheacademicadvisors
SeriousPersistentPersonalIssues
2/16/21 CMPU224-- ComputerOrganization 22
• Ifyouneedacademicaccommodations,pleasegetthehelpyouneed
• AcademicaccommodationsareavailableforstudentsregisteredwiththeOfficeofAccessibilityandEducationalOpportunity(AEO)
• Studentswhoneedaccommodationsshouldmeetwithmeearlyinthesemestertodiscusstheaccommodations
AcademicAccommodations
2/16/21 CMPU224-- ComputerOrganization 23
• Examsandassignmentsmustbethesoleworkofthestudentturningitin• Whatischeating?• Sharingcodeorotherelectronicfiles:eitherbycopying,retyping,lookingat,orsupplyingacopyofafilefromthisoraprevioussemester• Sharingwrittenassignmentsorexams:lookingat,copying,orsupplyinganassignmentorexam• Usingother’scodefromthisorpreviousofferingsof224orfromanyothersourcesuchascodefoundontheInternet
• UsingcodefromthetextbookorfromtheclasswebsiteisalwaysOK
AcademicIntegrity
2/16/21 CMPU224-- ComputerOrganization 24
LearningEnvironment
• Iamcommittedtoprovidingasafelearningenvironmentforallstudents
• Freefromallformsdiscriminationandsexualharassment
• Ifyouhaveexperiencedanyoftheseincidents• Youarenotalone• VassarCollegehasstaffmemberstrainedtosupportyou
2/16/21 CMPU224-- ComputerOrganization 25
Today
• Coursetheme• Courselogistics• Fourrealities
2/16/21 CMPU224-- ComputerOrganization 26
GreatReality#1:Ints arenotIntegers,FloatsarenotReals
• Example:isx2 ≥0?• Float’s:Yes!
• Int’s:• 40000*40000=1600000000• 50000*50000=??
2/16/21 CMPU224-- ComputerOrganization 27
Source:xkcd.com/571
GreatReality#2:You’veGottoKnowAssemblyandC
• Chancesare,you’llneverwriteprogramsinassembly• Compilersarebetterandmorepatientthanyouare
• But:Understandingassemblyiskeytomachine-levelexecutionmodel• Behaviorofprogramsinpresenceofbugs
• High-levellanguagemodelsbreakdown• Tuningprogramperformance
• Understandoptimizationsdone/notdonebythecompiler• Understandingsourcesofprograminefficiency
• Implementingsystemsoftware• Compilerhasmachinecodeastarget• Operatingsystemsmustmanageprocessstate
• Creating/fightingmalware• x86assemblyisthelanguageofchoice
2/16/21 CMPU224-- ComputerOrganization 28
GreatReality#3:MemoryMattersRandomAccessMemoryIsanUnphysicalAbstraction
• Memoryisnotunbounded• Itmustbeallocatedandmanaged• Manyapplicationsarememorydominated
• Memoryperformanceisnotuniform• Cacheeffectscangreatlyaffectprogramperformance• Adaptingprogramtocharacteristicsofmemorysystemcanleadtomajorspeedimprovements
2/16/21 CMPU224-- ComputerOrganization 29
CachesMatter
Mainmemory
I/ObridgeBusinterface
ALU
Registerfile
CPUchip
Systembus Memorybus
Cachememories
2/16/21 CMPU224-- ComputerOrganization 30
MemorySystemPerformanceExample
• Hierarchicalmemoryorganization• Performancedependsonaccesspatterns• Includinghowstepthroughmulti-dimensionalarray
2/16/21 CMPU224-- ComputerOrganization 31
void copyji(int src[2048][2048],int dst[2048][2048])
{int i,j;for (j = 0; j < 2048; j++)
for (i = 0; i < 2048; i++)dst[i][j] = src[i][j];
}
void copyij(int src[2048][2048],int dst[2048][2048])
{int i,j;for (i = 0; i < 2048; i++)
for (j = 0; j < 2048; j++)dst[i][j] = src[i][j];
}
81.8ms4.3ms 2.0GHzIntelCorei7Haswell
GreatReality#4:There’smoretoperformancethanasymptoticcomplexity• Constantfactorsmattertoo• Andevenexactoperationcountdoesnotpredictperformance• Easilysee10:1performancerangedependingonhowcodewritten• Mustoptimizeatmultiplelevels:algorithm,datarepresentations,procedures,andloops
• Mustunderstandsystemtooptimizeperformance• Howprogramscompiledandexecuted• Howtomeasureprogramperformanceandidentifybottlenecks• Howtoimproveperformancewithoutdestroyingcodemodularityandgenerality
2/16/21 CMPU224-- ComputerOrganization 32
WelcomeandEnjoy!
2/16/21 CMPU224-- ComputerOrganization 33