What is a computer?

 

Computer - device that solves problems by:

1)      accepting data

ex. numbers to add

2)      performs prescribed operations on data ex. actual adding

3)      supplies the results of these operations

 

 

Hardware - Actual physical devices that make up the computer.  These include devices that feed information int the computer (input) and devices that produce information from the computer(output)

1.      Accept input

2.      Display output

3.      Store information in a logically consistent format

4.      Perform arithmetic and logic operations on either the input or stored data

5.      Monitor, control, and direct the overall operation and sequencing of the system

 

Software - the computer instructions that form a computer program  System programs control the computer and application programs perform specific tasks. 

 

Every computer system includes an operating system.  This is the software that enables us to use the computer hardware.

 

Parts of the computer:

1)      Input/Output Unit - interface to which peripheral input/output devices are attached.  These I/O devices allow for the user to communicate with the computer ex. keyboard, punched cards, scanner(input), monitor, printer (output).  These devices are sometimes called peripherals.

 

2)      Memory Unit - consists of many small memory cells which hold information  Each memory cell has a unique address which indicates its location in main memory

 

Each cell has a unique memory address associated with it indicating its location in memory

 

Main memory usually contains information and programs that are currently being worked on by the computer

RAM - random access memory, volatile memory, anything stored here goes away once computer is turned off.  Measured in bytes.  kilobytes 1024 bytes.  PC memories now are a

ROM - read only memory, found in the BIOS of most computers - burned in memory.  Remains constant. Fundamental instructions used to "boot" or start the computer with.

 

 

Since main memory is only so large, and usually expensive, extra information needed to be processed in the near or distant future resides on peripherals called secondary memory.  These include tape drives, floppy disk drives, hard disk drives, CD ROM, etc.

 

3. Control Unit (CU) fetches instructions from memory and interprets them

 

4. Arithmetic logic unit (ALU) does all arithmetic calculations (addition, subtraction, division, multiplication, …

also does logical operations, yields a true or false answer.

Ex. 2 is larger than 4

 

5. program counter – has the location in memory of the next instruction to be executed

 

6. instruction register – contains the currently executing instruction

 

 

The control unit, the ALU, program counter (PC), the instruction register (IR), and the accumulator (ACC) together constitute the central processing unit. (CPU)

 

 

Model of a computer:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


What is a computer language?

 

Old time computers - switches

0        off or false

1        on or true

 

Programmer had to flip switches in order to tell computer what to do.

Computer used binary numbers to do calculations.  Binary numbers are base 2 numbers.  They are sequences of 0's and 1's.  A binary digit, 0 or 1, is called a bit.  8 bits make up 1 byte.


Levels of Computer Languages:

Low Level Languages - machine dependent.  Based on the computer hardware or architecture.

 

machine language - sequences of 0's and 1's.  The only language that computers can understand.   Machine language is a low level language.

 

assembly language - used mnemonics to represent sequences of 0's and 1's.  Programs called assemblers translated these mnemonics into machine language.  Assembly language is also low level.

 


High Level languages - more "English" like.  These languages are translated into machine code by a program called a compiler.  The language is machine independent.  The program that does the translating is machine dependent.  The program code written in these languages is known as source code or source programs.
            COBOL
            Pascal
            FORTRAN
            Logo

            C
            C++

BASIC

ADA

LISP

JAVA

PERL

 

Translation to Machine Language

            Interpreted language - when each program statement is translated and then immediately executed.  Program that does this is called an Interpreter.  Ex. BASIC, LISP


            Compiled language - all source code is translated, saved, and then executed. Ex. FORTRAN, C++, COBOL
                        linker

 

Procedural languages - programs are written as a set of functions or procedures that accomplish a specific task.  Each procedure/function, accepts data and manipulates the data in some way to produce a desired result.  Ex. Pascal, Cobol


Object-Oriented languages (OOP) - Programs are made up of objects that fully describe the data and functions associated with it.  Ex. C++ (not a true OOP), JAVA, PERL

 

Steps for creating and executing a high level program.

  1. Use an editor, such as notepad or one that comes with the compiler, to type in the high level language instructions.  This becomes the source code or source program.
  2. Use the compiler to check for syntax errors.  Syntax errors occur when you "break the rules" of the programming language. 
  3. If there are no syntax errors, the compiler translates the source code into machine language.  The resulting machine code is called an object program.
  4. Many tasks that need to be done by a computer program are already written and do not need to be recoded by the programmer.  An example of this is the code that displays the results of a program onto the computer screen.  The code for these tasks reside in libraries supplied by the compiler.  The  linker bundles the object code and the library code into an executable file.
  5. The loader then places the executable program into main memory where it can be executed.