Memory Size Calculations
This is one thing that's often misunderstood and confused by me. There are two different things referred to when memory sizes are mentioned in discussions.
- Simply number of bits or bytes - Then we need to know how much memory is needed to store the bits.
- Size of the payload - Then we already know the size. No further calculation needed.
We can just convert between bits and bytes by dividing or multiplying by 2ยณ.
different ways of representing
- When number of bits are given - if it's power of 2, then we can directly refer to the table.
- When the number of bits isn't power of 2, then we can directly calculate the size required.
| Number of bits | Required Memory to Store |
|---|---|
| 2ยนโฐ | 1 KB |
| 2ยฒโฐ | 1 MB |
| 2ยณโฐ | 1 GB |
| 2โดโฐ | 1 TB |
| 2โตโฐ | 1 PB |
| 2โถโฐ | 1 EB |
Important to remember
It's important to remember this table for interviews in system design to quickly analyse space requirements.