
What every programmer should know about memory, Part 1 (2007) - kercker
https://lwn.net/Articles/250967/
======
dang
[https://hn.algolia.com/?query=What%20every%20programmer%20sh...](https://hn.algolia.com/?query=What%20every%20programmer%20should%20know%20about%20memory%20points%3E20&sort=byDate&dateRange=all&type=story&storyText=false&prefix&page=0)

------
ACow_Adonis
Out of curiosity, can any hacker news types quickly tell me if there's been
any significant developments since this paper was authored that a programmer
should fundamentally consider these days?

~~~
cdoxsey
Yes. Persistent memory: [http://pmem.io](http://pmem.io). This a storage
medium accessible like memory and much faster than traditional disks. It blurs
the line between memory and disk and will fundamentally alter the way we build
systems.

For example you may no longer need a leveldb or sqlite disk store, you could
just use plain data structures in persistent memory.

An early version is currently available with i3 instances on Amazon. Expect to
hear more about this in the next few years.

~~~
gwbas1c
Oh gosh no!

We already have something similar with memory mapped files. The original .doc
format was just Word's data structures shoved in a memory-mapped file. That's
why it was so hard to make 3rd party applications compatible.

Serialization, like xml or SQLite, is needed to ensure that a file format is
interoperable among different programs and different versions of your program.
How can you add a field to a data structure in version 2 when your data
structures are so tightly coupled to your persistent data?

Furthermore, things like SQLite offer indexing that lets you find data without
needing to traverse all your RAM in a foreach loop. It abstracts away your
application's data's format from the algorithm needed to access it quickly.

And finally, what happens when your program crashes? What if your data
structures are in a bad state, or corrupt? What about transactional integrity?
How do you abstract your pointers, because the addresses of your structures
will change the next time around.

I suspect that SQLite (and similar) will have updates that take advantage of
persistent memory.

(Edit) I also suspect that persistent memory will help lower power
consumption. A device could go into a kind of a sleep mode much more easily if
it didn't need to page in and out its memory.

------
kuharich
Prior discussion:
[http://news.ycombinator.com/item?id=1394346](http://news.ycombinator.com/item?id=1394346)

------
rimher
Good idea to splice it up, makes it easier to tackle.

Link to full pdf by the way:
[http://futuretech.blinkenlights.nl/misc/cpumemory.pdf](http://futuretech.blinkenlights.nl/misc/cpumemory.pdf)

------
FrankyHollywood
This one is also very usefull: [http://igoro.com/archive/volatile-keyword-in-
c-memory-model-...](http://igoro.com/archive/volatile-keyword-in-c-memory-
model-explained/)

