computer fundamentals lecture01 sri lanka institute of information technology (sliit)

25
06/26/22 Sri Lanka Institue of Information T echnology Computer Fundamentals Lecture 1: Data Types and Data Representation

Upload: ariff-alavi

Post on 12-Nov-2014

362 views

Category:

Documents


0 download

DESCRIPTION

Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

TRANSCRIPT

Page 1: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Computer Fundamentals

Lecture 1: Data Types and Data Representation

Page 2: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Course Objectives After completing this module students will be able

to: Explain fundamental concepts related to computer

systems Identify major components of a computer and describe

their functionality Illustrate how each component work and communicate

with each other Distinguish the functional importance of different

componentsAnd Assemble a computer for a given task

Page 3: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Lecture Outline

Page 4: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Lecture Objectives Data and it’s representation inside

computers What do they mean by “data”? Why do we need a representation to hold them

inside a computer? Data types and their usage

Page 5: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Agenda

A Modern Computer System What is data ? How do we store them inside a computer? Programmers point of view Basic Data Types Number Representation Floating Point Representation Data Representation in Computers Binary Code Transmission

Page 6: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

A Modern Computer System

Image Credit: Modern Operating System by Andrew S Tanenbaum

Page 7: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

A Modern Computer System

Image Credit: Operating System Concepts by Silberschatz et. al.

Page 8: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

What is data ? Data is an observation The physical world is observed by sensors These sensors, upon receiving input signals

output a signal These input signals are very often analog in

nature Analog signals are continuous electrical signals

that vary with time Most of the time, the variations follow that of the

non-electric (original) signal, therefore the two are analogous

Page 9: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

How do we store them in a computer? Computer is a digital device which is capable to

handle discrete data/information Therefore, we need to convert these analog

signals to digital signals after capturing them by the input devices

This is done with the converter ADC Digital signals are represented by numbers Once these numbers are captured they need to

be stored in the main memory ( this is a requirement by the architecture)

Page 10: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

How do we store them in a computer? The main memory is a collection of

discrete units called BYTES. In order to store a lengthy number when it

exceeds one BYTE we need a specific way That is what we call the data

representation

Page 11: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

The memory is made up of BYTES Each BYTE can be addressed uniquely When the address is expressed in Binary, the

number of maximum BITs used to write the address specifies the total number of locations available

If n number of BITs are available then the total number of locations available is 2n

If we have 32 BITs then we can have 4GB of Memory

How do we store them in a computer?

Page 12: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Our pc’s are having 512MB of main memory (RAM). How many bits are used to address the memory locations of the PC?

How do we store them in a computer?

Page 13: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

The number used to identify a memory location (which is a BYTE) is called the address.

There is no place given in the memory location to have this address

How do we store them in a computer?

Page 14: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Programmers point of view Programmers need to use data in their programs The architecture says, it is required to store them

in the main memory before use Therefore, it is required to find a way to put them

in memory He sets his requirement through what we call a

DATA TYPE Through a data type, architecture tells the

computer that data must be stored in a particular way in the main memory

For that, the data must have a representation

Page 15: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Basic Data Types: Character Data Numeric

012…9 Alphabetic

Abc……z Special

(#@%$&…

Page 16: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Basic Data Types: Numeric data Integer

+ & - whole numbers 4251 -582

Real All numbers including everything between

integers 0.23, 0, 5 ½, -2.3,

Least significant bitMost significant bit

Page 17: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Number Representation Fixed Point Representation

12.548 Floating Point Representation

Scientific Notation 12.054 -> 1.2054 * 101

Computer Notation 12.65 -> .1265*102

Page 18: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Floating Point RepresentationMantissa/argument

15.23 * 10 4

Radix /base

Exponent

Page 19: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Data Representation in Computers How do computers represent data? Most computers are digital

Recognize only two discrete states: on or off Computers are electronic devices powered by

electricity, which has only two states, on or off

1 1 1 1 1

0 0 0 0 0

Page 20: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Binary representation A number system that has just two unique

digits, 0 and 1 The two digits represent the two off and on

statesBinary

Digit (bit)Electronic

ChargeElectronic

State

Data Representation in Computers

Page 21: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Data Representation in Computers BCD (Binary Coded Decimal)

4 bit code for numeric values only 9 ->1001

Page 22: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

ASCII (American Standard Code for Information Interchange) 7 bit code for all 128 charactersA=1000001

EBCDIC (Extended BCD Interchange Code) 8 bit ASCII

Data Representation in Computers

Page 23: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

ASCII (American Standard Code for Information Interchange) 7 bit code for all

128 charactersA=1000001

Data Representation in Computers

Page 24: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Binary Code Transmission Pulse Train

Parity bit Even parity Odd parity

Low

High

ASCII –’ A’

time

Pulse level

Parity bit

Page 25: Computer Fundamentals Lecture01 Sri Lanka Institute of Information Technology (SLIIT)

04/08/23 Sri Lanka Institue of Information Technology

Thank You