17

I am reading William Stallings' Operating Systems: Internals and Design Principles (Seventh Edition), and a passage about memory hierarchy got me confused. What does the author mean when he mentions a "greater cost per bit"?

Here is what the relevant paragraph on page 24 says:

As might be expected, there is a trade-off among the three key characteristics of memory: namely, capacity, access time, and cost. A variety of technologies are used to implement memory systems, and across this spectrum of technologies, the following relationships hold:

  • Faster access time, greater cost per bit
  • Greater capacity, smaller cost per bit
  • Greater capacity, slower access speed

I understand that the lower you go down the pyramid of the memory hierarchy the slower the access time.

Like, a magnetic disk or SSD card will have slower access times than the CPU registers or cache or the RAM.

But what does it mean for there to be a "greater cost per bit"? Does it slow down other processes to access this memory? That would seem counter-intuitive as the access times are supposed to be faster? Do they just take up more space and therefore there is less of it?

  • 1
    Could you quote the relevant sentence/paragraph/sentence verbatim? – Bob Oct 3 '17 at 7:22
  • 37
    The author is referring to "cost" as a monetary expense. – sawdust Oct 3 '17 at 9:34
  • 8
    Author is trying to avoid specific denominations in this generalization... this version is presumably more general-purpose than "dollars per byte", "euros per yobibyte", "ha'pennies per nibble", "shiny rocks per tryte", or "chickens per qutrit" – A C Oct 3 '17 at 14:23
  • 1
    Don't worry, that's a hardware problem. – Samuel Oct 3 '17 at 18:15
  • 1
    If you can get 1GB for $8 then that's 8000000000 bits for $8, so that's $0.000000001 for each bit. – user253751 Oct 3 '17 at 21:58
26

The cost per bit is the monetary cost (i.e. in dollars and cents) per unit of memory, thats all, ie a way of saying "assuming the amount of memory required is the same". (You could equally say the cost per gig of memory - but mentioning the size implies a usage case. A bit is very arguably the smallest amount that can be stored)

  • 7
    I wonder if you arn't overthinking this. The cost can be thought of in $ (or cents) it costs to store the amount of memory. At the risk of confusing you more (I hope I don't) - if I want to store 1TB of data, I can store it on an SSD or a hard drive - the SSD will be fast, but will cost about $500, while the hard drive might cost $100. Thus faster access time means more per unit of storage. Similarly, if I want to store TB of data it will cost me about $160, as opposed to say $60 for 1TB - thus the cost per TB for 5 TB is $40 as opposed to $60 for 1TB and thus smaller cost per bit... – davidgo Oct 3 '17 at 7:46
  • 5
    "cost per bit" is equivalent to cost per megabyte for hard drives : I bought a hard drive for my Atari back in 1989 and it was $250 for 10 MB , now you can get 1TB for $60 so the cost per megabyte has gone down... – Solar Mike Oct 3 '17 at 7:53
  • 4
    I was overthinking it. So the "cost" is referring to how much the memory would cost to buy with currency. I was confused because I thought it referred to some detriment of some other process memory. – Darien Springer Oct 3 '17 at 7:56
  • 2
    I'm pleased you seem to get it now. – davidgo Oct 3 '17 at 7:57
  • 2
    Since the OP's confusion centers on the word "cost" (i.e. that it means cost in terms of money), I would suggest incorporating this into the answer. – Jon Bentley Oct 3 '17 at 11:43
26

The cost per bit is just the price you have to pay for specific amount of memory.

If some amount of brand X memory costs $20 and the same amount of brand Y memory costs $25, then brand X has better cost per bit. The cost per bit differences are much more pronounced when comparing different kinds of memory (SRAM, DRAM, flash, SSD...)

3

In addition to these other answers that rightly mention that cost per bit is the amount of money per bit:

If you have memory that stores 1024 bytes, that's 8192 bits. If that memory cost you $10 then it would be $10(cost)/8192 bits, or $0.001220703125 per bit. If you had memory with a faster access time, maybe it would cost $20 instead, in which case you'd have $0.00244140625 per bit.

Faster access time: $0.00244140625  cost per bit 
Greater capacity:   $0.001220703125 cost per bit
1

I think the bit that other answers are missing is what Stallings is saying about the perpetual relationship between the three scenarios:

Let's say you have some memory, any memory, that costs $10 for a 1GB stick with a 10ns access time...therefore $10/GB.

What Stallings is saying that if you want faster storage, it will cost more, say $15 per 1GB with a 5ns access time = $15/GB - a higher cost per bit, compared to the previous memory.

If you wanted larger sticks, it might cost you $15 for 2GB, this time lowering the cost per bit - $7.50 per GB. However this larger stick will have a slower access time, say 12ns.

However, you may be able to get a premium version of the larger stick that still has an access time of 10ns, but this would cost even more - perhaps $18 ($9/GB).

As Stallings says, "there is a trade-off among the three key characteristics of memory: namely, capacity, access time, and cost". And he correctly suggests that, just as this is currently the case, this was the case for previous technologies/generations of memory, and will be the case for future memory technologies/generations.

[1GB = (1024)(1024)(1024)(8) = 8589934592 bits. Therefore, literal cost per bit for our $10 memory (above) would be $0.0000000012 per bit]

  • While your example also works, this is usually not applied to the same technology. This is a very well known statement in hardware design and usually is taken to mean that different technologies have different properties: E.g. you can either have a small but very fast and expensive L1 cache or you can get GBs for almost free when using DDR RAM. And if you go one step further you can get TBs by using some hard disk. And so on. It's the orders of magnitudes that count. – Voo Oct 4 '17 at 13:38
  • @Voo While the scale is different, the principles are the same. However it is not the magnitude that matters - it is the principle that there is a trade-off between the competing factors.You can get cheap, fast or large, but not all three.One might expand the argument by adding in physical size, power consumption/heat. When designing your OS/application/appliance/device, you have to balance these things out. – CJM Oct 4 '17 at 15:51
  • Yes the principle is what matters. I'm just pointing out the general usage in the community where that statement is usually used - hardware design. You worry about whether to read something from cache, memory or hard disk, not whether your memory is 5% faster or not. – Voo Oct 4 '17 at 16:13
  • @Voo I'm with CJM, and I was going to post a similar answer if he hadn't done so already. This isn't just used in hardware design, it's also used by system architects, to determine the best configuration they can afford. – Barmar Oct 6 '17 at 18:33
-1

Specifically, the CPU registers are the fastest, most expensive type of memory. They take up the most valuable real estate in the whole PC. The various levels of caches are further away from the actual computation, and electrical signal propagation time starts to be a consideration. You can't build the whole thing out of registers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.