Top Banner
© Jalal Kawash 2010 Introduction Peeking into Computer Science 1
43

Introduction

Feb 22, 2016

Download

Documents

imala

Introduction. Peeking into Computer Science. Mandatory: Chapter 1 Optional: None. Reading Assignment. Computers, Zeros, and Ones. The big picture. At the end of this section, the student will be able to: Name the 5 basic components of a computer & identify their functions - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction

© Jalal Kawash 2010

IntroductionPeeking into Computer Science

1

Page 2: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Reading Assignment

Mandatory: Chapter 1Optional: None

2

Page 3: Introduction

Computers, Zeros, and OnesThe big picture

3

Page 4: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Objectives

At the end of this section, the student will be able to:

1. Name the 5 basic components of a computer & identify their functions

2. Explain how processor speed is measured3. Understand Dual-Core architectures4. Describe the operation of Hard disks and optical

CDs5. Describe the memory hierarchy6. Understand how information is represented in a

computer by 0s and 1s

Page 5: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Computers

Computers are general purpose machines◦Music/Movies◦Communication◦More complex operation

5

Page 6: Introduction

CPU

Control Unit (CU)

Arithmetic and Logic Unit (ALU)

RegistersMain

MemoryHardDisk

Other I/O devices

bus

Page 7: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Central Processing Unit

CPU is the brain of the computerAlso called processorHas two components:

◦Arithmetic and Logic Unit (ALU) Simple arithmetic and logic operations

◦Control Unit Controls the operations of the rest of the machine

Has a scratch pad◦Collection of registers

Connected to the rest of the system components

CPU

Control Unit (CU)

Arithmetic and Logic Unit (ALU)

Registers

Page 8: Introduction

© Jalal Kawash 2010Peeking into Computer Science

The Bus8

CPU

Control Unit (CU)

Arithmetic and Logic Unit (ALU)

RegistersMain

MemoryHardDisk

Other I/O devices

bus

Page 9: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Signals

No signal (0 bit)

Signal (1 bit)

Signal is absentAn unlit lampRepresents a 0

Signal is presentA lit lampRepresents a 1

9

Page 10: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Robot’s World10

Page 11: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Robot’s World

1 1 1 1 1 1 1 1 1 11 o o o 1 o 1 o o 11 o o o 1 o 1 o o 11 o o 1 1 o 1 o o 11 o o o 1 o 1 o o 11 o o o 1 o o o o 11 o o o o o o o o 11 1 1 1 1 1 1 1 1 1

11

Page 12: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Main Memory

Random Access MemoryHolds programs and Data for CPUEvery thing the CPU operates on

(executing a program, playing a song, working on a file) must be in RAM

Volatile: do not hold data if power is lostNeed non-volatile storage

Page 13: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Disks

Non-volatile StorageElectro-magnetic signals that stay in the

absence of power

Page 14: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Other Input/Output Devices

PrinterKeyboardScreenMouseEtc …

Page 15: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Cache Memory

Fast Memory that sits between main memory and CPU

Page 16: Introduction

© Jalal Kawash 2010Peeking into Computer Science

CPU Operation

Page 17: Introduction

17

ALU

A

A+B

B

ABC

Registers

ALU input Registers

Accumulator(ALU output register)

CU signal to ADD

Main Memory

Page 18: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Talking Gigahertz

What does a 3.0 GHz CPU mean?

CPU can perform about 3 billion micro-instructions per second

Page 19: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Dual Core?

A Computer that contains two CPUs on the same chip

Page 20: Introduction

20

Main Memory

HardDisk

Other I/O devices

Cache

Processor ChipCPU1

CU

ALU

Registers

CPU2

CU

ALU

Registers

Page 21: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Storage Units

Byte = 8 bitsKilobyte = 1024 bytesMegabyte = 1024 Kilobytes

◦1,048,576 bytesGigabyte = 1024 Megabytes

◦1,073,741,824 bytesTerabyte = 1024 Gigabyte

◦1,099,511,627,776 bytes

Page 22: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Memory Hierarchy

Page 23: Introduction

© Jalal Kawash 2010Peeking into Computer Science 23

Magnetic (Hard) Disk

spindle

platter

arm

arm movement

Read/write head

Page 24: Introduction

© Jalal Kawash 2010Peeking into Computer Science

CD-ROMs

Disk LabelProtective Lacquer Layer

Reflective LayerDye Layer

Plastic Layer

1.2 mm

reflectedlaser beam

pit

A pit prevents a laser beam from being reflected

Page 25: Introduction

Information CodingBeyond images

Page 26: Introduction

© Jalal Kawash 2010Peeking into Computer Science

Objectives

At the end of this section, the student will be able to:

1. Understand how characters are represented by 0s and 1s

2. Understand the encoding and decoding process

3. Find the minimum number of bits needed to code character information

Page 27: Introduction

© Jalal Kawash 2010Peeking into Computer Science 27

Fixed-Length Codes

Symbols in a computer’s memory are stored as 0s and 1s

Each symbol is given a fixed-length codeASCII codes:

◦A is 0100 0001◦B is 0100 0010◦C is 0100 0011◦D is 0100 0100◦E is 0100 0101◦Etc..

Page 28: Introduction

© Jalal Kawash 2010Peeking into Computer Science 28

Fixed-Length Codes

The Word ACE is stored in a computer as:

010000010100001101000101A C E

Page 29: Introduction

© Jalal Kawash 2010Peeking into Computer Science 29

More ASCII Codes

Page 30: Introduction

© Jalal Kawash 2010Peeking into Computer Science 30

A Counting Problem

If the alphabet has two letters only (say 0 and 1), how many one-letter words can be formed?

Only two possibilities exist01

So, two words

Page 31: Introduction

© Jalal Kawash 2010Peeking into Computer Science 31

A Counting Problem

Think of it this way:We have a box that can fit one ball onlyBalls have one of two colors

How many distinct boxes can we produce?

Page 32: Introduction

© Jalal Kawash 2010Peeking into Computer Science 32

A Counting Problem

If the alphabet has two letters only (say 0 and 1), how many two-letter words can be formed?

Bigger boxCan hold 2 balls

Page 33: Introduction

© Jalal Kawash 2010Peeking into Computer Science 33

A Counting Problem

If the alphabet has two letters only (say 0 and 1), how many two-letter words can be formed?

00011011

So, four words

Page 34: Introduction

© Jalal Kawash 2010Peeking into Computer Science 34

A Counting Problem

If the alphabet has two letters only (say 0 and 1), how many three-letter words can be formed?

000, 001, 010, 011, 100, 101, 110, 111

So, eight words

Page 35: Introduction

© Jalal Kawash 2010Peeking into Computer Science 35

A Counting Problem

If the alphabet has two letters only (say 0 and 1), how many n-letter words can be formed?

2n words

Page 36: Introduction

© Jalal Kawash 2010Peeking into Computer Science 36

A Counting Problem

If the alphabet has β letters, how many n-letter words can be formed?

βn words

Page 37: Introduction

© Jalal Kawash 2010Peeking into Computer Science 37

Back to Coding

Assume we have a file that contains data composed of 6 letters (symbols) only:

A, I, C, D, E, and S (for space)

ACE DICE AIDE CAID EAD DAICED …

Page 38: Introduction

© Jalal Kawash 2010Peeking into Computer Science 38

Back to Coding

Assume we have a file that contains data composed of 6 letters (symbols) only:

A, I, C, D, E, and S (for space)

ACESDICESAIDESCAID EADSDAICED …

Page 39: Introduction

© Jalal Kawash 2010Peeking into Computer Science 39

Coding

If the file has 1000 characters, how many bits (0s and 1s) are needed to code the file?

Page 40: Introduction

© Jalal Kawash 2010Peeking into Computer Science 40

Coding

The first question isHow many symbols do we need to

represent each character?The objective is to keep the size of the file

as small as possibleWe have 6 characters (messages) and two

alphabet symbols (0 and 1)2 is not enough, since 22 is 4

Page 41: Introduction

© Jalal Kawash 2010Peeking into Computer Science 41

2 bits are not enough

00 for A01 for S10 for I11 for E

We cannot represent the rest C and D

3 works, since 23 is 8, so we can represent up to 8 characters and we only have 6

Page 42: Introduction

© Jalal Kawash 2010Peeking into Computer Science 42

3 bits are more than enough

Say000 for A001 for S010 for I011 for E100 for C101 for D110 not used111 not used

Page 43: Introduction

© Jalal Kawash 2010Peeking into Computer Science 43

Coding

If the file has 1000 characters, how many bits (0s and 1s) are needed to code the file?

Each character needs 3 bitsHence, we need 3x1000 = 3000 bits