Top.Mail.Ru
? ?

Entries by tag: multicore

A Linux-kernel memory model!

A big “thank you” to all my partners in LKMM crime, most especially to Jade, Luc, Andrea, and Alan! Jade presented our paper (slides, supplementary material) at ASPLOS, which was well-received. A number of people asked how they could learn more about LKMM, which is what much of this blog post is about.

Approaches to learning LKMM include:

  1. Read the documentation, starting with explanation.txt. This documentation replaces most of the older LWN series.
  2. Go through Ted Cooper's coursework for Portland State University's CS510 Advanced Topics in Concurrency class, taught by Jon Walpole.
  3. Those interested in the history of LKMM might wish to look at my 2017 linux.conf.au presentation (video).
  4. Play with the actual model.
The first three options are straightforward, but playing with the model requires some installation. However, playing with the model is probably key to gaining a full understanding of LKMM, so this installation step is well worth the effort.

Installation instructions may be found here (see the “REQUIREMENTS” section). The ocaml language is a prerequisite, which is fortunately included in many Linux distros. If you choose to install ocaml from source (for example, because you need a more recent version), do yourself a favor and read the instructions completely before starting the build process! Otherwise, you will find yourself learning of the convenient one-step build process only after carrying out the laborious five-step process, which can be a bit frustrating.

Of course, if you come across better methods to quickly, easily, and thoroughly learn LKMM, please do not keep them a secret!

Those wanting a few rules of thumb safely approximating LKMM should look at slide 96 (PDF page 78) of the aforementioned linux.conf.au presentation. Please note that material earlier in the presentation is required to make sense of the three rules of thumb.

We also got some excellent questions during Jade's ASPLOS talk, mainly from the renowned and irrepressible Sarita Adve:

  • Question: How do we know that the model is correct?
    Answer: We verified the model socially and experimentally. [ Ed. note: See Section 1 and Table 5 of the paper and the “Detailed hardware results” from the supplementary materials. ]
  • Question: What is the intuition behind the model?
    Answer: There are a number of axioms, for example, the RCU axiom, that correspond to various intuitions. Additional axioms correspond to the load buffering and store buffering intuitions.
  • Question: How did you decide what to provide? For example, what about one of Paul's favorite primitives, sequence locking?
    Answer: The paper shows memory barrier, loads and stores, acquire and release, and read-modify-write atomic operations. We have since added locking, which in combination with some of the other operations allows sequence locking to be easily implemented within litmus tests. [ Ed. note: Not sure that sequence locking makes my list of favorites, but we do have a pair of sequence-locking litmus tests in preparation. ]
There were of course a great many other excellent presentations at ASPLOS, but that is a topic for another post!

HOTPAR 2009

I was fortunate to be able to attend the USENIX Workshop on Hot Topics in Parallelism (HOTPAR 2009), which was held on March 30-31 at Berkeley, CA. (Of course, I am sure that my wife will be expecting something special for Mothers Day in return for her agreeing to fund my trip out of household expenses. Good thing that I have a little time to ponder on this!)

The workshop was attended mainly by graduate students, professors, and industry researchers. There were also a few token practitioners such as myself.

My main impression of the workshop was of a bunch of people working their way through the grieving process:

  1. Denial. “It should be possible for Somebody Else to Do Something so that I don't need to change anything or learn anything new.” Thankfully, most people seemed to have gotten past this stage.
  2. Anger. “It is dinosaurs such as yourself who are holding up new thinking in the field.” There were only a few people in this stage, and almost all of them were susceptible to reason.
  3. Bargaining. “OK, I do need to change and perhaps even learn something new. But all parallel software environment must support determinism!” A lot of people seemed to be at this stage, sometimes with other properties substituted for determinism.
  4. Depression. There didn't appear to be very many depressed people. Perhaps they were so depressed that they just stayed home.
  5. Acceptance. There were more people at this stage than I would have expected, particularly in the transactional memory community. More on this later.

Why the grieving, you ask? My personal opinion is that a large number of software projects and communities willfully ignored parallelism until about five years ago. As a result, many software facilities and APIs were designed with strictly sequential execution in mind, in turn meaning that the advent of low-cost ubiquitous parallelism had the effect of turning what were eminently reasonable design choices into glaring design flaws. Therefore, much activity in the new multicore arena is directed to attempting to reconcile these new design flaws with parallel execution. Those in denial are often unwilling to see problems with these existing facilities and APIs, instead preferring to think in terms of “problems with parallelism.&rdquo People in these groups tended to make interesting unsupported assertions such as “all parallel programs must be deterministic” or “library functions must be arbitrarily composable.”

My approach was to question these assumptions, asking why they were needed or beneficial, and occasionally what other assumptions they had considered making. This provoked a number of interesting reactions. In the tougher cases, I resorted to asking what decades-old production-quality software environment has enabled parallel-naive developers to keep large parallel systems usefully busy. I was disappointed that no one was able to give the correct answer.

Another young person was quite surprised that DYNIX/ptx ran on 30-CPU systems in the early 1990s. He kept asking if it was a special “cut down” operating system. I assured him that DYNIX/ptx was a full-fledged operating system, complete with real processes, file systems, and even virtual memory. I don't think he believed me. I just didn't have the heart to tell him that Linux runs on systems with thousands of CPUs.

One of the nicest things about the workshop was the opportunity to meet a number of the long-time parallel heavyweights. I had a number of extremely stimulating and thought-provoking conversations with Maurice Herlihy and Mark Moir, and also was able to meet David Patterson, Tim Harris, Jim Larus, and others, as well as renewing a number of other acquaintances.

Of course, I found myself explaining RCU to any number of people, including one young man who had the rare ability to intuit Classic RCU given the prohibition against blocking in RCU read-side critical sections. These conversations were mainly with younger attendees. I will leave it to the reader to decide whether this is because these young people have sufficient enthusiasm and flexibility of thought to accommodate RCU, or whether they are simply young and naive. I have my story and I am sticking with it!

The papers are available. I was most interested in the three transactional-memory papers:


  1. Lightweight Software Transactions for Games by Baldassin and Burckhardt was extremely interesting. They attempted to parallelize a shoot-em-up game, in one case using locking and in the other case using transactional memory. They ran into the usual issues including deadlock with locking, but found pretty much the same level of difficulty with transactional memory. They successfully parallelize the program by partitioning it completely, and including a data-reconciliation step between each frame. They twisted the definition of transactional memory to include this partitioning/reconciliation implementation, which got mixed reviews from the audience.
  2. Exceptions and Transactions in C++ by Adl-Tabatabai and many others outlined problems integrating transactional memory with the C++ exception mechanism. The argument between abort-on-exception and commit-on-exception was resolved by allowing the developer to choose on a case-by-case basis. [Of course, the C++ exception mechanism is a relatively simple case in that you cannot resume execution in the middle of the transaction after handling the exception. Integration of transactional memory with POSIX signal handlers, which are capable of such resumption, promises to be even more interesting.]
  3. Transactional Memory Should Be an Implementation Technique, Not a Programming Interface by Boehm took the refreshing view that locking should be the API seen by developers, and that transactional memory should simply be one of the optimizations available to the underlying software environment. Needless to say, this paper sparked significant discussion.


All in all, an interesting and stimulating session. It will be interesting to see what comes up in next year's session!

Profile

inside
paulmck
Paul E. McKenney
Website

Latest Month

October 2024
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  

Syndicate

RSS Atom

Comments

Powered by LiveJournal.com
Designed by Tiffany Chow