Top Banner
Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August 26, 2019 China – Tianhe-2
52

Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Dec 26, 2019

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Introduction to Computer ScienceCSCI109

AndrewGoodneyFall2019

Lecture1:IntroductionAugust26,2019

China– Tianhe-2

Page 2: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Purpose of this Course

u Introducecomputerscienceasadiscipline,abodyofknowledge,andadomainofscience/engineeringv Thefocusisonideasandconceptsv Significantamountsofreadingbutnoprogramming(seeCSCI103L)

u Whatiscomputing,acomputer,science(andengineering)?u Howdocomputerswork?

v Computers,architectures,datastructuresandalgorithms,programming,operatingsystems,networks,abstractmachinesandtheory,artificialintelligence,robotics,humancomputerinteraction,…

u Whatiscomprisedwithinthedomainofcomputing?v Comprehendingitscontentandstructurev Appreciatingitspast,presentandfuture

u Provideabasisuponwhichyoucanbuildthroughouttheremainderofyourcomputingeducation

2

Page 3: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Purpose of this Course

3

Page 4: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Course Outline

4

Page 5: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

ìSurvey:https://tinyurl.com/y2cot2r5Password:CS109Fall2019

5

1.Howmanycollegelevelcomputerclasseshaveyoucompleted?a.0 b.1 c.2 d.3 e.4ormore

2.Howmanyyearsofcomputerprogramminghaveyoudone?a.0 b.1 c.2 d.3 e.4ormore

3.Howmanyprogramminglanguagesdoyouknow?a.0 b.1 c.2 d.3 e.4ormore

4.AreyoutakingCS103concurrentlywiththisclass?a.Yes b.No

5.YourreasonfortakingCS109isa. Requiredforyourcurrentmajororminor.b. Notrequiredforyourcurrentmajororminorbutisrequiredforamajororminoryouwanttoadd(ormoveto).

c. NotrequiredforyourcurrentmajororminornorforamajororminoryouareconsideringbutyouareinterestedinlearningaboutComputerScience.

Page 6: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

ìLogistics

6

Page 7: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Instructor and TAsu Instructor:AndrewGoodneyu Office:PHE406u OfficeHour: Seecoursewebsite

7

u ContactInfo:[email protected]

TeachingAssistants(TAs)

[email protected]

Office: TBDOfficeHour:TBD

Artem [email protected]

Office:TBDOfficeHour:TBD

Note:Officehoursstartnextweek!Seecoursewebsitefordetails.

Page 8: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Important Info

u Classv Location:SGM123 Days&Time:M12:00-13:50

uTherearenodiscussionorquizsectionsu Co-requisite:CSCI103L

v Thereisnoprerequisite

u RequiredTextbookv ComputingforOrdinaryMortals,St.Amant,R.OxfordUniversityPress,2013

u Syllabusisonhttp://bytes.usc.edu/cs109/u Slideswillbepostedon“bytes”uOtherreadingmaterialwillbemadeavailablethere

8

Page 9: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Homework (30%)

u Fourhomeworks (7.5%each)u Collaborationiswelcomeonthehomework

v Butcopyingisnotpermittedu Youareallowedatotaloftwolatedaysonthehomeworkv Onehomeworkmaybe2dayslate,ortwomaybe1daylate,withnopenalty

v Oncelatedaysareused,onedaylatereducesthescoreby25%,twodayslatereducesthescoreby50%,nocreditisgivenforthreeormoredayslate

v All4homeworks mustbesubmittedtoearnapassinggradeu Allhomeworksubmissionsmustbetyped

9

Page 10: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Quizzes (5%), Midterm (30%),Final (35%)

u ~8in-classquizzesuNocollaborationispermittedonthequizzesu Bestfivescoreswillberetainedsoquizzesareworth5%ofyourgrade

u 1midterm:worth30%ofyouroverallgrade

u 1finalexam(cumulative):worth35%ofyouroverallgrade

10

Page 11: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Quiz policy

Thereareabsolutelynomakeupquizzes.Ifyouneedtobeawayfromclasstoseeadoctor,ortoplayonasportsteam,themissedquizzesneedtocomefromyourquotaofthetwo‘allowedmisses.’Pleaseplanonthis.Ifyoumissquizzesearlierinthesemesterbecauseyoudon’tcometoclassfornogoodreasonandthenarefacedwithasituationlaterinthesemesterwhereyouneedtoseethedoctor,pleasedonotrequestamedicalexemption.Youshouldmarshalthequotaof‘allowedmisses’carefully.Thequizzeswillbeadministeredinclassbutitisimpossibletopredictexactlywhenduringthelecturetheywilloccur.Ifyoucometoclassafterthequizforthatdayhasbeenadministered(orleavebeforeitisadministered),youarenotentitledtoamakeuportohavethequizre-administeredforyou.

11

Page 12: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

How is the final grade assigned?

u Eachhomework,quizandexamreceivesarawnumericscoreu Bestfivequizscoresareretainedu Weightedcombinationofrawnumericscoresproducestotalrawscore(outof100)

u Thetotalrawscoreisnormalized– i.e.eachtotalrawscoreisdividedbythe95thpercentilerawscoreintheclass.ScoresareNOTrounded.

u Recentsemestershaveseenthe95th percentilescorebe~95%v Thismeanstocalculateyournormalizedscoreyoudivideyourrawscoreby.95

u Gradeboundariesdrawntogroupsimilarnormalizedscoresinsamefinalgradev Startingpointforboundariesis:>93:A,>90:A-,>87:B+,>83:B,>80:B-,>68:C,

>65:C-,>63:D+,>60:D,>55:D-

u Ifyou“need”aparticulargradeforthiscourse,thetimetoworryaboutthatisnow! 12

Page 13: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Other Misc. Itemsu Gradingdisputes/reviews

v Whenyouhomeworkisgraded,pleasereviewitinatimelymanner.Ifyouwouldlikeclarificationorreviewofagradeditem,youmaydosoinoneoftwoways:seetheTAsinofficehours(preferred)ormakean“instructorsonly”postonPiazza.Eitherway,youmustmakeanyrequestswithinoneweekofthehomeworkbeingreturned.

u DSPstudentsv IfyouhaveanaccommodationletterfromDSP,pleasee-mailittomeassoonas

possible.Specificaccommodationswillbediscussedinadvanceoftheexams.

u CECS->CSv IfyouwereaCECSstudent,andyouareswitchingtopureCS,pleaseletmeknow

(email)

u Piazzav https://piazza.com/usc/fall2019/csci109/v WeusePiazzaforadiscussionboard,pleaseuseittoaskforhelpwiththe

homeworkorothercourserelatedquestionsv Thisletsallstudentsseetheresponses=moreefficientthane-mail! 13

Page 14: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

ìWhat is a Computer?

14

Page 15: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Computer or Not?

15

Page 16: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Standard Definitions (dictionary.com)

u Anelectronicdevicedesignedtoacceptdata,performprescribedmathematicalandlogicaloperationsathighspeed,anddisplaytheresultsoftheseoperations

u Aprogrammablemachinethatperformshigh-speedprocessingofnumbers,aswellasoftext,graphics,symbols,andsoundv Allcomputerscontainacentralprocessingunit thatinterpretsandexecutesinstructions;

inputdevices,suchasakeyboardandamouse,throughwhich dataandcommandsenterthecomputer;memorythatenablesthecomputertostoreprogramsanddata;andoutputdevices,suchasprintersanddisplayscreens,thatshowtheresultsafterthecomputerhasprocesseddata

u Anelectronicdevicethatstoresandmanipulatesinformationv Unlikeacalculator,itisabletostoreaprogram andretrieveinformationfromitsmemory

u Amachinethatcanbeprogrammedtomanipulatesymbols

u Apersonwhocomputes;computist.v 1640s:“onewhocalculates”

16Aninformationtransformer

Page 17: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Types of Information

u Bits:0/1,T/F,True/False,Yes/Nov Andstringsofbits,suchas010110

u Numbers:5,101,-3,3.14159,i,πv Andnumericexpressions,suchas(3+2)

u Statementsinlogic:"x At(x,USC)Ù Person(x)Þ Smart(x)u Letters,words,sentences,paragraphs,articles,booksu Audio,imageandvideofilesu URLs(suchashttp://www/google.com)andwebpagesu Databasesu …

17

Page 18: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Binary

u Moderncomputersusebinaryarithmeticu Examples:

v 2410 =16+8=24 +23

=1 *24+1 *23+0 *22+0 *21+0 *20

= 110002v 9010 =64+16+8+2

=1 *26+0 *25+1 *24+1 *23+0 *22+1 *21+0 *20

=10110102v 101112 =1 *24+0 *23+1 *22+1 *21+1 *20

=16+4+2+1=2310

18

Page 19: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Information Transformation

u Convertonebodyofinformationtoanotherv Thatis,compute

u Example:Booleanalgebrav Informationexpressedinbits:0/1(orF/T)v Operationstransforminputbitstoyieldoutputbits

u AND,OR,NOT,…

19

AND 0 10 0 01 0 1

OR 0 10 0 11 1 1

NOT 0 11 0

XOR 0 10 0 11 1 0

AND(0,1)è 0 OR(0,1)è 1

AND(1,1)è 1 0OR(0,0)è

Page 20: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Information Transformation

20

AND 0 10 0 01 0 1

OR 0 10 0 11 1 1

NOT 0 11 0

Whatisthetruthtableforf(x,y)=AND(OR(x,y),NOT(AND(x,y)))?x y OR(x,y) AND(x,y) NOT(AND(x,y)) AND(OR(x,y),NOT(AND(x,y)))0 0 0 0 1 00 1 1 0 1 11 0 1 0 1 11 1 1 1 0 0

f 0 10 0 11 1 0

Page 21: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

CS Topic: representing numbers with binary

u Hereisourfirst“real”CStopic!u Getcomfortablewithlookingatbinarynumbers!u Nohard(easier?)thanbase10u Whybinary?

v Weuseelectroniccomputers(99.99999999%ofusanyway)v Circuitscanbeonoroff:twostates->binaryrepresentation

u Booleanoperationsandalgebraisonewayofcomputingwithbinarynumbers

u Firsthomework(andquiz)hasyoulookatbinarylogicandtransformingnumbersbase10<->base2

21

Page 22: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

More on Information Transformation

u Otherexamplesv Mathematicalcalculations– (10+2)/2=6– andlogicalproofsv Solvingpuzzlesv Sortinglists:4,2,1,3,6,5v Computationalthinkingv Transformingdataintoinsights(bigdata oranalytics)v Transformingknowledgeintodecisionsaboutwhatactionstoperformv Literary,musicalandartisticcomposition

u Hardware enablesimplementingtransformationsu Software (programs)control(s)transformationsu Algorithms areabstractdescriptionsoftransformations

22

Page 23: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Computational Thinking

u “thoughtprocessesinvolvedinformulatingproblemsandtheirsolutionssothatthesolutionsarerepresentedinaformthatcanbeeffectivelycarriedoutbyaninformation-processingagent” (Cuny,Snyder,Wing)

v wayofsolvingproblems,designingsystems,andunderstandinghumanbehaviorthatdrawsonconceptsfundamentaltocomputerscienceu Toflourishintoday'sworld,computationalthinkinghastobeafundamentalpart

ofthewaypeoplethinkandunderstandtheworldv creatingandmakinguseofdifferentlevelsofabstraction,tounderstandand

solveproblemsmoreeffectivelyv thinkingalgorithmically andwiththeabilitytoapplymathematicalconcepts

suchasinduction todevelopmoreefficient,fair,andsecuresolutionsv understandingtheconsequencesofscale,notonlyforreasonsofefficiency

butalsoforeconomicandsocialreasons

23

Humansthinking(i.e.,transforminginformation)todeviseproceduresforexecutionbyinformationtransformers(humanand/ormachine)

Page 24: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Computer or Not?

24

Page 25: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Implications

u Definingcomputersintermsoftheirfunctionality…v Stripsawayancillaryattributespreviouslythoughtessential

u Machine,electronic,speed,explicitprogrammability,…

v Enablesappreciatingthefullscopeofcomputersandcomputing

u Facilitatesrecognitionof“natural”computersv Brain:Thoughtispreeminentlyinformationtransformationv Embryonicdevelopment:BasedoninstructionswritteninDNAv Evolution:CombinesandmodifiesinformationinDNAv Immunesystem:Includespatternrecognizers,memory,…

25

DavidBaltimore:“Howbiologybecameaninformationscience”RichardDawkins:“Thedifferencebetweenlifeandnon-lifeisa

matternotofsubstancebutofinformation”

Page 26: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

ìComputer HistoryLooms,thediscretemachineabstraction,andthefirstcomputerprograms

26

Page 27: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

A History of Human-Built Computers

u Althoughcomputerscan(andhavebeen)builtusingallkindsofhardware,moderncomputingreallytookoffwiththeinventionofelectroniccomputerswhichwereprecededbymechanicalcomputers

u AhistoryofcomputingandtheJacquardLoomuMechanicalComputers

v TheDifferenceandAnalyticalEnginesv TheHollerithMachine

u ElectronicComputersv FromEDSACtotheMacbook

27

Reading:St.Amant: Introduction,Ch.1andCh.2

Page 28: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Before Mechanical Computers

Electroniccomputerswereprecededbymechanicalcomputersandmechanicalcomputerswereprecededby…

…looms

28

Page 29: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

A Simple Mechanical Loom

u Pressingtreadlescausesharnessestoliftthreadsu Theshuttleslidesacrossthreadundertheliftedthreadsu Thenthethreadsareloweredu Pressingtreadlescausesharnessestoliftthreadsu Theshuttleslidesacrossthreadundertheliftedthreadsu Thenthethreadsareloweredu Pressingtreadlescausesharnessestoliftthreadsu Theshuttleslidesacrossthreadundertheliftedthreadsu Thenthethreadsareloweredu …u Whatkindofpatternsdoesthisproduce?

29

Page 30: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Discrete Machines: State

uHowdoestheloombehaveasafunctionoftime?u Atanygiventimeasetofthreadsisraisedandtherestarelowered

uWritingdownthesequenceofraised(andlowered)threadstellsusthestepsthemachinewentthroughtoproducethecloth/tapestry/whatever

u Thepatternofraised(andlowered)threadsiscalledthestate ofthemachine

30

Page 31: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

CS Topic: State

u StateisaverycommonCSconceptu Herewehavethestateofaphysicalmachine

u InCSwetalkaboutthe“state”ofanobjectv Ofadatabasev Ofarobotv Ofa“state-machine”(finite,Turing,etc…)v Ofasystem(physicalorvirtual)v …

u Thenweneedawaytodescribethestatev Givesusthenotionofanencoding

31

Page 32: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

CS Topic: Discrete Machines, State and Encoding

u Choosingastaterepresentationtakesskill.Thestateshouldbev Parsimonious:itshouldbea“small”descriptorofwhatthemachineis

doingatanygiventimev Adequate:itshouldbe“bigenough”tocaptureeverything“interesting”

aboutthemachine

u Thesearesometimescontradictory.Theyarealsoqualitativeanddependonwhatbehaviorofthemachinewewanttodescribe

uUsuallyyouneedavocabulary(encoding)todescribestate.Inthecaseofaloom,statecanbeexpressedasabinarypattern(1forraised,0forlowered)

32

Page 33: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Discrete Machines: Abstraction

u Theloomisadiscretemachinev Stateisbinarypattern– i.e.discretev Thenotionoftimeisdiscrete– i.e.timeismodeledasproceedinginstepsor

finitechunks

uMoreprecisely,theloomcanbeusefullymodeledasadiscretemachinev Becauseofcoursebeingaphysicaldevicethereisvariation,nothingis

exactlyprecisev Butmodelingthemachineasdiscreetisgoodenoughandworksforthis

purpose

u Thisisanexampleofanabstraction – akeyconceptinComputerScience 33

Page 34: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

CS topic: Abstraction

u Oneofthefundamental“things”wedoinCSu Reducingordistillingaproblemorconcepttotheessentialqualitiesv Simplesetofcharacteristicsthataremostrelevanttotheproblem

u Many(most,all)ofwhatwedoinengineeringandcomputerscienceinvolvesabstractions

u Heretheabstractionismodellingtheloomasasimplediscreetstatemachinev Makesitpossibletounderstandv Andmakesitpossibleto“program”theloom

34

Page 35: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Weaving Complex Patterns

u Howtoproducemorecomplexpatterns?u Earlysolutionwashuman– thedrawloom

v Masterweavercallsoutwhichthreadstoliftv Drawboy liftsthreadsv Masterweaverthreadstheshuttlev Masterweavercallsoutwhichthreadstoliftv Drawboy liftsthreadsv Masterweaverthreadstheshuttlev Masterweavercallsoutwhichthreadstoliftv Drawboy liftsthreadsv Masterweaverthreadstheshuttlev …

35

Page 36: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The Jacquard Loom (1801): Mechanism

uMechanism:v Threadsattachedtospring-loadedrodsv Springsmakeallthreadswanttoliftunlessstoppedsomehow

v Ametal‘card’withholesisinsertedintothepathofthethreads

v Aholeinthecorrespondingplaceallowsathreadtolift.Noholearreststhethreadmotionandstopsitfromlifting

u TheJacquardLoom(fromtheTeachingPaletteviaYouTube)

36

Page 37: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The Jacquard Loom: Programming

uWeavingbecomestheprocessofv Creatingcardswithholesinthem(punchedcards)

v Sequencingthecardsintherightorder

u Eachcardisaninstruction tothemachinetodopreciselyonething(i.e.,putitselfintooneparticularstate)

u Asequenceofcards(i.e.,asequenceofinstructions)causesthemachinetostepthroughasequenceofstates.Thecardsequenceisaprogram

u Theweaverasaprogrammer37

JosephMarieJacquard(aswovenbyhisloomviaaprogramof24,000instructions).ImagecourtesyofWikipedia.

Page 38: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The Jacquard Loom: Programming

u Adiscrete,‘automatic’machineu Sincewehavechosenabinaryencodingthemachinestateisabinarynumber

u Eachinstruction isalsoabinarynumbersinceeachinstructionis(literally)thestatetheprogrammerwantsthemachinetobeinwhenthatinstructionisexecuted

u Theprogram forthemachineisasequenceofinstructions.Eachprogramis(literally)asequenceofstatestheprogrammerwantsthemachinetostepthrough

u Theprogram isthusasequenceofbinarynumbers38

Page 39: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

A Loom Program

000000000010000010

001000100000101000

000010000

000101000001000100

010000010000000000

39

0130

6840

16

4068

1300

u Thismachine’sstateiscapturedina9-bitword

u Eachinstructionintheprogramisalsoa9-bitword

u Thestateandeachinstructionisthus9bitswide

u Thisprogramis9instructionslong

Page 40: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Loom Program Limitations

uDoesnotscale:v Largeinstructions:Toprograma‘big’machineyouneed‘big’words(largestateimplieslargeinstructionwidths)

v Nocounting:Norepeatsorloopstodothingsoveracertainnumberoftimes(No“do..while”or“repeat..until”)

v Nomodularity:Nologicalchunksforsub-patternsthatcanbereusedwithoutreplication(No“functions,methods,subroutines…”)

uNodecisionmakingonthefly:v Nobranchingtodecidetodoonethinginsteadofanotherbasedonacondition(No“if-then-else”.Nojumpsor“goto”)

u SoistheJacquardloomacomputer? 40

Page 41: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

How Big/Fast is a Modern Computer?

u TypicalMacbook Prolaptophas~1billiontransistorsu Thestateofthemachineisabinarynumberwith~1billionbits(abinarywordofwidth~1billion)v NotpossibletoprogramaMacbook Probywritingasequenceofinstructionseach~1Billionbitswide

u AMacbook Proexecutes~5billioninstructionspersecondv Possible tohaveprogramsthatarebillionsofinstructionslongandyethavethemfinishoperatinginareasonabletime

41

Page 42: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Modern Computers?

u Ifmoderncomputersaresobig,howdoweprogramthem?u Wemodel(abstract)thecomputerassomethingmoresimple

u Programtothatmodel

u ThenletthehardwareandOSsortoutthedifferencebetweenrealityandourabstraction

u Thismethodofproblemsolvingisvery,verycommoninCS

u Morelaterinsemester

42

Page 43: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

ìComputer HistoryMechanicalcomputers:Thedifferenceandanalyticalengines,theHollerithmachine

43

Page 44: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The Difference Engine (1822)

u CharlesBabbageuMechanicalcalculator tocomputemathematicaltables

v Loom:programtransformsthreadstopatternsonclothv Differenceengine:programtransformsnumbersintoothernumbers

u PolynomialfunctioncomputationusingdifferencesuOutputwasviaa‘printer’– adevicethatproducedprinter’splatessotheycouldbestampedontopaper

uNobranchingorlooping,limitedinwhatitcouldcompute

44

VideofromYouTube.

Page 45: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The Analytical Engine (1837)

u CharlesBabbageuWorld’sfirstgeneralpurpose mechanicalcalculator

v Memoryv Arithmeticunitv Branchingv Looping

u ProgrammedbypunchedcardslikealoomuOutputwasviaa‘printer’– adevicethatproducedprinter’splatessotheycouldbestampedontopaper

45

VideofromYouTube.

Page 46: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The Hollerith Tabulator (1890)u HermannHollerithu Firstdevicetoreaddata intoamachine:an

electromechanicalsystembasedonpunchedcardsu BuilttotabulatetheresultsofUScensusu Hollerith'scontributionstomoderncomputingare...

"incalculable”v Hedidnotstopathisoriginal1890tabulatingmachineandsorter,but

producedmanyotherinnovativenewmodels.Healsoinventedthefirstautomaticcard-feedmechanism,thefirstkeypunch,andtookwhatwasperhapsthefirststeptowardsprogrammingbyintroducingawiringpanelinhis1906Type ITabulator,allowingittododifferentjobswithouthavingtoberebuilt!(The1890Tabulatorwashardwiredtooperateonlyon1890Censuscards.)Theseinventionswerethefoundationofthemoderninformationprocessingindustry.

u HollerithwentontoformtheTabulatingMachineCompany.MergedwithotherstoformtheComputingTabulatingRecordingCompany(CTR).Renamedin1924toInternationalBusinessMachines(IBM)

46

HermannHollerithandoneofhispunchedcards.ImagescourtesyofWikipedia.

Page 47: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The ENIAC (1943-46)

u ElectronicNumericalIntegratorAndComputer

u EckertandMauchly (UniversityofPennsylvania)

u Firstelectronic,generalpurposecomputer.Turing-complete,digital,reprogrammable(cumbersome)

u Vacuumtubeanddiode-based

47

Page 48: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

The EDVAC (1944-49)

u ElectronicDiscreteVariableAutomaticComputer(EckertandMauchly)

u Firststoredprogramcomputer,binary(ENIACwasdecimal).Operational1951.

u PopularizedbyvonNeumann(FirstDraftofaReportontheEDVAC)– firstreportonamoderncomputerarchitecture

48

Page 49: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Computer History Summary

49

u Althoughcomputerscan(andhavebeen)builtusingallkindsofhardware,moderncomputingreallytookoffwiththeinventionofelectroniccomputerswhichwereprecededbymechanicalcomputers

u AhistoryofcomputingandtheJacquardLoomuMechanicalComputers

v TheDifferenceandAnalyticalEnginesv TheHollerithMachine

u ElectronicComputersv FromEDSACtotheMacbook

Page 50: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Fundamental Concepts

uStateanddiscretemachinesuAbstractionandmodelsuEncodingdataandinstructionsuProgramminguTobegeneral,programsneedtoaccessamemory,andtobeabletocontroltheorderoftheinstructionstoexecutebasedontheresultsofcomputation

50

Page 51: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

Review of terms

uState:Theconditionofasystematapointintime

uEncoding:Symbolicexpressionusedtorepresentinformation

uDiscrete:Proceedinginfinitesteps,individuallyseparateanddistinct

uBinary:Numericalnotationthatusesbase2uAbstraction:Simplified(“higher-level”)description 51

Page 52: Introduction to Computer Sciencebytes.usc.edu/files/cs109/slides/CSCI109-Lecture1...Introduction to Computer Science CSCI 109 Andrew Goodney Fall 2019 Lecture 1: Introduction August

ìNext time: Computer ArchitectureHowarecomputersbuilt?

52