Unformatted text preview:

COMP 14 Introduction to Programming…from Last TimeToday (ch. 1)Reading Check-UpHardware vs. SoftwareHardware OrganizationCentral Processing Unit CPUMain MemoryMain Memory With 100 CellsCPU and Main MemorySecondary StorageSlide 12Input DevicesOutput DevicesInput/Output DevicesHardware ComponentsOpening MS WordQuestionsSoftware CategoriesOperating System (OS)Application ProgramsSlide 22It’s All About DataAnalog vs. DigitalRepresenting Text DigitallyLanguage of a ComputerBit PermutationsSlide 28Binary NumbersDecimal to BinaryQuestions Binary NumbersStorage CapacityProgramming Languages EvolutionAssembly and Machine LanguageSlide 35From Java to Machine LanguageProblem SolvingAlgorithmProblem-Analysis-Coding-ExecutionAlgorithm Design ExampleResulting AlgorithmExerciseTo doWhat’s Ahead...COMP 14Introduction to ProgrammingMiguel A. OtaduyMay 12, 2004…from Last Time•Homework 1 due Tomorrow–Fill in form with personal info–Getting started with jGRASP–Compile and Run test programs–Any problems?–Disable test for new versionsToday (ch. 1)•Parts of the computer–hardware vs. software–CPU and memory•Binary numbers•What is an algorithm?Reading Check-Up1. - computer components including the CPU, main memory, I/O devices, and secondary storage2. - the brain of the computer, containing the CU, PC, IR, ALU, and ACC3. - computer instructions to solve a problem4. The digits 0 and 1 are calledor the shortened term hardwareCPUprogrambinary digitsbitsHardware vs. SoftwareA computer is made up of hardware and softwareHardwareSoftware• CPU- ex: 1 GHz Pentium III• input/output- keyboard- monitor- network card• main memory- ex: 256 MB RAM• secondary memory- ex: 20 GB hard drive• operating systems- Windows XP- Mac OS X• applications- games- Microsoft Word- Internet ExplorerHardware OrganizationmotherboardCPUmemoryhard driveCentral Processing UnitCPU•Control Unit (CU)–"the brain" of the CPU•Program Counter (PC)–points to the next instruction to be executed•Instruction Register (IR)–holds the currently executing instruction•Arithmetic Logic Unit (ALU)–carries out all arithmetic and logical ops•Accumulator (ACC)–holds the results of the operations performed by the ALUMain Memory•Ordered sequence of cells•AKA Random Access Memory (RAM)•Directly connected to the CPU•All programs must be brought into main memory before execution•When power is turned off, everything in main memory is lostMain MemoryWith 100 CellsEach memory cell has a numeric address, which uniquely identifies itCPU and Main MemoryChip that executesprogram instructions(processor)Primary storage areafor programs and datathat are in active use(RAM)All programs must be brought into main memory before executionSecondary Storage•Provides permanent storage for information•Retains information even when power is off•Examples of secondary storage:–Hard Disks–Floppy Disks–ZIP Disks–CD-ROMs–TapesSecondary StorageSecondary memorydevices providelong-term storageInformation is movedbetween main memoryand secondary memoryas neededInput Devices•Definition: devices that feed data and computer programs into computers•Examples:–Keyboard–Mouse–Secondary StorageOutput Devices•Definition: devices that the computer uses to display results•Examples:–Printer–Monitor–Secondary StorageInput/Output DevicesI/O devices facilitateuser interactionHardware ComponentsOpening MS Word•Use the mouse to select MS Word•The CPU requests the MS Word application•MS Word is loaded from the hard drive to main memory•The CPU reads instructions from main memory and executes them one at a time•MS Word is displayed on your monitorQuestions1. - points to the next instruction to be executed2. - a unique location in memory3. - stores information permanently4. Instructions executed by the CPU must be first loaded toprogram counter (PC)addresssecondary storagemain memorySoftware Categories•Operating System–controls all machine activities–provides the user interface to the computer–first program to load when a computer is turned on–manages computer resources, such as the CPU, memory, and hard drive–examples: Windows XP, Linux, Mac OS X•Application–generic term for any other kind of software–examples: word processors, missile control systems, gamesOperating System (OS)•OS monitors overall activity of the computer and provides services•Written using programming language•Example services:–memory management–input/output–storage managementApplication Programs•Written using programming languages•Perform a specific task•Run by the OS•Example programs:–Word Processors–Spreadsheets–GamesQuestionsClassify the following pieces of software as operating system or application:1. Microsoft Windows 20002. Microsoft PowerPoint3. Linux4. Your COMP 14 programsOSOSappappIt’s All About Data•Software is data–numbers, characters–instructions, programs•Hardware stores and processes data–read, write–add, subtract, multiply, divideAnalog vs. Digital•Analog–continuous wave forms–ex: sound, music on an audio tape•Digital–the information is broken down into pieces, and each piece is represented separately–represented as series of 0 and 1•0 - low voltage•1 - high voltage–can be copied exactly–ex: music on a compact discH i , H e a t h e r .72 105 44 32 72 101 97 116 104 101 114 46Representing Text Digitally•All information in a computer is digitized, broken down and represented as numbers.Corresponding upper and lower case Corresponding upper and lower case letters are separate characters.letters are separate characters.Language of a Computer•Machine language: the most basic language of a computer•A sequence of 0s and 1s–binary digit, or bit–sequence of 8 bits is called a byte•Every computer directly understands its own machine language–why can't Windows programs run on Apple computers?1 bit012 bits000110113 bits0000010100111001011101114 bits0000000100100011010001010110011110001001101010111100110111101111Each additional bit doubles the number of possible permutationsBit Permutations21 = 2 items22 = 4 items23 = 8 items24 = 16 items25 = 32 items1 bit ?2 bits ?3 bits ?4 bits ?5 bits ?How manyitems can berepresented byBit Permutations•Each permutation can represent a particular item•There are 2N permutations of N bits–N bits are needed to represent 2N unique itemsBinary Numbers•N


View Full Document

UNC-Chapel Hill COMP 14 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?