Docsity

Chapter 1: Overview of Computers and Programming, Lecture notes of Logic

Partial preview of the text

Download Chapter 1: Overview of Computers and Programming and more Lecture notes Logic in PDF only on Docsity!

Chapter 1:

Overview of Computers

and Programming

Problem Solving and Program Design in C

5th Edition

by Jeri R. Hanly and Elliot B. Koffman

  1. What is a computer? 

A computer is a device capable of performing computations andmaking logical decisions at a speed of millions, and evenbillions of times faster than human beings. 

Computers process

data

under the control of sets of

instructions called

computer programs

The various devices (such as keyboard, screen, disks, memory,and processing units) that comprise a computer systems arereferred to as

hardware

The computer programs that run on a computer are called^ software

Human analogy: 

(hearing=input, telling=output, thinking=cpu, keeping-in-mind=main memory, permanent storage (file/cabinet)=secondary storage) 

Hard to match with humans though. In the pursuit of matching humanbrain, computers are having more than one processor. 

personal computers typically have one processor 

university computer, Strauss has 16 CPU's, 32GB memory. 

Input=keyboards, outputs=CRT screens, printers

  1. Can a computer think? 

Computers can think what they are programmed to think. They are not"intelligent enough" (if interested, there are courses on AI, Robotics,Computer Vision, etc.)

Figure 1.

The Intel Pentium 4 Processor chip is

an integrated circuit containing the full circuitryof a central processing unit. This processor canexecute a simple instruction such as an integeraddition in one six-billionth of a second.

(Reprinted by

permission of Intel Corporation,

©

Intel Corporation 2003)

Figure 1.

Components of a Computer

Figure 1.

Local Area Network

  1. How does a computer work? 

Someone has to tell it what to do (program) + what to do it on(data). Simplified view of the operation of a computer: 

  1. A programmer (you) writes a program + creates data. 
    1. Program + data is typed, and will get stored on disk. 
      1. Programmer commands the computer to "execute" on thespecified data. 

CU copies program+data into memory, keeps track of currentinstruction to perform (sets PC to point to 1st instruction inprogram) (note: CU=control unit, pc=program counter)

^

-Fetch instr. at PC from memory + store at small location in CPU. ^

-Decode instr. ^

-Fetch data/operands ^

-Execute instructions (by ALU) (note: ALU=Arithmetic and Logic Unit) ^

-Store result to memory ^

-Increment PC to next instr. ^

-repeat above steps until PC runs out of program. Some puzzling questions: ^

  1. How do computers actually store programs and data? 0's and 1's (binary) ^
    1. How does a program get into this form? (compilers convert high-level language into low-level) ^
      1. What tells computer to take what you type and put on the disk, or how does it organize allthe information it stores (Operating System, UNIX in our case) (board) ^

The computer stores programs or data in terms of 0's and 1's. 0 or 1 is represented byelectrical circuits ("on" or "off", or, "pulse" or "no-pulse"). Hence, everything is encoded inpatterns of 0 and 1. ^

For example, 5 is 0101, 8 is 1000 and so on.

Figure 1.

Relationship Between a

Byte and a Bit

Figure 1.

Entering a UNIX

Command for Directory Display

(Board)

Figure 1.12 Entering,Translating,and Runninga High-LevelLanguageProgram

Figure 1.

Flow of Information

During Program Execution