Download presentation
Presentation is loading. Please wait.
Published byLinda Gallagher Modified over 9 years ago
1
Computer System & Binary Review
2
Memory Model What memory is supposed to look like
3
Memory Model What each process actually has:
4
The Instruction Machine Instruction: 00000001000010010101000000100000
5
Assembly – Equivalent to instructions from levels 1, 2, 3
6
1 bit = 2 patterns2 bits = 4 patterns3 bits = 8 patterns Bits And Bit Patterns N bits gives 2 n possible patterns
7
Metric Units Standard metric units
8
Explaining Size What the hell MS?
9
Bi units Metric prefixes – May refer to powers of 2 or 10 – Roughly equivalent GB GB 10 9 = 1000000000 ~ 1073741824 = 2 30
10
Bi units Memory measured in powers of 2 Network / Processor in powers of 10 Disk – manufactures powers of 10 – OS powers of 2 2 TB = 2 * 10 12 2 * 10 12 / 2 40 = 1.819 GiB
11
Bytes 8 bits = 1 byte How long does a 10 Meg/sec internet connection take to download a 10 Meg file?
12
Bytes How long does a 10 Meg/sec internet connection take to download a 10 Meg file? – Networks measured in bits using powers of 10 – Files in bytes using powers of 2 10Mbit internet = 10,000,000 bits per second = 1,250,000 bytes per second 10MB file = 10 * 2 20 = 10,485,760 bytes 10,485,760 / 1,250,000 = 8.39 seconds
13
Bases Place based number representations: thirty-twos 2 5 sixteens 2 4 eights 2 3 fours2 twos 2 1 ones 2 0 101101 ten thousands 10 4 thousands 10 3 hundreds 10 2 tens 10 1 ones 10 0 12059
14
Specifying Base Specify base as subscript: 6 10 = 110 2
15
Binary Number Conversions 64 + 32 + 8 + 1 = 105 01101001 2 = 105 10 Table Method: 64 + 32 + 8 + 1 = 105 01101001 2 = 105 10 1286432168421 01101001
16
Divide Method 1. Write out the Decimal number. 2. Is it odd or even? If ODD, write a '1'. If EVEN, write a '0'. 3. Divide the Decimal number by 2, and ignore the remainder (e.g., 105 / 2 = 52.5, ignore the remainder = 52). 4. Go back to step 2, always building the Binary number from right to left. 5. When you get to 0, you're done. Add enough zeros to the left of the Binary number to make 8 digits. 105odd1 ÷ 2 52even01 ÷ 2 26even001 ÷ 2 13odd1001 ÷ 2 6even01001 ÷ 2 3odd101001 ÷ 2 1odd1101001 ÷ 2 0done 01101001
17
Multiply Method Current numberFirst DigitOld Total x 2Total 011010010 00 1101001101 101001123 01001066 100111213 001026 01052 11104105
18
Hex Hexdecimal = base 16 – 4 bits = 1 hex digit
19
Hex Numbers 1A3 16 = 1 * 256 + 10 * 16 + 3 * 1 256 + 160 + 3 = 419 10 OR 1 A 3 = 0001 1010 0011 2 4096256161 1A3
20
Hex Conversion Convert with division 419 16 to base 10 Number QuotientRemainder ÷ 16 41926 33 ÷ 16 261 10 (A)A3 ÷ 16 10 11A3
21
Specifying Bases Leading 0 Octal (base 8) Leading 0x Hex (base 16)
22
ASCII Maps a byte of memory to chars/ control symbols
23
Unsigned Binary Addition Adding base 2: 1 = 1 2 = 10 = keep 0 and carry 1 3 = 11 = keep 1 carry 1 111 0101 0111 1100
24
Unsigned Addition Overflow : Carry out of highest bit – Error! 13 + 7 = 4? 1111 1101 0111 0100
25
Signed numbers 2's complement system: – Positive numbers normal, but must have a 0 in left bit – Negative numbers: Start with 1 Value defined as inverse of – Flip all bits then add 1
26
Signed numbers What is 1001? 1001 Negative number 0110 reverse 6 As decimal 7 Add one -7 = 1001
27
Signed numbers Make -3 0011 start with 3 1100 reverse bits 1101 + 1 1101 Two’s complement -3
28
2’s complement 1 + (-2) 0001 1110 ------ 1111
29
2’s complement 7 + 7 0111 0111 ------ 1110 = -2??? Overflow switches sign
30
4 bits Biggest positive: 7 -1 : Lowest negative: -8 0111 1000 0111Flip (7) +1 = 8 1111
31
2’s complement Cary into final column and no extra carry – Positive overflow! – Ex: 4 + 6 (sign bits are blue) 0100 0100 0110 1010
32
2’s complement Extra carry and no carry in final column – Negative overflow! – Ex: -4 + -6 (sign bits are blue) 1000 1100 1010 0110
33
2’s complement No final column carry & no extra carry – Success 0000 0100 0010 0110
34
2’s complement Final column carry & extra carry – Success – ignore extra carry 1100 1101 1110 1011
35
2’s complement Pros – One zero – Easy to switch sign – Consistent direction Cons – Break : - above +
36
Signed - Excess Notation Excess Notation : start counting from a negative number – Used in some situation Pros: – Values are properly ordered Cons: – Harder to read Need to know starting point – Normal math does not work BinaryValue 000-4 001-3 010-2 011 1000 1011 1102 1113
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.