So, I watched The Social Network some time ago, the movie about Mark Zuckerberg and his humble beginnings at Harvard. Even more recently I watched some clips of it on YouTube. There are many great scenes; I like the one with In Motion by Reznor and Ross playing in the background, which starts with Mark saying, “Let the hacking begin!” and then shows him doing some web-scraping. Another scene had an especially strong grip on me, though. In this scene, Mark sits in an Operating System lecture. This is already after he published the “FaceSmash” website, which would let you rank (female) students according to their attractiveness. He gets a mean message on a piece of paper and decides to leave the class. Before that, the lecturer describes the following system:
Suppose we are given a computer with a 16-bit virtual addresses, and a page size of 256 bytes. The system uses one-level page tables, which start at address 0x0400. (The first few pages are reserved for hardware flags, etc. Maybe you wanted to have DMA on your 16-bit system, who knows?) Assume page table entries have eight status bits.
He then asks:
The 8 status bits would be…?
He sees Mark leaving and tries to humiliate him. But Mark is of course super smart; while leaving he nonchalantly answers:
1 valid bit, 1 modify bit, 1 reference bit, and 5 permissions bits.
This answer has been driving me insane. The first part is fine. 1 valid bit, 1 modify bit, 1 reference bit, makes perfect sense on most computers. But what are these 5 permission bits exactly?! The lecturer says in response:
That is correct... Does everybody know how he got there?
No, I don’t. And there is also no way of “getting there” without just knowing it. However, as a person born in the 21st century, a 16-bit system sounds ancient; the movie takes place in 2005 when 32-bit was the standard, so it would be ancient for them as well. It wouldn’t make sense for Mark to know this specific system.
On a x86 system, there are 2 permission bits: 1 Read/Write bit and 1 User/Supervisor bit. Crazy that there isn’t an exec bit! That only came with the 64 bit extension. So x86_64 has 3 permission bits. Or 7, if you count the 4 memory protection key bits.
Well, it got a hold of me, and after some googling around, I first found a lot of links pointing to no longer existing web pages of Matt Welsh, who was the actual operating system prof while Mark was studying at Harvard. But thank god the Wayback Machine exists! So I could look at the slides and also some assignments, and lo and behold: An answer to the mystery!
The system is completely made up and is just an example that leads to a question of page table sizes. So the question isn’t even what the 8 status bits are (because you couldn’t know; they are just a given). And after the 5 permission bits, it says:
This is a very secure system
It even assumes 5 permission bits might seem a lot to you (and they would, even on x86_64, since nobody knows about these memory protection keys). But! I understand why they did it this way; the flow of the “1 valid bit, 1 modify bit, 1 reference bit, and 5 permissions bits.” is quite catchy, and the average person watching would have already stopped listening closely the moment the words “16-bit system” were uttered. (That I’m not the only one thinking that can be seen by this Letterboxd comment of the movie, with almost 10k likes).