Memory Size Calculations
This is one thing that's often misunderstood and confused by me. There exists two different things when memory sizes are mentioned in discussions.
- 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 |
|---|---|
| 1 KB | |
| 1 MB | |
| 1 GB | |
| 1 TB | |
| 1 PB | |
| 1 EB |
Important to remember
It's important to remember this table for interviews in system design to quickly analyse space requirements.