CIS 1.0 NOTES

Lecture 1: Intro - what is CS? algorithms, programs

What is a computer?

A computer is a machine capable of following the instructions of a program.

A program is a set of instructions.

A computer is a device that receives, stores, and processes information.

Example: a simple calculator is not a computer. A calculator can perform computation and can store results, but if there is no square root function, you can't "explain" how to compute the square root and be able to have the calculator repeat that sequence of steps in the future. (Note - not talking about programmable or scientific calculators :) )

Computer Organization:

Hardware – The underlying structure of a computer is known as the von Neumann architecture(named from computers science pioneer john von Neumann, who formalized his method of computer organization in the early 1950s).

The von Neumann architecture identifies three essential components that work together to function as a computer. (Draw picture)

I Central Processing Unit (CPU) –Coordinates the operation of the other sections of the computer.

brain of the computer. 2 tasks –

  1. fetching program instructions from memory
  2. executing those instructions

(Carries out the instructions of the programs)

not complex – broken down into simple instructions, such as

add two numbers

copy a value from one location to another

CPUs process instruction sequences extremely quickly which enables the processors to handle these immense programs.

CPU speed is generally measured in gigahertz (GHz), which indicates how many billions of instructions a CPU can execute in a second. Ex. 1.8 GHz CPU – can execute approximately 1.8 billion simple instructions in a second

CPU speed gets faster and faster each year in PCs. New software applications often require the fastest available CPUs, so sometimes it’s not possible to run new software on an old computer.

Unfortunately there is little you can do to speed up an old CPU. That’s why there is little demand for used computers, unless they are relatively new.

(my laptop

Inspiron 600m / Pentium® M Processor 745(1.80 GHz/400MHz FSB) 14.1-in XGA w/32MB Video / B18MG3N / [221-7886]
Memory / 512MB DDR SDRAM 2 Dimms / 512MB2D / [311-1885]
Hard Drive / 40GB Hard Drive / 40GB / [340-8046]
Operating System / Microsoft® Windows® XP Home

)

IIMemory– The memory is the part of a computer that stores programs and data. Modern computers are digital devices - they store and process information as binary digits, or bits. Bits are the building blocks of digital memory; usually, the two possible values of a bit are written as 0 and 1, but the values could just as easily be represented as off and on.

RAM – Random Access Memory – The memory that the CPU uses when it executes its machine instructions. It’s fast memory because the CPU can write to and read from it very quickly. RAM is volatile, when you turn off your computer – data is lost. RAM is considered human short-term memory.

Each program you run on your computer requires some minimal amount of RAM. Your computer allocates a fixed amount of its available RAM to each program. If the programs require more than is available, the OS needs to use various memory management strategies, which may or may not work very well. You computer might respond very slowly when it is working with less RAM than it needs. Buy as much RAM as you can afford.

Long-Term Storage

Modern computers contain large hard drives capable of saving all the files your computer needs as well as any data files you create for your personal use. Whereas data in Ram disappears when the power goes off, data saved on the hard drive is stable. The hard drive can be used to save, computer programs, word processing files, spreadsheet data, etc.

The larger your hard drive, the more files you can save and the more programs you can store on your computer. A lot of RAM can help your computer run faster, but a large hard drive allows you to install more applications such as office programs and games.

Examples of inexpensive secondary memory: Floppy disks and CDs. A floppy disk is a smaller, portable version of a hard disk, capable of storing up to 1.44 MB of data on a 3.5-inch plastic disk. A CD (Compact Disk) is a metal disk that stores up to 700 MB of data as patterns on its reflective surface.

Primary memory / Secondary
Temporary, volatile / Permanent, nonvolatile
Rapid access / Slower access (1/0)
Low capacity / High capacity
High cost / Low cost

III Input/Output Devices–

Input devices allow the computer to receive data and instructions from an external source, such as a person entering commands at a keyboard. Ex. keyboard, mouse, microphones, CD-ROM drive

Output devices – allow the computer to display or broadcast its results. Examples. Monitor, printer, speaker, CD-Writer

Computer Organization: Software

Program - A set of instructions that determines a computer's action.

Software –A program or a collection of programs that are not 'built-into’ the hardware.

(draw picture of computer/hardware, then os, around it, etc)

Operating System – The heart of any computer. Starts when you turn on the computer. examples Microsoft Windows. Unix, Linux, and Apple are other examples. Controls how the CPU, memory, and I/O devise work together to execute programs.

The Operating System is necessary for application programs to run.

Ex. a Personal Computer user might perform several tasks simultaneously (downloading mail, viewing a web page, listing to music). By switching control of the CPU back and forth between active programs at a very fast rate the OS can produce the appearance of simultaneous execution.

The OS also manages the computer’s memory, organizing storage into files and directories. The OS keeps track of where individual files are stored so that they can be accessed when needed.

The operating system connects the CPU and memory with the computer’s other hardware components. This allows a program to receive input from a keyboard, fetch data from a hard drive, display results on a screen, and even print the results to a laser printer.

To make interacting easier most operating systems (including Microsoft Windows, Mac OS, and Linux – provide a graphical user interfact (GUI). GUI uses visual elements to simplify the process of viewing files and executing programs.

Programming Language - A language with which programs are written.

First generation Machine Language

The "language" that the computer actually understands.

(strings of 1s and 0s)

Second generation Assembly Languages

A low-level programming language.

Use Englishlike abbreviations to represent the machinelanguage instructions

LOADBASEPAY

ADDOVERPAY

STORE GROSSPAY

Third generation Compiler Languages

Highlevel, machine independent, more Englishlike, more natural. Each high-level language statement translates to several low-level language statements. Use compilers to translate from the highlevel language into machine language. Compilers translate the whole program first, then execute the object program. E.g.,

GROSSPAY = BASEPAY + OVERPAY

High-level languages are more English-like, easier to code, more costly to run, less flexible. e.g.,C, C+ + , Java, JavaScript , Pascal, Visual Basic, ...:

High-level programming languages.

Compiler:

Software that translates programs written in high-level languages into machine language.

Application Software - software designed to carry out tasks such as word processing, graphical design, or web access.

Ex. word processors such as Microsoft Word contain instructions for creating and managing documents. Graphics programs such as Adobe Photoshop contain instructions for creating and displaying graphical images, and Web browsers such as Microsoft Internet Explorer and Netscape Navigator contain instructions for accessing and displaying Web pages.

Ex. Of application software (source program) that can be written in any of the languages above:

Registration system in BC. First we will keep all information in two tables: The first is a students table that has students’ addresses, courses taken or registered for and grades. The second is a course database that has the course number, hours, number enrolled and enrollment limit.

  1. Enter all courses that will be offered this semester
  2. If a new student comes to register enter name into student database
  3. For each course a student wants to take
  4. If the course is not full, in the course table increment the number enrolled and in the student table enter the course number for that student.
  5. If the course is full inform the student that they would need an overtally.

Registration algorithm can be written in any of the programming languages mentioned before – that’s software. Hardware is the machinery that runs this.

The software life cycle:

  • To clearly specify the problem in English,
  • code it in “computer language,”
  • run the program,
  • fix errors that come up (bugs)
  • and do long-term maintenance.

1

cis10_1