[go: up one dir, main page]

0% found this document useful (0 votes)
21 views30 pages

(IT ) Week3

Uploaded by

sec552345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views30 pages

(IT ) Week3

Uploaded by

sec552345
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

IT 개론 03

Information
Representation

손 우형
whsohn61@cau.ac.kr
Where we are
• Part 1. Hardware • Part 3. Communications
• Computer 구조 • Internet
• Bit, Byte • WWW
• CPU • Security & Privacy

• Part 4. Other Issues


• Part 2. Software
• AI
• Algorithm
• Software Engineering & Agile
• OS
• Digital Transformation
• Programming Language
• Application & Cloud
fundamental ideas about how
computers represent information
• computers are digital processors

• computers represent information in bits.

• groups of bits represent larger thing


Bits, bytes, and
Representation of Information
• Digital representation means that everything is represented by numbers only

• The usual sequence:


• Something (sound, pictures, text, instructions, ...) is converted into numbers by some
mechanism
• The numbers can be stored, retrieved, processed, copied, transmitted
• The numbers might be reconstituted into a version of the original

• For sound, pictures, other real-world values


• Make accurate measurements
• And then convert them to numeric values
Analog vs. Digital
• Analog: "analogous" or "the analog of"
• Smoothly or continuously varying values
• Volume control, dimmer, faucet, steering wheel
• Value varies smoothly with something else
• No discrete steps or changes in values
• Small change in one implies small change in another
• Infinite number of possible values
• The world we perceive is largely analog

• Digital: discrete values


• Only a finite number of different values
• A change in something results in sudden change
from one discrete value to another
• Digital speedometer, digital watch, push-button radio tuner, …
• Values are represented as numbers
Transducers
• Devices that convert from one representation to another
• Microphone
• Loudspeaker / earphones
• Camera / scanner
• Printer / screen
• Keyboard
• Mouse
• Touch screen
• etc.

• Something is usually lost by conversion (in each direction)


• The ultimate copy is not as good as the original
Why Digital instead of Analog?
• Easy for computers to work with
• Compressed by squeezing out
• Encrypted for security and privacy
• Copied exactly
• Shipped anywhere
• Stored in an endless variety of devices

• Easily extended
Digital Data Trends
Analog to Digital Conversion
Encoding sound
• Need to measure intensity/loudness often enough and accurately enough that we can reconstruct
it well enough.
• Higher frequency = higher pitch
• Human ear can hear ~ 20Hz to 20KHz
• Taking samples at twice the highest frequency is good enough (Nyquist)

• CD audio usually uses


• 44,100 samples / second
• Accuracy of 1 in 65,536 (= 216) distinct levels
• Two samples at each time for stereo
• Data rate is 44,100 x 2 x 16 bits/sample
• = 1,411,200 bits/sec = 176,400 bytes/sec ~ 10.6 MB/minute

• MP3 audio compresses by clever encoding and removal of sounds that won't really be heard
• Data rate is ~ 1 MB/minute
ASCII: American Standard Code for
Information Interchange
• An arbitrary but agreed-upon representation for USA.
• Widely used everywhere

• Unicode
• Multiple character-set standards in different geographic or linguistic regions
• Unicode.org
Important Ideas
• Number of items and number of digits are tightly related:
• One determines the other
• Maximum # of different items = base# of digits
• e.g., 9-digit SSN: 109 = 1 billion possible numbers
• e.g., To represent up to 100 “characters”: 2 digits is enough.
• But for 1000 characters, we need 3 digits

• Interpretation depends on context


• Without knowing that, we can only guess what things mean
• What's 810615 ?
A review of How decimal numbers work
• How many digits?
• We use 10 digits for counting: "decimal" numbers are natural for us
• Other schemes show up in some areas
• Clocks use 12, 24, 60; calendars use 7, 12
• Other cultures use other schemes

• What if we want to count to more than 10?


• 0123456789
• 1 decimal digit represents 1 choice from 10; counts 10 things; 10 distinct values
• 00 01 02 … 10 11 12 … 20 21 22 … 98 99
• 2 decimal digits represents 1 choice from 100; 100 distinct values
• We usually elide zeros at the front
• 000 001 … 099 100 101 … 998 999
• 3 decimal digits …

• Decimal numbers are shorthand for sums of powers of 10


• 1492 = 1 x 1000 + 4 x 100 + 9 x 10 + 2 x 1
• = 1 x 103 + 4 x 102 + 9 x 101 + 2 x 100

• Counting in "base 10", using powers of 10


Binary numbers: Using bits to represent numbers
• Just like decimal except there are only two digits: 0 and 1

• Everything is based on powers of 2 (1, 2, 4, 8, 16, 32, …)


• Instead of powers of 10 (1, 10, 100, 1000, …)

• Counting in binary or base 2:


• 01
• 1 binary digit represents 1 choice from 2; counts 2 things; 2 distinct values
• 00 01 10 11
• 2 binary digits represents 1 choice from 4; 4 distinct values
• 000 001 010 011 100 101 110 111
• 3 binary digits …

• Binary numbers are shorthand for sums of powers of 2


• 11011 = 1 x 16 + 1 x 8 + 0 x 4 + 1 x 2 + 1 x 1
• = 1 x 24 + 1 x 2 3 + 0 x 2 2 + 1 x 2 1 + 1 x 2 0

• Counting in "base 2", using powers of 2


Binary (base 2) arithmetic
• Works like decimal arithmetic, but simpler

• Addition:
• 0+0=0
• 0+1=1
• 1+0=1
• 1 + 1 = 10

• Subtraction, multiplication, division are analogous


Bytes
• "byte" = group of 8 bits
• On modern machines, the fundamental unit of processing and memory addressing
• Can encode any of 28 = 256 different values, e.g., numbers 0 .. 255 or a single letter like A or digit like 7 or
punctuation like $
• ASCII character set defines values for letters, digits, punctuation, etc.

• Group 2 bytes together to hold larger entities


• Two bytes (16 bits) holds 216 = 65536 values
• A bigger integer, a character in a larger character set
• Unicode character set defines values for almost all characters anywhere

• Group 4 bytes together to hold even larger entities


• Four bytes (32 bits) holds 232 = 4,294,967,296 values
• An even bigger integer, a number with a fractional part (floating point), a memory address

• Recent machines use 64-bit integers/addresses (8 bytes)


• 264 = 18,446,744,073,709,551,616
Interpretation of bits depends on context
• Meaning of a group of bits depends on how they are interpreted:
• e.g. 1 byte could be
• 1 bit in use, 7 wasted bits (e.g., M/F in a database)
• 8 bits storing a number between 0 and 255
• An alphabetic character like W or + or 7
• Part of a character in another alphabet or writing system (2 bytes)
• Part of a larger number (2 or 4 or 8 bytes, usually)
• Part of a picture or sound
• Part of an instruction for a computer to execute:
• Instructions are just bits, stored in the same memory as data.
• Different computers use different bit patterns for their instructions.
• Laptop, cellphone, game machine, etc., all potentially different.
• Part of the location or address of something in memory
• ...

• One program's instructions are another program's data


• When you download a new program from the net, it's data
• When you run it, it's instructions
Powers of two, powers of ten
• 1 bit = 2 possibilities
• 2 bits = 4 possibilities
• 3 bits = 8 possibilities
• ...
• n bits = 2n

• 210 = 1,024 is about 1,000 or 1K or 103


• 220 = 1,048,576 is about 1,000,000 or 1M or 106
• 230 = 1,073,741,824 is about 1,000,000,000 or 1G or 109
• The approximation is becoming less good but it's still good enough for estimation

• Terminology is often imprecise:


• "1K" might mean 1000 or 1024 (103 or 210)
• "1M" might mean 1000000 or 1048576 (106 or 220)
Converting binary to decimal
• From right to left:
• If bit is 1 add corresponding power of 2, i.e. 20, 21, 22, 23 (Rightmost
power is zero)

• 11012 = 1 x 20 + 0 x 21 + 1 x 22 + 1 x 23
• =1x1+0x2+1x4+1x8
• = 1310
Converting decimal to binary
• Repeat while the number is > 0:
• Divide the number by 2
• Write the remainder (0 or 1)
• Use the quotient as the number and repeat
• The answer is the resulting sequence in reverse (right to left)
order
• e.g. 1310
Divide 13 by 2, write "1", number is 6
Divide 6 by 2, write "0", number is 3
Divide 3 by 2, write "1", number is 1
Divide 1 by 2, write "1", number is 0
Answer is 11012
Hexadecimal notation

• Binary numbers are bulky

• Hexadecimal notation is a shorthand combining


• 4 bits into a single digit, written in base 16
• A more compact representation of the same information

• Hex uses the symbols A B C D E F for the digits 10 .. 15


• 0123456789ABCDEF
ASCII again
Color
• TV & computer screens use Red-Green-Blue (RGB) model

• Each color is a combination of red, green, blue components


• R+G = yellow, R+B = magenta, B+G = cyan, R+G+B = white

• For computers, a pixel is usually specified by three numbers


giving amount of each color, on a scale of 0 to 255 (i.e. 24 bits)

• This is often expressed in hexadecimal so the three components


can be specified separately (in effect, as bit patterns)
• 000000 is black, FFFFFF is white

• Printers, etc., use cyan-magenta-yellow[-black] (CMY[K])


[Example] Representation of numbers
• 정수의 표현
• 부호-크기 방식
• 제일 왼쪽 비트(MSB: Most Significant Bit): 정수의 부호
• 나머지 비트: 정수의 절대값
[Example] Representation of numbers
• 실수의 표현
• 정규화 부동소수점실수
[Example] Representation of characters
• ASCII 코드
• 미국 표준국(ANSI)에서 영어 문자를 위해 제정한 코드
• 알파벳, 숫자, 문법 기호, 제어 부호로 원래 7 비트
• ISO에서 1 비트 추가하여 8 비트
• 예) “Happy!”

• 한글: 초성, 중성, 종성


• ASCII와 같이 8 비트로는 불가능
• 조합형 및 완성형 코드
• UTF-8, UTF-16
[Example] Representation of Multimedia
• 멀티미디어 정보의 특성
• 멀티미디어 데이터: 숫자, 문자, 사운드, 이미지, 그래픽, 동영상 등, 동일한 바이너리 데이터를
다르게 해석

• 특성: 데이터 용량이 매우 크다 à 데이터의 압축


용도와 환경에 따라 다양한 형태로 표현
[Example] Representation of Multimedia
• 이미지(Image)의 표현
• 실 세계 장면은 아날로그 형태로 존재
• 디지털 이미지는 픽셀(Pixel)로 구성
• 수직, 수평 방향의 픽셀
• 예) 수직, 수평 방향으로 각각 1000개의 픽셀
1000 x 1000 = 1,000,000 픽셀
• RGB 컬러 모델
• 각 픽셀을 표현하기 위해 (Red, Green, Blue) 각 컬러가 1 바이트
• 예) 1,000,000 픽셀 x 3 바이트 = 3백만 바이트(3Mbytes)
• 대표적 이미지 압축: JPEG
The End of Lecture

You might also like