3 ms·
Did you initialize table_ints by writing to every page before running the test? If you didn't, this could instead be measuring accesses to the zero page.
by twtw 8y ago
Did you initialize table_ints by writing to every page before running the test? If you didn't, this could instead be measuring accesses to the zero page.
- petermcneeley 8y agoRelated: did you see this horrible bug https://www.youtube.com/watch?v=kPR8h4-qZdk&feature=youtu.be&t=1500 https://www.youtube.com/watch?v=kPR8h4-qZdk&feature=youtu.be...
- dhuramas 8y agoWhat's zero page? Where can I read more about it? Wikipedia[1] suggests in modern operation systems "actually make the zero page inaccessible to trap uses of NULL pointers". [1] https://en.wikipedia.org/wiki/Zero_page https://en.wikipedia.org/wiki/Zero_page
- petermcneeley 8y agoYa its not that Zero page. This is just a page of zeros. When you allocate virtual memory the OS gives you the virtual allocation but the physical allocation points to the page of zeros. So when you read you get zeros. Only when you write does the OS allocate a real physical page of memory (which is should zero before handing over to the application). The reason why is important for the random read test is that if he does not initialize memory he might not be reading from dram but constantly reading the zero page which would be very fast.
- deleted 8y ago[deleted]
- abainbridge 8y agoYes I did. But thanks for the comment.
- twtw 8y agoAwesome, just wanted to check. I'd very much enjoy reading a blog post about your findings, if you are interested in writing one. Thanks for sharing, modern CPUs really are quite incredible.