Computer System & Binary Review. Memory Model What memory is supposed to look like.
-
Upload
linda-gallagher -
Category
Documents
-
view
221 -
download
0
Transcript of Computer System & Binary Review. Memory Model What memory is supposed to look like.
![Page 1: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/1.jpg)
Computer System & Binary Review
![Page 2: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/2.jpg)
Memory Model
• What memory is supposed tolook like
![Page 3: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/3.jpg)
Memory Model
• What each process actually has:
![Page 4: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/4.jpg)
The Instruction
• Machine Instruction:00000001000010010101000000100000
![Page 5: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/5.jpg)
Assembly
• Assembly– Equivalent to instructions
from levels 1, 2, 3
![Page 6: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/6.jpg)
1 bit = 2 patterns 2 bits = 4 patterns 3 bits = 8 patterns
Bits And Bit Patterns
• N bits gives 2n possible patterns
![Page 7: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/7.jpg)
Metric Units
• Standard metric units
![Page 8: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/8.jpg)
Explaining Size
• What the hell MS?
![Page 9: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/9.jpg)
Bi units
• Metric prefixes– May refer to powers of
2 or 10– Roughly equivalent
GB GB 109 = 1000000000 ~ 1073741824 = 230
![Page 10: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/10.jpg)
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 * 1012 2 * 1012 / 240 = 1.819 GiB
![Page 11: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/11.jpg)
Bytes
• 8 bits = 1 byte
• How long does a 10 Meg/sec internet connection take to download a 10 Meg file?
![Page 12: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/12.jpg)
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 * 220 = 10,485,760 bytes
10,485,760 / 1,250,000 = 8.39 seconds
![Page 13: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/13.jpg)
Bases
• Place based number representations:
thirty-twos
25
sixteens24
eights23
fours22
twos21
ones20
1 0 1 1 0 1
ten thousand
s104
thousands
103
hundreds102
tens101
ones100
1 2 0 5 9
![Page 14: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/14.jpg)
Specifying Base
• Specify base as subscript:610 = 1102
![Page 15: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/15.jpg)
Binary Number Conversions
• Table Method:
64 + 32 + 8 + 1 = 105
011010012 = 10510
128 64 32 16 8 4 2 1
0 1 1 0 1 0 0 1
![Page 16: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/16.jpg)
Divide Method1. 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.
105 odd 1
÷ 2 52 even 01
÷ 2 26 even 001
÷ 2 13 odd 1001
÷ 2 6 even 01001
÷ 2 3 odd 101001
÷ 2 1 odd 1101001
÷ 2 0 done 01101001
![Page 17: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/17.jpg)
Multiply Method
Current number First Digit Old Total x 2 Total
01101001 0 0 0
1101001 1 0 1
101001 1 2 3
01001 0 6 6
1001 1 12 13
001 0 26 26
01 0 52 52
1 1 104 105
![Page 18: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/18.jpg)
Hex
• Hexdecimal = base 16– 4 bits = 1 hex digit
![Page 19: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/19.jpg)
Hex Numbers
• 1A316 =
1 * 256 + 10 * 16 + 3 * 1256 + 160 + 3 = 41910
OR
1 A 3
= 0001 1010 00112
4096 256 16 1
1 A 3
Decimal Binary Hex 0 0 0 1 1 1 2 10 2 3 11 3 4 100 4 5 101 5 6 110 6 7 111 7
8 1000 8 9 1001 9
10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F
![Page 20: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/20.jpg)
Hex Conversion
• Convert with division 41916 to base 10
Number Quotient Remainder
÷ 16 419 26 3 3
÷ 16 26 1 10 (A) A3
÷ 16 1 0 1 1A3
![Page 21: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/21.jpg)
Specifying Bases
• Leading 0 Octal (base 8)• Leading 0x Hex (base 16)
![Page 22: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/22.jpg)
ASCII
• Maps a byte ofmemory to chars/control symbols
![Page 23: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/23.jpg)
Unsigned Binary Addition
• Adding base 2:• 1 = 1• 2 = 10 = keep 0 and carry 1• 3 = 11 = keep 1 carry 1
1 1 10 1 0 10 1 1 11 1 0 0
![Page 24: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/24.jpg)
Unsigned Addition
• Overflow : Carry out of highest bit– Error!
• 13 + 7 = 4?
1 1 1 11 1 0 10 1 1 10 1 0 0
![Page 25: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/25.jpg)
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
![Page 26: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/26.jpg)
Signed numbers
What is 1001? 1001 Negative number
0110 reverse
6 As decimal
7 Add one
-7 = 1001
![Page 27: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/27.jpg)
Signed numbers
Make -3 0011 start with 3
1100 reverse bits
1101 + 1
1101 Two’s complement -3
![Page 28: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/28.jpg)
2’s complement
1 + (-2)
00011110------
1111
![Page 29: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/29.jpg)
2’s complement
7 + 7
01110111------
1110 = -2??? Overflow switches
sign
![Page 30: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/30.jpg)
4 bits
• Biggest positive: 7
• -1 :
• Lowest negative: -8
0 1 1 1
1 0 0 00 1 1 1 Flip (7)
+1 = 8
1 1 1 1
![Page 31: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/31.jpg)
2’s complement
• Cary into final column and no extra carry– Positive overflow!– Ex: 4 + 6 (sign bits are blue)
0 1 0 00 1 0 00 1 1 01 0 1 0
![Page 32: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/32.jpg)
2’s complement
• Extra carry and no carry in final column– Negative overflow!– Ex: -4 + -6 (sign bits are blue)
1 0 0 01 1 0 01 0 1 00 1 1 0
![Page 33: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/33.jpg)
2’s complement
• No final column carry & no extra carry– Success
0 0 0 00 1 0 00 0 1 00 1 1 0
![Page 34: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/34.jpg)
2’s complement
• Final column carry & extra carry– Success – ignore extra carry
1 1 0 01 1 0 11 1 1 01 0 1 1
![Page 35: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/35.jpg)
2’s complement
• Pros– One zero– Easy to switch sign– Consistent direction
• Cons– Break : - above +
![Page 36: Computer System & Binary Review. Memory Model What memory is supposed to look like.](https://reader033.fdocuments.in/reader033/viewer/2022042616/56649e5f5503460f94b59beb/html5/thumbnails/36.jpg)
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
Binary Value
000 -4
001 -3
010 -2
011 -1
100 0
101 1
110 2
111 3