Lecture0.ppt

823 views

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
823
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Lecture0.ppt

  1. 1. COSC1557: Introduction to Computing <ul><li>Haibin Zhu, PhD. </li></ul><ul><li>AssistProfessor </li></ul><ul><li>Department of Computer Science </li></ul><ul><li>Nipissing University </li></ul><ul><li>(C) 2002 </li></ul>
  2. 2. Instructor <ul><li>Haibin Zhu, Ph. D. </li></ul><ul><li>Assistant Professor, Department of CS and Math, Nipissing University </li></ul><ul><li>Room: A124A Ext.: 4434 </li></ul><ul><li>Email: [email_address] </li></ul><ul><li>URL: http://www.nipissingu.ca/faculty/haibinz </li></ul><ul><li>Office Hour: Mon.–Fri. 2:30pm-4:30pm, and by appointment </li></ul>
  3. 3. Course Description <ul><li>Nature and uses of the computer-, algorithms-, number systems, information representation; and organization, with an overview of computer hardware and software, computing systems and major applications. Ethical and societal issues arc discussed. An introduction to high-level languages with an emphasis on writing programs in C++. </li></ul>
  4. 4. Textbook and references <ul><li>Textbook: Joel Adams and Larry Nyhoff, C++: An Introduction to Computing, 3/e. Prentice Hall, © 2003 ISBN: 0-13-091426-6 </li></ul><ul><li>Lecture Notes on http://cs.calvin.edu/books/c++/intro/3e/PPSlides/ </li></ul><ul><li>Student Supplements: CD-Lab Manual (ISBN: 013080648X) </li></ul><ul><li>Some Lab: http://cs.calvin.edu/books/c++/intro/3e/HandsOnC++/ </li></ul>
  5. 5. Beginning Snapshots Chapter 0
  6. 6. Objectives <ul><li>Give an overview of computer science </li></ul><ul><ul><li>Show its breadth </li></ul></ul><ul><li>Provide context for computer science concepts </li></ul><ul><ul><li>Events from the past </li></ul></ul><ul><li>Describe basic components, organization of a computer </li></ul>
  7. 7. Areas of Computer Science <ul><li>Algorithms and Data Structures </li></ul><ul><li>Architecture </li></ul><ul><li>Artificial Intelligence and Robotics </li></ul><ul><li>Database and Information Retrieval </li></ul><ul><li>Human-Computer Communication </li></ul><ul><li>Numerical and Symbolic Computation </li></ul><ul><li>Operating Systems </li></ul><ul><li>Programming Languages </li></ul><ul><li>Software Methodology and Engineering </li></ul><ul><li>Social and Professional Context </li></ul>
  8. 8. Important Concepts in Computer History <ul><li>The mechanism of arithmetic </li></ul><ul><li>The stored program </li></ul><ul><li>The graphical user interface </li></ul><ul><li>The computer network </li></ul>
  9. 9. First-Generation Computers <ul><li>Vacuum tube computers 1945-1956 </li></ul><ul><ul><li>ENIAC 1943-1946 </li></ul></ul><ul><ul><li>John Von Neumann's &quot;First Draft of a Report on the EDVAC&quot; 1945 </li></ul></ul><ul><ul><li>First bug in a computer 1945 </li></ul></ul><ul><ul><li>UNIVAC 1951 </li></ul></ul>
  10. 10. Second Generation Computers <ul><li>Used transistors 1956-1963 </li></ul><ul><li>FORTRAN 1957 </li></ul><ul><li>IBM 7090 1958 </li></ul><ul><li>LISP </li></ul><ul><li>COBOL 1960 </li></ul><ul><li>ALGOL 60 </li></ul>
  11. 11. Third-Generation Computers <ul><li>Chips and Integrated Circuits 1964-1971 </li></ul><ul><li>The IBM System/360 1964 </li></ul><ul><li>The PDP-8 1965 </li></ul><ul><li>Douglas Englebart: the mouse, Two-D display, editing, hypermedia, 1968 </li></ul><ul><li>Pascal </li></ul><ul><li>Ken Thompson: UNIX 1969 </li></ul><ul><li>ARPANET – The beginning of the Internet </li></ul>
  12. 12. Fourth-Generation Computers <ul><li>Intel 4004 Chip 1971 </li></ul><ul><li>Dennis Richie: C 1973 </li></ul><ul><li>Ethernet </li></ul><ul><li>Court rules Atanasoff was legal inventor of first electronic digital computer </li></ul><ul><li>Altair, BASIC, Apple 1 1974 </li></ul><ul><li>Apple II, Cray 1, Apple Corp. Microsoft Corp. 1976 </li></ul><ul><li>IBM PC 1981 </li></ul>
  13. 13. Fourth-Generation Computers <ul><li>Bjarne Stroustrup: C++ 1983 </li></ul><ul><li>Novell announces Netware TCP/IP </li></ul><ul><li>Macintosh 1984 </li></ul><ul><li>Windows 1985 </li></ul><ul><li>Intel 386 Chip 1986 </li></ul><ul><li>Tim Berners—Lee: WWW 1991 </li></ul><ul><li>Linux 1992 </li></ul>
  14. 14. Fourth-Generation Computers <ul><li>Pentium chips, Power PC chip 1993 </li></ul><ul><li>MOSAIC, Apple Newton </li></ul><ul><li>Netscape Navigator 1.0, Yahoo! 1994 Palm computing </li></ul><ul><li>James Gosling: JAVA 1995 Windows 95, Internet Explorer, Internet goes commercial </li></ul><ul><li>Windows 98, Apple's IMAC 1998 Microsoft's court case </li></ul>
  15. 15. Fourth-Generation Computers <ul><li>Y2K Problem, Powermac G4 1999 </li></ul><ul><li>Windows 2000 2000 1 GHZ processors </li></ul><ul><li>Mac OS X 2001 Windows XP </li></ul><ul><li>Quantum Computer 2002 </li></ul>
  16. 16. Graphical User Interface <ul><li>Command line interface required precise and cryptic commands </li></ul><ul><li>Xerox PARK had developed GUI prototype in 1972 </li></ul><ul><ul><li>Steve Jobs saw it several years later and used new hardware capabilities to implement </li></ul></ul><ul><li>GUI makes computer easy to use </li></ul>
  17. 17. Network <ul><li>Defn: Two or more computers connect to exchange resources </li></ul><ul><ul><li>Processing power </li></ul></ul><ul><ul><li>Storage </li></ul></ul><ul><ul><li>Access to a printer </li></ul></ul><ul><ul><li>Software resources </li></ul></ul><ul><ul><li>Messages </li></ul></ul>
  18. 18. Network <ul><li>Time sharing in early 1960s </li></ul><ul><ul><li>Users communicate with host computer </li></ul></ul><ul><li>ARPANET connected research center computers in 1969 </li></ul><ul><ul><li>Eventually developed into Internet </li></ul></ul><ul><li>Local Area Network hardware and operating systems developed late 1970s </li></ul><ul><li>ISPs now affordable, widely available for even home computers </li></ul>
  19. 19. Computer Organization Hardware and Software
  20. 20. Computing Systems <ul><li>Computers have two kinds of components: </li></ul><ul><li>Hardware , consisting of its physical devices (CPU, memory, bus, storage devices, ...) </li></ul><ul><li>Software , consisting of the programs it has (Operating system, applications, utilities, ...) </li></ul>
  21. 21. Hardware: CPU <ul><li>Central Processing Unit (CPU): </li></ul><ul><ul><li>the “brain” of the machine(?) </li></ul></ul><ul><ul><li>location of circuitry that performs arithmetic and logical ML statements </li></ul></ul><ul><ul><li>measurement: speed (roughly) in megahertz (millions of clock-ticks per second) </li></ul></ul><ul><ul><li>examples: Intel Pentium(PI, PII, PIII, P4), AMD K6, Motorola PowerPC, Sun SPARC, </li></ul></ul>
  22. 22. Hardware: RAM <ul><li>Random Access Memory (RAM) </li></ul><ul><ul><li>“main” memory, which is fast, but volatile ... </li></ul></ul><ul><ul><li>analogous to a person’s short-term memory. </li></ul></ul><ul><ul><li>many tiny “on-off” switches: for convenience </li></ul></ul><ul><ul><ul><li>“on” is represented by 1, “off” by 0. </li></ul></ul></ul><ul><ul><li>each switch is called a b inary dig it , or bit . </li></ul></ul><ul><ul><ul><li>8 bits is called a byte . </li></ul></ul></ul><ul><ul><ul><li>2 10 bytes =1024 bytes is called a kilobyte (1K) </li></ul></ul></ul><ul><ul><ul><li>2 20 bytes is called a megabyte (1M). </li></ul></ul></ul>
  23. 23. Hardware (Disk) <ul><li>Secondary Memory (Disk): </li></ul><ul><ul><li>Stable storage using magnetic or optical media. </li></ul></ul><ul><ul><li>Analogous to a person’s long-term memory. </li></ul></ul><ul><ul><li>Slower to access than RAM. </li></ul></ul><ul><ul><li>Examples: </li></ul></ul><ul><ul><ul><li>floppy disk (measured in kilobytes) </li></ul></ul></ul><ul><ul><ul><li>hard disk (measured in gigabytes (2 30 bytes)) </li></ul></ul></ul><ul><ul><ul><li>CD-ROM (measured in megabytes), ... </li></ul></ul></ul>
  24. 24. Hardware: the Bus <ul><li>The Bus: </li></ul><ul><ul><li>Connects CPU to other hardware devices. </li></ul></ul><ul><ul><li>Analogous to a person’s spinal cord. </li></ul></ul><ul><ul><li>Speed measured in megahertz (like the CPU), but typically much slower than the CPU... </li></ul></ul><ul><ul><li>The bottleneck in most of today’s PCs. </li></ul></ul>
  25. 25. Hardware: Cache <ul><li>While accessing RAM is faster than accessing secondary memory, it is still quite slow, relative to the rate at which the CPU runs. </li></ul><ul><li>To circumvent this problem, most systems add a fast cache memory to the CPU, to store recently used instructions and data. </li></ul><ul><li>(Assumption: Since such instructions/data were needed recently, they will be needed again in the near future.) </li></ul>
  26. 26. Hardware: Summary <ul><li>Putting the pieces together: </li></ul>Programs are stored (long-term) in secondary memory, and loaded into main memory to run, from which the CPU retrieves and executes their statements. CPU Bus Main Memory Secondary Memory cache
  27. 27. Software: OS <ul><li>The operating system (OS) is loaded from secondary memory into main memory when the computer is turned on, and remains in memory until the computer is turned off. </li></ul>RAM Disk CPU Cache Bus OS
  28. 28. Software: OS <ul><li>The OS acts as the “manager” of the system, making sure that each hardware device interacts smoothly with the others. </li></ul><ul><li>It also provides the interface by which the user interacts with the computer, and awaits user input if no application is running. </li></ul><ul><li>Examples: Windows 2000, Windows XP, Windows-NT, UNIX, Linux, Solaris, MacOS, ... </li></ul>
  29. 29. Software: Applications <ul><li>Applications are non-OS programs that perform some useful task, including word processors, spreadsheets, databases, web browsers, C++ compilers, ... </li></ul><ul><li>Example C++ compilers/environments: </li></ul><ul><ul><li>CodeWarrior (MacOS, Win95, WinNT, Solaris) </li></ul></ul><ul><ul><li>GNU C++ (UNIX, Linux) </li></ul></ul><ul><ul><li>Turbo/Borland C++ (Win95, WinNT) </li></ul></ul><ul><ul><li>Visual C++ (Win95, WinNT) </li></ul></ul>
  30. 30. Software: User Programs <ul><li>Programs that are neither OS programs nor applications are called user programs. </li></ul><ul><li>User programs are what you’ll be writing in this course. </li></ul>
  31. 31. Putting it all together <ul><li>Programs and applications that are not running are stored on disk. </li></ul>RAM Disk CPU Cache Bus OS App
  32. 32. Putting it all together <ul><li>When you launch a program, the OS controls the CPU and loads the program from disk to RAM. </li></ul>RAM Disk CPU Cache Bus OS App App OS
  33. 33. Putting it all together <ul><li>The OS then relinquishes the CPU to the program, which begins to run. </li></ul>RAM Disk CPU Cache Bus OS App App App
  34. 34. The Fetch-Execute Cycle <ul><li>As the program runs, it repeatedly fetches the next instruction (from memory/cache), executes it, and stores any results back to memory. </li></ul>RAM Disk CPU Cache Bus OS App App App That’s all a computer does: fetch-execute-store, millions of times each second !
  35. 35. Programming
  36. 36. What is Programming? <ul><li>A sequence of statements that instruct a computer in how to solve a problem is called a program . </li></ul><ul><li>The act of designing, writing and maintaining a program is called programming . </li></ul><ul><li>People who write programs are called programmers . </li></ul>
  37. 37. What kinds of statements do computers understand? <ul><li>A computer only understands machine language statements. </li></ul><ul><li>A machine language statement is a sequence of ones and zeros that cause the computer to perform a particular action, such as add, subtract, multiply, ... </li></ul>
  38. 38. Machine Language (ML) <ul><li>ML statements are stored in a computer’s memory, which is a sequence of switches. </li></ul><ul><li>For convenience of representation, an “on” switch is represented by 1, and an “off” switch is represented by 0. </li></ul><ul><li>ML thus appears to be binary (base-2): </li></ul><ul><li>0010111010110101 </li></ul>
  39. 39. Early Computers <ul><li>... required a programmer to write in ML... </li></ul><ul><ul><li>Easy to make mistakes! </li></ul></ul><ul><ul><li>Such mistakes are hard to find! </li></ul></ul><ul><ul><li>Not portable -- only runs on one kind of machine! </li></ul></ul><ul><li>Programming was very difficult! </li></ul>
  40. 40. A Bright Idea <ul><li>Devise a set of abbreviations (mnemonics) corresponding to the ML statements, plus a program to translate them into ML. </li></ul><ul><li>The abbreviations are an assembly language , and the program is called an assembler . </li></ul>Assembler 0010111010110101 ADD
  41. 41. Assembly Languages <ul><li>Allowed a programmer to use mnemonics, which were more natural than binary. </li></ul><ul><ul><li>Much easier to read programs </li></ul></ul><ul><ul><li>Much easier to find and fix mistakes </li></ul></ul><ul><ul><li>Still not portable to different machines </li></ul></ul>
  42. 42. High Level Languages <ul><li>Devise a set of statements that are close to human language (if, while, do, ...), plus a program to translate them into ML. </li></ul><ul><li>The set of statements is called a high level language (HLL) and the program is called a compiler . </li></ul>
  43. 43. HLL Compilers <ul><li>Where an assembler translates one mnemonic into one ML statement, a HLL compiler translates one HLL statement into multiple ML statements. </li></ul>Compiler 1010110011110101 0000000000010000 0010111010110101 0000000000010010 0010111011111101 0000000000010100 z = x + y;
  44. 44. HLLs <ul><li>High level languages (like C++) are </li></ul><ul><ul><li>Much easier to read programs </li></ul></ul><ul><ul><li>Much easier to find and fix mistakes </li></ul></ul><ul><ul><li>Portable from one machine to another (so long as they keep to the language standard). </li></ul></ul>
  45. 45. Objectives in Programming <ul><li>A program should solve a problem: </li></ul><ul><ul><li>correctly (it actually solves the problem) </li></ul></ul><ul><ul><li>efficiently (without wasting time or space) </li></ul></ul><ul><ul><li>readably (understandable by another person) </li></ul></ul><ul><ul><li>in a user-friendly fashion (in a way that is easy for its user to use). </li></ul></ul>
  46. 46. Summary <ul><li>A computer has two kinds of components: </li></ul><ul><ul><li>Hardware: its CPU, RAM, Disk(s), ... </li></ul></ul><ul><ul><li>Software, its OS, Applications, and User Programs. </li></ul></ul><ul><li>There are “levels” to computer languages: </li></ul><ul><ul><li>ML consists of “low” level binary statements, that is hard to read, write, and not portable. </li></ul></ul><ul><ul><li>Assembly uses “medium” level mnemonics: easier to read/write, but not portable. </li></ul></ul><ul><ul><li>C++ is a “high” level language that is even easier to read/write, and portable. </li></ul></ul>

×