I am interested in multicore programming at the kernel level. I expect this affects many areas and is probably different for each architecture. What are some must read sections of the kernel? If I wanted to compare and contrast code for an Intel I7 and an ARM Cortex-A9 MPCore where would I find the differences?
3
There is nothing special about Multicore Programming in Linux. You have to understand the whole kernel. Instead of asking specific questions, go ahead and download the Linux Source code from kernel.org and go through the README file and the source code structure. (Your question about intel and arm process is answered in README). Start reading the source code along with a good linux kernel book.
To understand the multicore operation support provided by processors and used by operating systems, diving into the code may not be the ideal method. It may be important to first understand what it does to get a framework on which to hang the many pieces that relate to how it does it. Specification deals with the problem domain, code deals with the solution domain, and in most systems there is a design process that does an object oriented or functional decomposition to relate the two.
One way to approach this question is to start with the theory of operation documentation for the architecture of interest, greping for multicore or multiprocessor, two concepts that have close affinity although there are some distinctions related to implementation, particularly on the hardware side. For the Intel architecture I found some interesting information from Volume 2, Part 2: MP Coherence and Synchronization page 2:507 of the Intel®
Itanium®
Architecture
Software Developer’s Manual
From this material, some of the following code becomes much more intelligible.
- semaphore.c must use single core and multicore appropriate methods to prevent objects that may be shared from access. This leads to finding references to spin locks.
- spinlock.c leads to some device specific usage and consequently its .h is located in files like arch/arm/include/asm/spinlock.h or arch/ia64/include/asm/spinlock.h
Certainly there is no substitute for reading the code, but there is also no substitute for reading the vendors manuals, particularly when working with one of the most complex devices on the planet.
All programming in the kernel is multi-core programming (in the sense that it has to be capable of running on multiple cores). So there’s nothing specific to that which you don’t already do for general kernel coding.
Areas of kernel programming relevant to multi-core systems are locking, scheduling, and memory access (NUMA if you’re on that type of machine).
Here’s a few good places to start:
- KenrelNewbies – Kernel Hacking
- Getting Started with Kernel Development
- Assorted free books/docs
1