IntroductionChapter0:Introduction•Computerscienceisthedisciplinethatseekstobuildascientificfoundationforsuchtopicsas–computerdesign–computerprogramming–informationprocessing–…etc.•Computerscienceprovidestheunderpinningsfortoday’scomputerapplicationsaswellasthefoundationsfortomorrow’sapplications.Algorithms:Definitions•Algorithm–asetofstepsthatdefineshowataskisperformed.•Program–arepresentationofanalgorithm.•Programming–theprocessofdevelopingaprogram.•Software–programs+algorithms.•Hardware–machinery:whateverisn’tsoftware.ComputerHistoryWhatiscomputer??AnAbacusOriginsofComputingMachines•Earlycomputingdevices–Abacus:positionsofbeadsrepresentnumbers01600s-1800s機械式(轉輪)積體電路•積體電路可以分為以下幾類:–小規模積體電路(SSI英文全名為Small-ScaleIntegration,幾十個邏輯閘以內)。–中規模積體電路(MSI英文全名為Medium-ScaleIntegration,幾百個邏輯閘)。–大規模積體電路(LSI英文全名為Large-ScaleIntegration,幾萬個邏輯閘)。–超大規模積體電路(VLSI英文全名為Very-large-scaleintegration,幾十萬個邏輯閘以上)。–甚大規模積體電路(ULSI英文全名為Ultra-LargeScaleIntegration,百萬個邏輯閘以上)。•Earlycomputingdevices–Gear-basedmachines(1600s-1800s)•Positionsofgearsrepresentnumbers•BlaisePascal,WilhelmLeibniz,CharlesBabbage(progressionofflexibility)•BlaisePascal–1623-1662,France–PascalMachine•Additionalgorithm•CharlesBabbage’sMachine(1792-1871)–Printoutputvaluesonpaper–Programmable•HisassistantAugustaAdaByronisoftenidentifiedtodayastheworld’sfirstprogrammer.–PunchedCard•IdeafromJacquardLoomin1801TheLondonScienceMuseum'sreplicaAssembledafterhisdeathbyBabbage'sson,usingpartsfoundinhislaboratory.PunchedCards•Earlydatastorage:punchedcards–FirstusedinJacquardLoom(1801)tostorepatternsforweavingcloth–StoredprogramsinBabbage’sAnalyticalEngine–Popularthroughthe1970’sJacquardLoomJacquardLoomPunchedCardsEarlycomputers•Basedonmechanicalrelays(繼電器)–1940:ModelK:StibitzatBellLaboratories–1944:MarkI:HowardAikenandIBMatHarvard•Basedonvacuumtubes(真空管)–1937-1941:Atanasoff-BerryComputer(ABC)atIowaState•Thefirst“computer”,NOCPU,DRAM–1940s:Colossus:secretGermancode-breaker•DecodeGermanmessagesduringthelatterpartofWorldWarII–1940s:ENIAC:Mauchly&EckertatU.ofPenn.MarkI,ASCC•HowardAiken,IBMatHarvard,1944–ASCC是由開關、繼電器、轉軸以及離合器所構成。–它使用了765,000個元件–組裝大小為16公尺長,2.4公尺高,2呎深。–重達4500公斤。–其基本計算單元使用同步式機械,所以它有一跟長15公尺的傳動軸,並由一顆4千瓦的馬達所驅動。–馬可一號可以儲存72組數據,每組數據有23位十進位數字。每秒可執行3次加法或是減法。一個乘法則須6秒,一個除法須15.3秒,計算一個對數或是一個三角函數需花費超過一分鐘。–打卡紙讀取、執行每一道指令。TheMarkIcomputer電腦的演進•1642巴斯卡加法器•1804法國織布工人查卡得發明能用不同打孔卡片自動來編織圖案的織布機•1822英國劍橋大學的巴貝奇發明差分機,可做簡單的四則運算•1833巴貝奇建造分析機失敗,但分析機構想已具有今日電腦的基本結構,巴貝奇因而有「電腦之父」的尊稱。•1886美國何樂里設計出以打孔卡片來儲存資料的計算機器•1906美國費樂斯(Forest)發明了真空管電腦之父—巴貝奇(babbage)巴貝奇的差分機范紐曼(VonNeumann)電腦的演進•1939美國愛荷華州立大學製造出第一部電腦ABC•1946美國賓州大學和軍方合作製造出ENIAC電腦,范紐曼提出內儲程式的觀念,被譽為「電子電腦之父」•1947美國貝爾實驗室發明了電晶體•1949英國劍橋大學完成第一部大型內儲程式電腦EDSAC•1951美國SperryRand公司生產UNIVAC-1,第一部大量製造的商業電腦電腦的演進(cont.)•1954美國貝爾實驗室製出第一台以電晶體為主要元件的電腦(TRADIC)•1958美國德州儀器公司發明了積體電路(ICIntegratedCircuit•1964美國國際商業機器公司(IBM)用IC為主元件開發出System360電腦•1970開始有電腦使用超大型積体電腦(VLSI)電腦的演進(cont.)•1971美國Intel公司發表第一個微處理機4004•1977美國Apple公司推出APPLEII電腦:採封閉性硬体系統架構。•1981美國IBM公司推出個人電腦,稱為IBMPC:採開放性硬体系統架構,造成IBM相容型電腦的大量生產。•1993,PentiumEDSAC–1949劍橋大學真空管為元件的電腦APPLEIIIBMcomputer•1981Chapter1DataStorageChapter1:DataStorage1.1BitsandTheirStorage1.2MainMemory1.3MassStorage1.4RepresentingInformationasBitPatterns1.5TheBinarySystem1.6StoringIntegersChapter1:DataStorage(continued)1.7StoringFractions1.8DataCompression1.9CommunicationsErrorsBitsandtheirmeaningBit=BinaryDigit=asymbolwhosemeaningdependsontheapplicationathand.SomepossiblemeaningsforasinglebitNumericvalue(1or0)Booleanvalue(trueorfalse)Voltage(highorlow)BitpatternsAlldatastoredinacomputerarerepresentedbypatternsofbits:NumbersTextcharactersImagesSoundAnythingelse…BooleanoperationsBooleanoperation=anyoperationthatmanipulatesoneormoretrue/falsevaluesCanbeusedtooperateonbitsSpecificoperationsANDORXORNOTFigure1.1TheBooleanoperationsAND,OR,andXOR(exclusiveor)GatesGates=devicesthatproducetheoutputsofBooleanoperationswhengiventheoperations’inputvaluesOftenimplementedaselectroniccircuitsProvidethebuildingblocksfromwhichcomputersareconstructedFigure1.2ApictorialrepresentationofAND,OR,XOR,andNOTgatesaswellastheirinputandoutputvaluesFlip-flopsFlip-flop=acircuitbuiltfromgatesthatcanstoreonebitofdata.Hasaninputlinewhichsetsitsstoredvalueto1Hasaninputlinewhichsetsitsstoredvalueto0Whilebothinputlinesare0,themostrecentlystoredvalueispreservedFigure1.3Asimpleflip-flopcircuitFigure1.4Settingtheoutputofaflip-flopto1Figure1.4Settingtheoutputofaflip-flopto1(cont’d)Figure1.4Settingtheoutputofaflip-flopto1(cont’d)Figure1.5Anotherwayofconstructingaflip-flopOtherstoragetechniquesDynamicmemory–mustbereplenishedperiodically–Example:capacitorsVolatilememory–holdsitsvalueuntilthepoweristurnedoff–Example:flip-flopsNon-volatilememory–holdsitsvalueafterthepowerisoff–Example:magneticstorageRead-onlymemory(ROM)–neverchanges–Examples:flashmemory,compactdisksHexadecimalnotationHexadecimalnotation=ashorthandnotationforstreamsofbits.Stream=alongstringofbits.Longbitstreamsaredifficulttomakesenseof.Thelengthsofmostbitstreamsusedinamachinearemultiplesoffour.Hexa