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?

Darien Springer
  • 437
  • 1
  • 4
  • 13
  • 1
    Could you quote the relevant sentence/paragraph/sentence verbatim? – Bob Oct 03 '17 at 07:22
  • 37
    The author is referring to "cost" as a monetary expense. – sawdust Oct 03 '17 at 09: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 03 '17 at 14:23
  • The language is kind of sloppy, but the intention is to indicate a quantity: price per unit storage. You could for example express that in the unit USD/GB. The author mixed that up by saying cost (a quantity) per bit (a unit of the quantity storage). – Martijn Oct 03 '17 at 15:48
  • 1
    Don't worry, that's a hardware problem. – Samuel Oct 03 '17 at 18:15
  • Dollars per bit is a tiny, tiny amount that most brains can't handle correctly. "Cost per gigabyte" gives a much more reasonable number, and probably this question would have never been asked. – gnasher729 Oct 03 '17 at 20:07
  • 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 03 '17 at 21:58

5 Answers5

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)

Roger Lipscombe
  • 2,253
  • 3
  • 22
  • 34
davidgo
  • 68,623
  • 13
  • 106
  • 163
  • So could the cost be said to be how much memory space the specific type of memory requires? – Darien Springer Oct 03 '17 at 07:33
  • I'm not sure I understand you, but I doubt it. Replace the words "cost per bit" with cost "per unit of memory stored and see if that makes more sense to you. – davidgo Oct 03 '17 at 07:39
  • Even if I replace "cost per bit" with "cost per unit of memory" I am still confused what it means for there to be a cost. What is being charged and what does that thing lose when there is a greater cost? – Darien Springer Oct 03 '17 at 07:41
  • 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 03 '17 at 07: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 03 '17 at 07: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 03 '17 at 07:56
  • 2
    I'm pleased you seem to get it now. – davidgo Oct 03 '17 at 07: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 03 '17 at 11:43
  • 1
    Cost per bit can also be measured in something other than financial cost, if the underlying physical implementations are comparable. You can compare different types of solid-state memory based on how many transistors are needed, which can give you a better feeling for why one type of memory is more expensive than another. – chepner Oct 03 '17 at 13:37
  • "Cost per bit" seems like a strange turn of phrase though, in a world that has universally used eight-bit bytes for decades - my first guess was that the use of bit rather than byte means counting ECC memory as nine bits per byte. – Random832 Oct 03 '17 at 13:37
  • 2
    @Random832 "_Cost per bit_" will have been used because it's the lowest common denominator. Some RAM chips are (or were) one-bit wide; some (as you note) are 9-bits wide: talking of their "_cost per byte_" would be somewhat strange... certainly more strange than applying the term to byte-oriented RAM chips. – TripeHound Oct 03 '17 at 15:00
  • @DarienSpringer So all the original quote is saying is that if you want faster access (other things being equal) each bit (unit of storage) will be more expensive, and so on. – TripeHound Oct 03 '17 at 15:02
  • @davidgo: And to continue, how much would it cost to store that terabyte in RAM? (About $4000, if I can trust Google's prices, and you can find a motherboard that supports it.) How about in a fast cache memory? – jamesqf Oct 03 '17 at 16:54
  • You can totally store less than a bit of information, just make 0 and 1 have different probabilities. – PyRulez Oct 04 '17 at 00:48
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...)

gronostaj
  • 55,965
  • 20
  • 120
  • 179
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
Wayne Werner
  • 2,193
  • 2
  • 20
  • 29
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]

CJM
  • 2,617
  • 26
  • 35
  • 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 04 '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 04 '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 04 '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 06 '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.

Christopher Hostage
  • 5,649
  • 3
  • 21
  • 39