HN user

nchong

8 karma

Hardware and software hacker.

Posts1
Comments2
View on HN

Yup, these are great slides, especially pg 11-14 about memory models.

Weakly consistent memory models contain all sorts of horrors for programmers that think sequentially consistently. Can the following program throw an assertion error?

  //Initially, x = y = 0
  Processor 1: x = 1;
  Processor 2: while (x == 0) {/*do nothing*/}; y = 1;
  Processor 3: while (y == 0) {/*do nothing*/}; assert (x == 1);
(On an ARM processor this assertion can legally fire (x can equal 0 for Processor 3); and you can s/Processor/Thread/ and still have this result hold)

Volume 3A of the Intel Architecture Manual is worth a read if you like these type of puzzles (http://www.intel.com/products/processor/manuals/).

For those that want a formal approach then good things are happening in Cambridge: http://www.cl.cam.ac.uk/~pes20/weakmemory/

In that case I fully recommend that you also check out Steve Furber's "ARM System-on-Chip Architecture" as a very readable introduction to ARM assembler and an easy way to learn about the microarchitecture and design philosphy of early ARM processors (ARM7 and ARM9) [Furber was one of the original engineers that worked on the first ARM design].

The architecture has come along quite a bit since those days so if you'd like the most up to date release you need to look for the ARM v7AR Architecture Reference Manual which you can get (with a click-through) here: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0406b/in...

This will cover you up to the latest cores like Cortex-A8 inside the Beagleboard and Cortex-A9. Enjoy!