Raspberry Pi

The Raspberry Pi (RPi) is a spiffy little Linux machine that’s great for hardware and software experiments. Due to its ultra-low cost, the RPi looks to be an ideal platform for students, educators and self-directed learning. Right out of the box, students can write and run C, C++ and Python programs. Advanced students can build device drivers (kernel modules), modify the kernel, and perform other experiments where complete control of the system is necessary. Since the RPi is incredibly affordable, each student can have a machine and perform experiments in safety. If a system becomes corrupted, then only that system is affected and recovery is a simple matter of re-imaging the SD card with a fresh copy of the operating system. An even lower cost option is to give each student an SD card and share a few Pi’s.

I can’t wait to see students strap a bunch of Raspberry Pi’s together into a loosely coupled multiprocessor. Experiments in parallel computation, anyone?

Performance, profiling and tuning

For the last 15+ years I’ve been performing research and writing papers on program performance measurement, profiling and tuning. This field of study is a good entry point to the world of computer architecture and organization. It’s a practical opportunity to learn about the underlying machine organization, called “microarchitecture”. This aspect of computer architecture has a practical angle, too. Knowledge of the microarchitecture can be applied to software performance (how to make programs run fast).

So, here’s a road map to my first explorations with Raspberry Pi. This road map is an overall guide to the RPi-related pages on this site. First, I talk a little bit more about performance tuning and microarchitecture. Then, I get into two sets of experiments:

  • Performance event counting/measurement with a simple kernel module and benchmark programs.
  • Profiling with Performance Events for Linux (PERF).

These experiments taught me a lot about the RPi (ARM11) microarchitecture and the ARM11 performance counters and events. I posted a few pages on these topics with information taken from the official ARM11 technical documentation.

The first set of experiments gave me a chance to write a kernel module for Raspbian Wheezy. I posted my notes, so even if you are not interested in performance tuning, you can at least learn how to write a basic kernel module of your own. Device drivers are implemented as kernel modules, so you might want to study this example if you care going to write a device driver.

At the time of this post (May 13, 2013), Performance Events for Linux is a little rocky on Raspbian Wheezy. I hope to debug, write up and repair the issue that I found in order to make PERF run correctly on RPi.

Copyright © Paul J. Drongowski