Second-Year Projects – WACC and PintOS

Hi, I’m Hamish; I’m from Watford, UK, and I’m in the second year of Computing. In my free time I enjoy studying foreign languages, playing water polo and doing Competitive Programming. This year I’m behind Imperial CyberSoc and CTF Team. Let’s connect on LinkedIn!Hamish photo

Amongst computing students there is a definite consensus that the second-year projects of WACC (writing a compiler from scratch) and PintOS (adding features to a barebones OS in C) are among the most formative experiences of the degree, though we haven’t had a blog post on them, so I want to give an overview of this term and last, and what I’ve learned (incredibly hard to sum up in only a few hundred words!) 


“You don’t understand concurrency until you do PintOS” – Imperial Proverb! 

PintOS, modified from a Stanford lab of the same name, comprises an individual “Task 0” – implementing an alarm clock feature to get familiar with interrupts and the codebase – followed by 3 group tasks in teams of 4: adding a BSD scheduler, user programs with system calls, and virtual memory. 

Before PintOS, I knew what an OS was to some degree – software running directly on the computer mediating hardware access for programs that users want to run. This sounds simple enough, but once I realised I didn’t know what a syscall was, or even really understand race conditions, I noted there was a lot to learn. 

PintOS taught us how to design a complex system and consider potential concurrency bugs from various perspectives, and gave me confidence that, with some iteration, I can write code to solve problems that seem incomprehensible to begin with. I often refer to it when wondering how my day-to-day code interacts with the OS, which, in making good programming choices, is invaluable. 

Image of monitor showing code
[Debug output from PintOS task 3, virtual memory. No memory was leaked in the making of this image…]


In contrast, the WACC lab is focused around writing high-quality software from scratch (rather than adding to an existing codebase). Students create a compiler for a simplified C-like language (to x86-64, Arm32 or Arm64), with a toolstack of their choice, testing it thoroughly with unit and integration tests via CI.  

Most groups use Scala, and the state-of-the-art Parsley library written by a world expert in parser combinators, and one of the teaching fellows in charge of the project! As a result, the whole frontend milestone provides an opportunity to develop an understanding of parser combinators and Scala, new to most groups. 

Currently, we’re working on the backend milestone, where the program’s parsed AST is converted to assembly. Smart intermediate representation choices are crucial, which certainly develops design skills. 

The project will be capped off by the extensions, where groups can take the compiler as far as they wish, implementing alternative backends, OOP features, a runtime system and garbage collection or even WACC in WACC! This allows each member of the group to focus on the part of the compiler that interests them and develop a deeper understanding of it. 

Screenshot of computer screen
[CI Pipelines on our WACC project with mixed success…]

In conclusion PintOS and WACC live up to their reputations of being simultaneously challenging and rewarding. Since they take place during regular term, with deadlines often coinciding with other courseworks, and a full schedule of lectures to attend concurrently, they certainly foster organisation skills. They also serve as points of reference which our we can think back to if unsure about how to approach a problem, technically or in terms of design.  

If, reading this, you are considering applying to Imperial, take the projects as a strong motivation to do so, and if you are a current student, I’m sure you’ll share my gratitude to Drs Mark and Jamie and the team behind the labs for continually iterating them to be the most educational they can be!