Teaching CMPUT 229 - Computer Architecture I

It is finished. I am done teaching CMPUT 229. It was one of the most intense, rewarding, and challenging times of my life. I am happy I did it, but happier still to see the end of it.

CMPUT 229 is the course where a computing science student will typically first learn assembly language, and low level details about how a CPU works. From the course catalog:

Number representation, computer architecture and organization, instruction-set architecture, assembly-level programming, procedures, stack frames, memory access through pointers, exception handling, computer arithmetic, floating-point representation, datapath, control logic, pipelining, memory hierarchy, virtual memory.

CMPUT 229 holds a special place in my heart. It was the class which most set me on my current career trajectory. Through this class I discovered my enjoyment of working low in the stack, and after this class I started into a pipeline of opportunities which eventually brought me to where I am today. My mind was blown when I realized that I had actually taken this class exactly 15 years ago.

In November 2021, my Master’s supervisor Dr. Amaral reached out saying that he would be taking sabbatical, and they needed to find instructors for CMPUT 229 for Fall 2022 and Winter 2023, and asked if I would be interested. I never really got an opportunity to teach during my time at university; I always had enough funding that I never needed to TA, and it’s not common for a Master’s student to teach any courses. I have nevertheless always been interested in what teaching would be like, and so I jumped on the opportunity. I would teach Fall semester.

The plan was that I would teach the course largely following Nelson’s previous editions of the course: I would use his course outline, topics, slides, quizzes etc. Each year, Nelson has students build new labs for the course, so I would select from some that were ready to use, and build the course around that.

In preparation for the course I reviewed the material, and planned out the lectures in a spreadsheet. I was happy to note that if I managed to keep a brisk, but in my opinion managable, pace I would be able to keep some extra time for some lectures of my own design by the end.

When we figured out that we were expecting our second child, I figured that I would be able to manage the workload, and so didn’t change my plans to teach.

Teaching

I truly enjoy teaching, especially things I find fascinating. I’ve known this for a while, as I used to really enjoy mentoring junior employees and interns when I worked at IBM. There’s something extremely satisfying about seeing someone gain skills and understanding.

Lecturing went fairly well for the most part. It was occasionally quite challenging to teach someone else’s slides where the way the slides worked didn’t match my preferred way of telling the story, or where there were errors in the slides. I tried to fix this where I could, but editing slides is an enormous time sink (made worse by the fiddly failures of PowerPoint), and so I didn’t do nearly as much as I would have had I more time and energy.

I really enjoyed getting to do office hours with students. The ability to hash out understanding 1-1 in front of a whiteboard is so enjoyable; it’s something I really miss from working remotely these last 5 years.

I was very happy I made some extra time at the end of the course. I really enjoyed the fact that I was able to give a lecture about computer security, and that 229 had provided enough background that I was able to give a cogent overview of how the Spectre family of attacks work.

Stupid Questions

Roughly once a month at work we have a meeting we call “Stupid Questions”. The goal is to make sure we’re willing to ask all the questions we need answered, even if we think they might make us look silly or funny. After a couple of years of having these meetings, I found a description of this process from the science blog Slime Mold Time Mold which now forms the preamble to the document we use for these meetings:

Stupidity is all about preparing you to admit when you’re facing a problem where you don’t know what is going on, which is always. This allows you to ask incredibly dumb questions at any time.

People who don’t have experience asking stupid questions don’t understand how important they can be. Try asking more and dumber questions — lean in on how stupid you are. You will find the world opening up to you. Ignorant questions are revealing!

– The Scientific Virtues

Fairly early on I was sure I wanted to bring this tradition into the classroom – though I’ll admit I was nervous about it; you really don’t want to offend your students by calling them stupid. Eventually I made myself sufficiently brave to take a half an hour of class and present the idea of “Stupid Questions”, and get students to ask them.

This went remarkably well. I truly appreciated the ability to re-explain concepts from another persepective, help students clarify their understanding, and generally have slightly off-topic discussion. I think we only did two or three stupid questions sessions, but I thought they were some of the best teaching I did.

Student Reactions

I have to say, I’m happy with the student reactions I got to my teaching. While I still don’t have access to my official “Student Perspectives On Teaching” report for the end of the course, in general feedback in-person or via the midterm-evaluation I received was quite positive. Students were certainly annoyed at the level of difficulty and the workload of the course – but to an extent, that’s unavoidable for a course as ambitious as CMPUT 229. The challenges students highlighted are challenges I was distinctly aware of while teaching (slide issues, lectures that weren’t as good as I wanted them to be, etc). I think I got better as a lecturer over time.

My RateMyProfessor page I think is a good testament to the work I put into this course, with uniformly high ratings.

Administration

Adminstration was a bit of a thorn in my side throughout this process. There were hiccups with the university (ask me about contract issues over a beer one day), and then there was the actual administration of the course itself. Managing students absence requests, clarifications about assignments, requests for extensions etc, all ate a surprising amount of time. There’s far more work involved in managing a course than I ever expected.

Examinations

While assignments and labs were marked by the TAs for the course (each of whom has my eternal gratitude for reducing the workload on me), midterms and finals had to be written and marked by me.

Marking 150+ exams is a very painful process. I put more effort into marking the midterms than perhaps was necessary, as I tried to give part marks and highlight where students made calculation mistakes. Still, each exam took days to finish marking, crammed into evenings and weekends around my work. Suddenly Scantron exams seem horribly tempting.

One of the lessons I learned this semester is that I need to have a writing partner to write exams. It’s far too hard to write and edit my own exams and correctly identify drafting errors. That problem where you, the author, read your intent not your words, struck me badly on each of the midterms and the final exam. It was truly embarrasing to have to provide clarification to students live as they wrote their exams.

Alas, while it is really interesting and I plan to write more about AI stuff, ChatGPT won’t suffice. While I think that it would have just-about passed my final exam, it was unable to identify missed information in some of the questions. Should I ever teach again, I think I would lean more heavily on my TAs, getting each of them to help with the drafting of a question for the exams. This would spread the workload, while helping make sure the questions were correctly done.

Workload

I’ll be the first to admit: I definitely underestimated the workload of running this course. Part of this was my own fault; I never asked what the course enrollment was. So when I found out I was going to be teaching a 250 person section I was a bit gobsmacked.

Combine that with the new baby, and all the disruption to our lives that brought, and it’s a wonder I didn’t have a meltdown this semester. On the plus side, the section size dropped continuously until the final withdrawal deadline, and which point we stabilized at the final student count of 148.

A graph showing the enrollment in the course as it dropped over time.

When I went back to work with Mozilla, I was effectively working 60 hours weeks, every week. This had a real impact on my family life, my health, and my relationships. I definitely was not a fan. I let more things slip in my personal life than I am proud of, trying to manage all the pieces. While we’ve come out the other side intact, it was not nearly the light workload I had planned on, and much more stressful than I expected. Combine the stress with comparatively low pay, and it’s a hard thing to argue in favour of. If someone is teaching casually, they’re teaching for non-tangible reasons, that’s for sure.

Lessons For the Future

All that being said, I sort of hope I have an opportunity to teach again, sometime in the future (5-10 years from now perhaps?). As such, there’s some lessons I’d leave myself:

  • Definitely don’t have a baby two weeks before class starts. That was a rookie mistake on my part, and shouldn’t be repeated.
  • Dedicate enough prep time to ensure the assignments are in a good shape. I was embarassed at how many times students would ask me questions in office hours about their assignments, only to realize that editorial work on them previously had removed improtant information, or made it unclear where information needed to come from.
  • Do more work on expectation setting with TAs. This was my first time teaching, and I was a pretty bad manager, because I had an unclear set of expectations that were poorly communicated. Thank you to my TAs for sticking it out with me. Having said that, the next lesson is:
  • Lean more heavily on your TAs.

Conclusion

Teaching CMPUT 229 was a fascinating experience, that was extremely stressful and more impactful on my family than I would have like. I learned a lot about myself, and I think that I would do it again, but only if I was in a better place to manage the workload. Hopefully though, should I ever teach again, the experience I had this time will make the course substantially easier to the second time around.

Computational Nostalgia

The above is a screenshot from System7.app, a website running a Macintosh emulator. In it, is a ClarisWorks document with the following contents:

Holy shit, I definitely remember using Clarisworks.

I don’t normally consider myself nostalgic, and yet here I am, powerfully overwhelmed with nostalgia yet again, by an operating system I didn’t use at the time.

What is it about these system emulators that speak to me so?

Why do I sort of long for a past I didn’t really know? There’s something peaceful here, disconnected in a way?

Another thing that stands out to me is immense legibility of the interface: The old greys may not be sexy, but I find them so legible compared to so many modern interfaces.

Anyhow. Guess who wants to buy an old Powerbook now.

Polybius: The Rise of the Roman Empire

After reading Thucydides, I was fascinating by the idea of contemporaneous historians; people writing histories of times they lived through, of events they had even participated in.

When hunting for another contemporaneous history, Polybius was the first choice that seemed to come up in my searches. Polybius was a Greek hostage of the Romans, of a peculiar sort with a seemingly wide amount of freedom during his captivity that allowed him access many high tiers of Roman society; he was an active in both Greek and Roman politics in some of the times he wrote of in his history.

Despite the seeming alignment with what I was looking for, when I tried to read Polybius last time, I bounced off of him, and ended up reading Herodotus instead.

On a vacation last summer, we were in a wonderful used bookshop, and I picked up a few classical histories. Plutarch, another Xenophon (haven’t read yet) and The Rise of the Roman Empire, which is a selection of a subset Polybius’ Histories by F. W. Walbank, that uses Polybius’ discussions of Rome to chart its growth into the super power it became.

Through this edition, I was able to get through Polybius. It required some effort, but I am glad I did it.

A forewarning; This blog post is filled with far more long quotes than any other. This is partially because in many cases, Polybius makes his case far better than any restatement I could make, and partially because I now can scan text via my phone, so I didn’t have to type out the quotes by hand.

The History

Can any one be so indifferent or idle as not to care to know by what means, and under what kind of polity, almost the whole inhabited world was conquered and brought under the dominion of the single city of Rome , and that too within a period of not quite fifty-three years? Or who again can be so completely absorbed in other subjects of contemplation or study, as to think any of them superior in importance to the accurate understanding of an event for which the past affords no precedent. -Plb 1.1.

Polybius believed that it was important to trace cause and effect through history, and so his history covers an enormous amount of ground; however to keep it tractable, Walbank focuses The Rise of the Roman Empire on the parts of Polybius’ history that talk about Rome, it’s interaction with other nations, and the story of Carthage, as told via the Barca family of Hamilcar, Hasdrubal and Hannibal, however it also interweaves some of Polybius’ own philosophy of both politics and history.

Polybius viewed history as an important education for statesmen, and saw history as valuable only insofar as it provided true stories of decision making that provides either positive or negative lessons to readers. He also thought it was critical that people who wrote history understood, by experience, the politics they would document:

There is, however, another category of authors, who appear to be justified in undertaking the writing of history, but who in fact are just like the theoretical doctors. They haunt the libraries and become thoroughly versed in memoirs and records, and then convince themselves that they are properly equipped for the task; but while they may appear to outsiders to bring everything that is needed to the writing of political history, yet in my opinion they provide no more than a part. Certainly the, study of the memoirs of the past has its value for discovering what the ancients believed and the ideas which people formerly entertained about conditions, places, nations, states and events, and also for understanding he circumstances and eventualities with which each nation in earlier times had to deal. And certainly past events are relevant in making us pay attention to the future, provided that a writer inquires in each case into the facts as they actually occurred. But to persuade oneself, as Timaeus did, that the resources of documentary research alone can equip one to write an adequate history of recent events is naive beyond words. It is as though a man were to imagine that he was a capable painter, indeed a master of the art, merely by virtue of having looked at the works of the past. — Plb 12.25e

The narrative history was all new ground for me, covering the three Punic wars (though, the Third Punic War was not covered with much depth). Honestly, I found that Polybius did a good job of achieving exactly his goal set at the introduction: Explaining how the Romans came to rule the known world in a very short period of time.

One of the things I love about reading history is the way it reminds me that human institutions are fragile, and change is always just around the corner.

Below, I cover two small sections of the history I found interesting, sharing some block quotes.

The Cycle of History

One of the ideas that Polybius is famous for is his notion of the ‘Rotation of the Polities’. He sees political systems as following in a natural cycle of succession. In his analysis, there are six different forms of government (or constitutions):

  1. Kingship
  2. Tyranny
  3. Aristocracy
  4. Oligarchy
  5. Democracy
  6. Mob rule

Each pair of these are a ‘good’ and ‘bad’ version of the same thing:

The truth of what I have just said may be illustrated by the following arguments. We cannot say that every example of one-man rule is necessarily a kingship, but only those which are voluntarily accepted by their subjects, and which are governed by an appeal to reason rather than by fear or by force. Nor again can we say that every oligarchy is an aristocracy, but only those in which the power is exercised by the justest and wisest men, who have been selected on their merits. In the same way a state in which the mass of citizens is free to do whatever it pleases or takes into its head is not a democracy. But where it is both traditional and customary to reverence the gods, to care for our parents, to respect our elders, to obey the laws, and in such a community to ensure that the will of the majority prevails - this situation it is proper to describe as democracy. — Plb 6.4

From natural beginnings, political systems transition, Kingship to Tyranny, to Aristocracy, to Oligarchy, to Democracy, to mob rule, and then finally a new king arises from the mob, and the cycle begins again.

Living in times where democracy feels fraught across the globe, it was interesting to read Polybius’ take on the decline of democracy (emphasis mine):

At this point the only hope which remains unspoiled lies with themselves, and it is in this direction that they then turn: they convert the state into a democracy instead of an oligarchy and themselves assume the superintendence and charge of affairs. Then so long as any people survive who endured the evils of oligarchical rule, they can regard their present form of government as a blessing and treasure the privileges of equality and freedom of speech. But as soon as a new generation has succeeded and the democracy falls into the hands of the grandchildren of its founders, they have become by this time so accustomed to equality and freedom of speech that they cease to value them and seek to raise themselves above their fellow-citizens, and it is noticeable that the people most liable to this temptation are the rich. So when they begin to hanker after office, and find that they cannot achieve it through their own efforts or on their merits, they begin to seduce and corrupt the people in every possible way, and thus ruin their estates. The result is that through their senseless craving for prominence they stimulate among the masses both an appetite for bribes and the habit of receiving them, and then the rule of democracy is transformed into government by violence and strong-arm methods. By this time the people have become accustomed to feed at the expense of others, and their prospects of winning a livelihood depend upon the property of their neighbours; then as soon as they find a leader who is sufficiently ambitious and daring, but is excluded from the honours of office because of his poverty, they will introduce a regime based on violence. After this they unite their forces, and proceed to massacre, banish and despoil their opponents, and finally degenerate into a state of bestiality,’ after which they once more find a master and a despot. Such is the cycle of political revolution, the law of nature according to which constitutions change, are transformed, and finally revert to their original form. - Plb 6.9

Every kind of state, we may say, is liable to decline from two sources, the one being external, and the other due to its own internal evolution. For the first we cannot lay down any fixed principle, but the second pursues a regular sequence. I have already indicated which kind of state is the first to evolve, which succeeds it, and how each is transformed into its successor, so that those who can connect the opening propositions of my argument with its conclusion will be able to make their own forecast concerning the future. This, in my opinion, is quite clear. When a state, after warding off many great perils, achieves supremacy and uncontested sovereignty, it is evident that under the influence of long-established prosperity life will become more luxurious, and among the citizens themselves rivalry for office and in other spheres of activity will become fiercer than it should. As these symptoms become more marked, the craving for office and the sense of humiliation which obscurity imposes, together with the spread of ostentation and extravagance, will usher in a period of general deterioration. The principal authors of this change will be the masses, who at some moments will believe that they have a grievance against the greed of other members of society, and at others are made conceited by the flattery of those who aspire to office. By this stage they will have been roused to fury and their deliberations will constantly be swayed by passion, so that they will no longer consent to obey or even to be the equals of their leaders, but will demand everything or by far the greatest share for themselves. When this happens, the constitution will change its name to the one which sounds the most imposing of all, that of freedom and democracy, but its nature to that which is the worst of all, that is the rule of the mob. — Plb 6.57

History doesn’t repeat, but it rhymes, feels appropriate here.

Views on Roman Superstition

I thought this passage was remarkable:

However, the sphere in which the Roman commonwealth seems to me to show its superiority most decisively is in that of religious belief.

Here we find that the very phenomenon which among other peoples is regarded as a subject for reproach, namely superstition, is actually the element which holds the Roman state together. These matters are treated with such solemnity and introduced so frequently both into public and into private life that nothing could exceed them in importance.

Many people may find this astonishing, but my own view is that the Romans have adopted these practices for the sake of the common people. This approach might not have been necessary had it ever been possible to form a state composed entirely of wise men. But as the masses are always fickle, filled with lawless desires, unreasoning anger and violent passions, they can only be restrained by mysterious terrors or other dramatizations of the subject. For this reason I believe that the ancients were by no means acting foolishly or haphazardly when they introduced to the people various notions concerning the gods and belief in the punishments of Hades, but rather that the moderns are foolish and take great risks in rejecting them. — Plb 6.56

There’s a modern-feeling cynicism about religion here; he talks about Roman religion as if it exists only as a tool, instilled in the Roman people as a means to the end by the powerful. He might even be right, and yet, in this he reminds me of a dark-version of Marx, praising the Roman opioid as a key to social control.

The Edition

I read Penguin Classics The Rise of the Roman Empire by Polybius, selected by F.W. Walbank, and translated by Ian Scott-Kilvert (the same one who translated the Plutarch I read).

The introduction was good and did an excellent job of introducing Polybius’ work, or at least the selection Walbank made. I’m not sure I would have read the book had it not been for the quality of the introduction. Each chapter lead with a good introductory note, setting the stage and providing historical context, which was very helpful.

Last time I read Polybius, I accused him (or the translation) of being stilted and awkward. This time, knowing how much I appreciated the translation of Plutarch by Scott-Kilvert, I suspect the blame lay on Polybius. (During the writing of this blog post, also used Tufts’ Perseus Digital Library, which has the Evelyn S. Shuckburgh translation, which really showed how much I appreciate Scott-Kilvert’s translation skills, and his use of a more modern vernacular).

I still found him to be stilted for the early chapters this time around, but over time I adapted, or he became a better writer and it bothered me appreciably less.

Despite the promise of the edition, it was overall one of the weakest classic history editions I’ve read:

  • The Footnotes were of strongly varying quality: some useful, some clearly superfluous or misplaced and no notes to fill in the missing pieces. While I don’t think Polybius needed the very detailed notation that I had in the edition of Thucydides that I read , I was nevertheless let down often by this edition’s supplemental information.
  • The maps are atrocious. They are almost entirely unusable through huge swathes of the book. Admittedly, I’m hugely spoiled from reading the Landmark Ancient Histories, which are absolutely lousy with excellent maps, but the maps in this book were just trash.
  • There’s a diagram of a Roman camp, which is trying to help you visualize what Polybius describes in one chapter… but all the labels are in un-translated latin. Which makes it a pain to decipher.

On the Conservative Leadership Race

I chose to email my MP in order to put my feather on the scales of the conservative leadership race:

Mr. McCauley,

To the extent that you are looking for constituent feedback on the leadership race within your party let me make a single wishlist item:

The Conservative party must have a credible climate plan to win. Which means having a leader willing to put forward a credible climate plan. Erin O’Toole’s plan was a step forward, but insufficiently credible. It’s time for the conservatives to show us credibly how they drive Canada and the world to net zero.

Myself, and many of my generation simply will not vote for a party that ignores climate change. If you want to win, you need to be serious.

— Matt Gaudet

Every opportunity to remind politicians that climate matters.

The Goblin Emperor

I finished The Goblin Emperor, by Katherine Addison the other day. It was a wonderfully satisfying read. While it was daunting at first — the book opens with a “Travellers Guide” to the world, explaining the linguistic and cultural world, as well as an enormous glossary/dramatis personae — I found the story to be immensely compelling and satisfying.

While I am certain I had heard of the book before, what had caused me to want to read it recently was an article called “Hopepunk, Optimism, Purity, and Futures of Hard Work “, by Ada Palmer. She described the book like this:

[…] a story where good people treating each other fairly within a political system succeed in improving their world and triumphing over corrupt backstabbers through the power of the rational fact that most people would rather work with people who treat us well and have our backs than with corrupt selfish backstabbers. Amid so many tales of murder games and cutthroat games of thrones, there is a genuinely punk-like in-your-face contrariness to stories where, when crisis looms, people stand by each other and do good, a portrait of human nature which rebels against the ubiquity of the claim that, when the going gets tough, the smart trust no one.

After that description I felt like I really had to read it; and I loved it. It was not without its drama, but very restorative in a way I found genuinely compelling.

I am now reading Addison’s most recent publication, The Witness for the Dead, which takes place in the same world. I have high hopes.

Letter to the Editor: LNG Exports

To help minimize my feelings of hopelessness around climate change, I’ve been attending local meetings of the Citizens Climate Lobby (CCL).

In collaboration with Edmonton CCL Chapter leader Victor Dorian I wrote a response to an opinion piece by Alberta pundit and former politician, Danielle Smith called “Best way for Canada to get to net zero is to export LNG”.

The response was published in today’s Letters section. Below is the version I submitted, along with two helpful hyperlinks that don’t really work in a newspaper’s editorial section.

In her column, “Best way for Canada to get to net zero is to export LNG”, Danielle Smith argues that massive export of LNG to fuel other countries coal-converted-to-gas power plants is the most effective way for Canada to hit its net zero goal.

The column rests on a tenuous assumption: Canada will be recognized with emission reduction credits for this export. She links to a discussion of the Paris agreement’s Article 6; however, she neglects to point out that Article 6 is controversial, complicated and far from guaranteed (as her link discusses!)

Even the aspects recently clarified in Glasgow suggest that this sort of export cannot be counted in Canada’s favour, as ultimately it would be considered double counting of emissions reduction: You cannot both reduce Canada’s emissions, and the emissions of another country!

At the end of the day, climate change only stops when we stop emitting. Period. Natural gas conversion may reduce emissions in the short term, but being “twice as good as coal” is still problematic when we have to hit zero.

Emission free technologies have to be the direction; Rather than push for a particular solution, the approach our government should follow is setting standards and pricing, to allow independent producers to figure out the road to net-zero: This means Carbon Pricing and flexible regulations that drive every sector in Canada to zero by 2050. Internationally, we should push for the world to take a similar or more stringent approach, using Carbon Border Adjustments to bring market signals to the world.

Danielle Smith hopes emissions markets allows Canada to look good; I hope instead we see a dedication to markets that drive us to zero, not just make Canada look good on paper.

– Matthew Gaudet

I’ll continue writing, both letters to the editor and letters to elected officials: Any action is better than none.