Shared Flashcard Set

Details

08.01: Counting and Addressing
08.01: Counting and Addressing
11
Computer Science
Undergraduate 3
12/09/2019

Additional Computer Science Flashcards

 


 

Cards

Term
What is the order of binary prefixes, starting from Ki and ending in Ei? What are their values in bytes (base 2)?
Definition
  1. Ki = kibi = 2^10 bytes
  2. Mi = mebi = 2^20 bytes
  3. Gi = gibi = 2^30 bytes
  4. Ti = tebi = 2^40 bytes
  5. Pi = pebi = 2^50 bytes
  6. Ei = exbi = 2^60 bytes
Term
How many 2 KiB chunks are there in 1 GiB?
Definition
  1. 1 GiB = 2^30 bytes
  2. 2 KiB = 2 × 2^10 = 2^11 bytes
  3. answer: 2^30 / 2^11 = 2^19 chunks
Term
How many 8 KiB chunks are there in 128 MiB?
Definition
  1. 128 MiB = 2^7 * 2^20 = 2^27 bytes
  2. 8 KiB = 2^3 × 2^10 = 2^12 bytes
  3. answer: 2^27 / 2^13 = 214 chunks
Term
If you have n number of chunks to store what range of bit addresses are needed?
Definition
You need ceiling[log2(n)]-bit addresses.
Term
How many bits in an address are needed to store 7 chunks of data.
Definition
ceiling[log2(7)] bits = 3 bits are needed. So a 3-bit address is needed
Term
Say we have a parking lot with 3000 spots, and we structure them in blocks of 100 spots. What is the index of spot 3212 in its block?
Definition
Block index = (Global index) % (spots/block) = 3212 % 100 = 12
Term
Say we have a parking lot with 3000 spots, and we structure them in blocks of 100 spots. In what block is spot 3212?
Definition

Answer from slides:

Block = floor[(Global index) / (spots/block)] = floor(3212 / 100) = 32

 

My answer:

Block = ceiling[(Global index) / (spots/block)] = ceiling(3212 / 100) = 33

 

Logic:

block 1: 1-100

block 2: 101-200

...

block 31: 3101-3100

block 32: 3201-3200

block 33: 3201-3300

Term
Say we have a parking lot with 3000 spots, and we structure them in blocks of 100 spots. What is the global index of spot 5 in block 20?
Definition

Answer from slides:

Global index = (block * spots/block) + local index = (20 * 100) + 5 = 2005

 

My answer:

Global index = [(block - 1) * spots/block] + local index = 1905

 

Logic:

block 1: 1-100

block 2: 101-200

...

block 18: 1701-1800

block 19: 1801-1900

block 20: 1901-2000

Term
Say we have a parking lot with 800 spots, and we structure them in blocks of 10 spots.  What is the index of spot 312 in its block?
Definition
index = 312 mod 10 = 2
Term
Say we have a parking lot with 800 spots, and we structure them in blocks of 10 spots.  In what block is spot 145?
Definition

Answer from slides:  block = 14

 

My answer:

block = ceiling(145/10) = 15

 

Logic:

block 1: 1-10

block 2: 11-20

block 3: 21-30

block 4: 31-40

block 5: 41-50

block 6: 51-60

block 7: 61-70

block 8: 71-80

block 9: 81-90

block 10: 91-100

block 11: 101-110

block 12: 111-120

block 13: 121-130

block 14: 131-140

block 15: 141-150

Term
Say we have a parking lot with 800 spots, and we structure them in blocks of 10 spots.  What is the global index of spot 8 in block 12?
Definition

Answer from slides: 128

 

My answer:

Global index = [(block - 1) * spots/block] + index

                   = [(12 - 1) * 10] + 8

                   = 118

Logic:

block 1: 1-10

block 2: 11-20

block 3: 21-30

block 4: 31-40

block 5: 41-50

block 6: 51-60

block 7: 61-70

block 8: 71-80

block 9: 81-90

block 10: 91-100

block 11: 101-110

block 12: 111-120

 

Supporting users have an ad free experience!