1 / 47

COS 131: Computing for Engineers

Chapter 1 Introduction to Computers and Programming. COS 131: Computing for Engineers. Laura Broussard, Ph.D. Professor. Solid Start to COS131. Use Syllabus! Course Content Requirements Questions?. Ch 1: Intro to Computers & Prog…. Background History of Computer Architecture

jovan
Download Presentation

COS 131: Computing for Engineers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1 Introduction to Computers and Programming COS 131: Computing for Engineers Laura Broussard, Ph.D. Professor

  2. Solid Start to COS131 • Use Syllabus! • Course Content • Requirements • Questions?

  3. Ch 1: Intro to Computers & Prog… • Background • History of Computer Architecture • Computing Systems Today • Executing a MATLAB Program • Problem Solving

  4. I. Background • Advances in technology need 2 things: • A visionary with a new idea • Engineers who find or invent tools to make it a reality.

  5. I. Background • Pace of change increasing • Computer science! • COS131 teaches the basics of computer programming using the programming language: MATLAB

  6. I. Background • Learning a programming language is like learning a foreign language. • For a foreign language, you master: • Vocabulary (words) • Grammar (sentences, paragraphs) • Practice, practice, practice!

  7. I. Background • Learning a programming language is like learning a foreign language.

  8. Ch 1: Intro to Computers & Prog… • Background • History of Computer Architecture • Computing Systems Today • Executing a MATLAB Program • Problem Solving

  9. II. A Brief History of Computing • Three important “events” that define modern computing (Smith): • The Difference Engine (1854) • Colossus (1942-45) • Von Neumann architecture (1945)

  10. II. A Brief History of Computing The Difference Engine - 1854 Charles Babbage, (1791-1871) Cambridge University Mathematician Philosopher Inventor Mechanical Engineer • Specific problem: Human calculation of log and trig tables gave too many errors. • Babbage designed the Difference Engine to do accurate calculations • The first computer • Decimal, programmable, mechanical • Babbage didn’t build it (lack of funds) • Babbage: a “father” of the computer • Ada Lovelace: the first programmer

  11. II. A Brief History of Computing The Difference Engine - 1854 • Babbage never built his DE • 1991 - SM of L built one to original spec’s • It worked! Babbage’s Difference Engine Science Museum of London 1991 Implementation

  12. II. A Brief History of Computing The Colossi Computers - WW II Max Newman Mathematician Government Code & Cypher School Bletchley Park Tommy Flowers Engineer Post Office Research Station Doris Hill Specific Problem: In WWII, German U-boats severely disrupted British shipping. Gt Britain needed to break German’s coded communications. Could do it, but too slow.

  13. II. A Brief History of Computing The Colossi Computers - WWII • Tommy Flowers & others addressed the speed issue by redesigning the method of inputting data (redesigned computer, too) • Colossi: first computers to be • Electronic • Digital • Programmable • Colossi solved it! A Colossus Mark 2 computer. (All Colossi used during World War II were destroyed by 1961.)

  14. II. A Brief History of Computing • Two key ideas: • 1.) Binary Encoding • MIT Master’s Thesis, 1937 • Boolean Algebra: “1” or “0” • An electrical application resolves • any logical/numerical problem • Foundation of: • Digital circuit design theory & • the digital computer Modern Computer Architecture Claude Shannon (1916-2001) Mathematician, Electronic Engineer, & Cryptologist

  15. II. A Brief History of Computing • Two key ideas: • 1.) Binary Encoding • 2.) “Von Neumann • Architecture • Proposed* separating the • CPU from the computer • memory and the I/O devices. • Allowed computers to solve • amazing range of different • problems Modern Computer Architecture John Von Neumann (1903-1957) Mathematician, polymath * “First Draft of a Report on the EDVAC” (June, 1945). His collaborators: J.P. Eckert & J. Mauchly wrote about it in 1943

  16. II. A Brief History of Computing Modern Computer Architecture • Same model since 1940’s inception • Modern architecture separates: Central Processing Unit (CPU) Computer Memory Input/Output (I/O) devices. • Binary Coding (1’s and 0’s).

  17. Ch 1: Intro to Computers & Prog… • Background • History of Computer Architecture • Computing Systems Today • Executing a MATLAB Program • Problem Solving

  18. III. Computing Systems Today • Combination of hardware and software that solves problems • Hardware – physical electronic equipment • Software – the programs that describe the steps or instructions the computer hardware performs. • Survey these topics: A. Hardware C. Computer Configurations B. Memory D. Software

  19. III. Computing Systems Today A. Computer Hardware All computers have a similar internal organization:

  20. III. Computing Systems Today A. Computer Hardware (cont’d.) • CPU (Central Processing Unit) has 2 parts: • Control Unit – manages the flow of data between modules • Arithmetic and Logic Unit (ALU) – performs arithmetic and logical operations required by the software • Data (information) handled by a computer is an important figure of merit bit (from binary digit) is the basic amount* Smallest components of computer hold 1 bit of data – Binary Operation Bit value is 1 for 5 volts (on) (Today – it’s 3.5 volts.) Bit value is 0 for 0 volts (off) (* Coined by statistician John W. Tukey at Princeton University) 1 byte = 8 bits Size of ASCII character using preassigned binary code. A word is a set of data consisting of 16, 32, 64, or more bits. A computer that handles 64-bit words can deal with more data at once than a 32-bit machine ⇒ it’s faster.

  21. III. Computing Systems Today • Computer Hardware (cont’d.) • Input and output (I/O) is done by moving data between the CPU and outside devices (users, other computers) Input – data and instructions coming in Output – the results coming from the computations made by the computer • Data buses – an electronic “pathway” for transporting data between devices Multiple devices sending & receiving data on bus require a protocol to maintain order Today, devices “plug in” to the data bus (push in by hand) In old days, “hard-wire” in (solder)

  22. III. Computing Systems Today A. Computer Hardware Fig. 1.5 Greater detail of internal computer organization

  23. III. Computing Systems Today B. Memory • One way to think about it: its form & how it is accessed solid state memory modules • solid state circuitry directly connected to CPU • digital addresses to store data mechanical memory • devices that moved a sensor past storage media like hard drives, optical disks (CDs, DVDs), etc • externally connected to I/O • Primary or main memory is solid state and its addresses are directly accessible by the CPU. Fast and expensive • Secondary memory or storage is typically mechanical. Slower but greater capacity

  24. III. Computing Systems Today B. Memory • Chart of memory sizes:

  25. III. Computing Systems Today B. Memory: more terminology Note: Memory can have two meanings: 1. Physical device that stores data 2. The stored data • Read Only Memory (ROM) – data that is permanent (semi-permanent?) or a device that holds such data • BIOS (Basic Input/Output System) – a specialized form of ROM holding just enough instructions to get computer going • Random Access Memory or RAM (primary memory) – the directly accessible high speed memory used to store the computer programs (instructions). Never enough of this

  26. III. Computing Systems Today B. Memory: more terms • Cache – a small amount of fast memory used to store frequently-used data. Strategic use of cache memory improves performance. • Virtual Memory – a data file on hard drive containing an image of everything you would like to have in RAM divided into pages. If the desired data is not in RAM, computer has to swap out for it, resulting in loss of performance • Etcetera – An alphabet soup of more memory types and variations

  27. III. Computing Systems Today B. Memory A typical memory layout: Stack – memory space given to programs to store local static data Heap – remainder of RAM, accessible to all programs upon request

  28. Computing Systems Today C. Computer Configurations • Embedded computers (special-purpose processors) – computers performing a single or very limited set of tasks repetitively; built into other equipment • Personal computers (PC’s)– small, general purpose computer that run variety of programs • Mainframes – large scale, powerful computers used in major business and research applications • Supercomputers – ultra-large, fast computers used for very complex computing problems

  29. III. Computing Systems Today D. Software • Contains the instructions the CPU uses to run programs • Categories of software: • Operating systems (OS) • Applications • Language compilers & Programming Languages • Relationship of hardware, software, & user (next slide)

  30. III. Computing Systems Today D. Software

  31. III. Computing Systems Today D. Software • Operating Systems (OS) – manages the computer system as a whole.3 OS’s used today • UNIX (Linux, Redhat, Sun Solaris) • Windows (XP, Vista) • Macintosh (OS X) • Special purpose operating systems Utilities – group of programs in the OS that perform special functions such as virus protection, defragmentation, backup, etc. • Drivers – small programs stored in main memory to support communication between external world and internal application programs via the CPU

  32. III. Computing Systems Today D. Software Applications / Software Tools: commercial programs written to do a specific job • Word processors (MS Word) • Desktop publishing • Spreadsheets (MS Excel, Lotus 1-2-3) • Database Management (MS Access, Oracle) • Computer-aided Design (CAD) – (Auto Cad) Where does MATLAB fit?

  33. III. Computing Systems Today D. Software – Programming Language & Language Compiler: a software tool a programmer uses to express the logic for a computer to implement enables user to write a custom software tool Examples: MATLAB, JAVA, C, FORTRAN, BASIC, … Attributes of a programming language: • Power of the language (the scope of the logic in a line) • User-friendly (clarity to humans) • Portability (run on different types of computers)

  34. III. Computing Systems Today D. Software – One way to “categorize” programming languages: • Machine Language – most basic programming language, strings of 0’s and 1’s, tied closely to the CPU ,very hard to comprehend First Generation Language • Assembly Language – next most basic language, one line of symbolic code yields one machine instruction, tied to CPU, difficult to comprehend Second Generation Language – High-Level Languages – complex, one line of code yields many machine instructions, somewhat portable between processors

  35. III. Computing Systems Today D. Computer Software • Another way to “categorize” – generation – First Generation – machine language – Second Generation – assembly language – Third Generation – high level languages such as C, Basic, Fortran, Cobol, etc. – Fourth Generation – languages where the programming develops a diagram of the desired logic and steps and the language translates the diagram into a set of instructions for the computer to execute – Fifth Generation – natural languages; using the syntax of natural speech

  36. III. Computing Systems Today D. Software The higher the language level ⇒ closer the syntax to human speech Machine language First Generation Assembly language Second Generation High-Level / Partially portable Third Generation C, FORTRAN, BASIC High-Level / Completely portable Fourth Generation Ada, Java MATLAB, Mathematica, Mathcad, Maple Next-Level Fifth Generation IBM’s Watson?

  37. III. Computing Systems Today D. Software The ASCII Binary Assignment Matrix

  38. Ch 1: Intro to Computers & Prog… • Background • History of Computer Architecture • Computing Systems Today • Executing a MATLAB Program • Problem Solving

  39. IV. Executing a MATLAB Program Flow diagram for executing a standard computing task Compile and Assemble are similar operations: Compile takes a high-level language and translates to assembly or machine language. Assemble takes assembly language to machine language.

  40. IV. Executing a MATLAB Program Steps for executing a standard computer program: • 1: Programmer writes set of instructions in target language (source code or program) • 2: Source Code is submitted to compiler that translates instructions into machine language (1’s and 0’s) (object code) • 3: Correct errors generated in Step 2 - compile (compile) time errors or bugs. Correcting errors is debugging. • 4: Searching all subprograms from libraries and collecting in one executable program is linking. • 5: A loader copies executable program into memory and ready for execution – unless new errors (execution, runtime, logic errors or program bugs).

  41. IV. Excecuting a MATLAB Program Executing a standard computer program: • MATLAB is an interpreted language – no compiler for translating instructions into machine code. • MATLAB has interactive environment and can process • – single instructions (calculator) or • – sets of instructions called scripts, call m-files.

  42. Ch 1: Intro to Computers & Prog… • Background • History of Computer Architecture • Computing Systems Today • Executing a MATLAB Program • Problem Solving

  43. V. Problem Solving • Strategy for computer problem-solving is to break the problem down into a series of subproblems (divide and conquer). • – State refers to the collection of data handed off from one subproblem • solution to another. • Strategy – work from both ends, the start and finish: • Two-pronged approach shown below:

  44. V. Problem Solving • Problem solving is the process of designing a solution for a • problem. • A skill mastered by experience – an “art” • A general problem-solving technique: • 1.) Understand the problem • 2.) Devise a plan • 3.) Carry out the plan, checking each step along the way. • 4.) Look back and examine the solution. • How to Solve It, • George Polya (mathematician)

  45. Problem Solving - Example • For example, say you have a big collection of baseball cards and you want to find the names of the 10 “qualified” players with the highest lifetime batting averages. • To qualify, the players must have been in the league at least 5 years, had at least 100 plate appearances per year, and made fewer than 10 errors per year. • The cards contain all the relevant information for each player. You just have to organize the cards to solve the problem.

  46. Problem Solving - Example • Clearly there are a number of steps between the stack of cards and the solution. In no particular order these are: • Write down the names of the players from some cards • b. Sort the stack of cards by the lifetime batting average • c. Select all players from the stack with 5 years or more in the league • d. Select all players from the stack with fewer than 10 errors per year • e. Select all players from the stack with over 100 plate appearances per year • f. Keep the first 10 players from the stack

  47. Problem Solving - Example • The solution might be: • c. Select all players from the stack with 5 years or more in the league • d. Select all players from the stack with fewer than 10 errors per year • e. Select all players from the stack with over 100 plate appearances per year • b. Sort the stack of cards by the lifetime batting average • f. Keep the first 10 players from the stack • a. Write down the names of the players from these cards In any order

More Related