Core51_3:



Lecture 3: Bits, Bytes and Packets

File sizes

Bit: (Binary Digit):

The smallest unit of memory. Can take on one of two

values (0 or 1). (All data in a computer is represented as a pattern of bits.)

Boolean Operations:

And:

0 0 = 0

0 1 = 0

1 0 = 0

1 1 = 1

Or:

0 0 = 0

0 1 = 1

1 0 = 1

1 1 = 1

XOR (exclusive or)

0 0 = 0

0 1 = 1

1 0 = 1

1 1 = 0

0 is false

1 is true

P AND Q

EX.

2 statements if both are true, then true

I got an A in core51 and I got an A in my Math class

Or P OR Q. P represents one statement and q represents another. True – when one is true.

XOR. No English to explain. 1 (true) when one of its inputs is 1 (true) and the other is 0 (false). Ex. A statement of P XOR Q means “either P or Q but not both”.

There is also NOT operation. Fozzie is a bear, fozzie is not a bear.

Gate: device that produces the output of a Boolean operation when given the operation’s input values.

Building blocks of how computers are constructed.

Picture Page 20 brookshear.

Flip flop is a circuit that produces an output value of 0 or 1 that remains constant until a temporary pulse from another circuit causes it to shift to the other value. If both inputs stay 0, the output won’t change, but if there’s a 1 on the upper input the output will be 1 even if upper changes back to 0 (see pic), and a 1 temporarily on the lower input will force the output to be 0.

Significance of flip-flop – ideal for storage of a bit in a computer. Can easily adjust value.

circuit that can be switched back and forth between two states.

Gate: a computer circuit with several inputs but only one output that can be activated by particular combinations of inputs

[pic]

hexadecimal notation:



hexadecimal notation – shorthand since tedious to write 10101010011 and error prone.

ex. 237

7 X 100 + 3 X 101 X 2 X 102

1101 = 13

1 X 20 + 0 X 21 + 1 X 22 + 1 X 23

Takes advantage that bits tend to have lengths in multiples of four. Single symbols to represent a pattern of 4 bits. 12 bits – only three symbols.

10110101

1011 = B

0101 = 5

B5

1010010011001000

can be reduced to A4C8.

0000 = 0



1111 = F

Binary Numbers

• 1-bit numbers:

Only two different numbers can be represented:

0

1

• 2-bit numbers:

Four different numbers can be represented:

00 - 0

01 - 1

10 - 2

11 - 3

• 3-bit numbers:

Eight different numbers can be represented:

000 - 0

001 - 1

010 - 2

011 - 3

100 - 4

101 - 5

110 - 6

111 - 7

Hexadecimal Numbers

• 4-bit binary numbers:

Sixteen different numbers can be represented:

Binary Decimal Hexadecimal

0000 0 0

0001 1 1

0010 2 2

0011 3 3

0100 4 4

0101 5 5

0110 6 6

0111 7 7

1000 8 8

1001 9 9

1010 10 A

1011 11 B

1100 12 C

1101 13 D

1110 14 E

1111 15 F

• Example:

(0100001010100101011011110001)2 = (?)16

0100 0010 1010 0101 0110 1111 0001

= (4 2 A 5 6 F 1) 16

• Example:

(AF52C) 16 = (?)2

A F 5 2 C

= (1010 1111 0101 0010 1100) 2

Byte:

A group of 8 bits. (Memory is measured by the number of bytes it contains.)

Since each bit can be either 0 or 1, there are 256 different bit patterns that can be represented with 8 bits.

ASCII Code (American Standard Code for Information Interchange):

Ascii is a standardized scheme for representing characters in

patterns of 7 bits. There are 27 = 128 ascii patterns, more than enough for upper and lower case, digits and punctuation.

(Since we use bits in groups of 8, extra bit can be used for error-checking. )

0000000-1111111 (0 – 127 = 128 characters)

1+2+4+8+16+32+64=127

As computing becomes more and more international, ASCII is being replaced by Unicode. Although ASCII is sufficient for representing English text, it is too small for other languages. Ex. The Chinese language has thousands of characters, and we need more than one byte. Unicode, a 16-bit code capable of representing 65,536.

Ex: a=97

A=65

(page 637 C book) (page 221 Reed book)

ex. Can say “a” < “b” this would be true or “A” < “a” is true too.

ASCII File (or text file):

A document that contains plain text only (e.g.,a Notepad

file). Each character of text is stored as a single byte

using the ASCII code. So a file containing 20 lines of text, with 100 characters per line, would be stored in 2000 bytes.

Binary File:

Files that contain data that is not plain text (e.g., Word documents which contain formatting information (word processing files), executable files, graphics files) are not stored as plain ASCII files. But the information is still stored in some type of binary format. They are called binary files. (What happens when you try to open a Word document in Notepad? Sometimes you see garbage characters on the screen, because those bytes don't correspond to ASCII codes.)

File Size:

The size of a file = Numbers of bytes in the file.

For plain ASCII text files, the size of the file = number of characters.

Word processing documents are larger because of the extra formatting information that is part of the file.

1KB (kilobyte) = 210 bytes = 1024 bytes (example above, a file of 20 lines of text, about 100 chars per line, would be about 2 KB)

1MB (megabyte) = 220 bytes = 1024KB (about 1,000 pages of text, each page 20 lines of 100 chars, would be about 2MB) RAM is usually measured in MB.

floppy disk can store 1.44MBm which is usually enough for several short text files.

"A picture is worth 1,000 words" - Actually, computer scientists would say that it is worth more! - 1,000 words, at an average of 5 chars per word = 5,000 chars = about 5KB. That's only enough for a very, very tiny picture. Most graphics on the web are over 30KB!

1GB (gigabyte) = 230 bytes = 1024MB

other storage devices that can store larger quantities of data: Zip disks, Jaz drives, CDs, DVDs.

1TB (terabyte) = 240 bytes = 1024GB

File Compression:

Used for large files. graphics (picture), music and video files are very large.

Sample techniques: jpeg, mp3, mpeg, LZW, MH, ...

Speed of Data Transmission:

Data are transmitted at speeds measured in bps (bits

per second).

The time it takes to download a file depends on the size of the file and the speed of the transmission.

When you connect to the Internet, slowest point is usually the connection from home.

Typical Speeds:

Modem - 56Kbps

ISDN - 64Kbps, 2 x 64 Kbps (less common -

DSL – (1.5 Mbps) (private communication channel)

Cable Modem - 1.5mbps (shared)

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download