Lecture Programming in C++ - Chapter 1: Computing fundamentals. In this chapter we will discuss: History of electronic computers, John von Neumann, architecture, schematic, main memory, memory access, central processing unit, mass storage devices,...
Chapter 1 – Computing Fundamentals History of Electronic Computers First computer – ABC (Atanasoff Berry Computer) at Iowa State U – 1930’s – Solved large numbers of simultaneous equations First “allpurpose” computer – ENIAC (Electronic Numeric Integrator And Calculator) – Main idea developed from ABC notes Both had set wiring –data was input to memory Lesson 1.1 John von Neumann Mathematician Proposed alternative to “hard wiring” Introduced concept of stored program instructions – Both data and instructions were stored – Led to development of multipurpose computers Lesson 1.1 Computer Categories Supercomputers Mainframe computers Workstations Personal computers (microcomputers) Laptops More powerful than ENIAC Palmtops Speed and size! Lesson 1.1 Architecture Four main parts – – – – CPU (central processing unit) Main memory Controllers Peripheral devices Hardware – Electronic and mechanical devices integrated or connected to computer Lesson 1.2 Schematic Motherboard CPU Arithmetic Logic Unit Register Register Register Control Unit Peripheral Devices Lesson 1.2 Main Memory Controllers Main Memory Stores information to be process or instructions to be executed Information stored in bits (binary digits) – – – – Two states: on or off Byte is 8 bits (character of information like ‘b’) Grouped into packets called cells or words Bit pattern is code Lesson 1.2 Memory Sizes Represented by 2 raised to a power Trillion 1,099,511,627,776 Billion 1,073,741,824 Million 1,048,576 Thousand 1,024 240 = terabyte 230 = gigabyte 220 = megabyte 210 = kilobyte 23 = 8 bits (byte) Lesson 1.2 Memory Access RAM – Random access memory – Allows access to cells in no particular order – Volatile ROM – Read only memory – Cannot be modified by user – Information is permanent (nonvolatile) Serial access – Sequence of cell followed to extract information Lesson 1.2 Central Processing Unit (CPU) Control Unit – Controls activities of CPU – Directs flow of instructions – Communicates with ALU Registers – Rapid access memory cells ArithmeticLogic Unit (ALU) – Arithmetic operations – Logic operations (compares, etc) Lesson 1.2 Data Representation Each bit is either on or off, 1 or 0 ASCII code – 8 bits make a byte Integers represented by base 2, binary system – Each place position is power of 2 (23+22+21+20) Two other number systems used – Octal (powers of 8) – Hexadecimal (powers of 16) Lesson 1.4 Memory Addresses Every memory cell needs to be addressed Binary code represent address of cell One cell can contain address of another memory cell Lesson 1.4 Programming Languages Assembly language – One level above machine language Highlevel language – Designed to simplify writing programs – Four types Procedural (imperative) Functional Declarative Object oriented Lesson 1.5 Software Set of instructions read into computer’s memory and later executed on demand Two types – System Operating systems Utility programs Language translators – Application Lesson 1.6 Operating System Software Software written into memory upon startup Interface between user, computer and peripherals Two categories – Multipleuser computers – Singleuser computers Lesson 1.6 Utility Programs Perform basic operations necessary for performance of computer system – File operations creating, copying, saving deleting, merging, sorting Encapsulated with operating systems Lesson 1.6 Language Translators Convert programmermade instructions (source code) into machinelanguage instructions (object code) Three types – Assemblers: Convert assembly language programs to object code – Interpreters: Converts an instruction to object code then executes it – Compilers: Converts entire program to object code Lesson 1.6 Integrated Development Environment (IDE) Full package – Compiler – Text editor – Debugging tools Allows creation, repeated execution and modification of a program – Helps find violations of language rules Lesson 1.6 Application Software Many types exist Examples of common types – – – – Games Word processing Database management Graphics Program solves practical problem or does specific tasks Lesson 1.6 Software Engineering Describes process of software development Process involves many steps (Figure 1.10) – – – – – – Definition of problem Design scheme (breaking into modules) Coding modules Testing Program never “done” Assemble modules Test until working correctly Lesson 1.7 Structured Programming Topdown design – Defines all tasks program is to perform Tasks separated and functions developed – Can be designed separately – Two types Library – Included in C++ development environment Programmerdefined – Custom made by user Lesson 1.7 Development of C++ Language Middle 1980s at Bell Laboratories Bjarne Stroustrup Improvement upon C language Standardized in 1997 – American National Standards Institute (ANSI) – International Standards Organization (ISO) Objectoriented Lesson 1.7 C++ Development Environment Primary goal to produce executable file – Machine language instructions Allows user to – – – – Create source code Test it Modify it Convert it to executable format Lesson 1.7 C++ IDE Operations Editing text to create source code Preprocessing source code Compiling source code and code attached by preprocessor Linking object code generated in step 3 with other object code Lesson 1.7 Summary Learned about: Computer history Basic computer architecture How bits are stored Differences between programming languages Software engineering C++ language background Using IDE to create executable programs Chapter 1 ... – – Definition of problem Design scheme (breaking into modules) Coding modules Testing Program never “done” Assemble modules Test until working correctly Lesson 1.7 Structured Programming Topdown design... – Singleuser computers Lesson 1.6 Utility Programs Perform basic operations necessary for performance of computer system – File operations creating, copying, saving deleting, merging, sorting... Peripheral Devices Lesson 1.2 Main Memory Controllers Main Memory Stores information to be process or instructions to be executed Information stored in bits (binary digits) – – – – Two states: on or off