Self-proclaimed 'hacker', gamer, and Destiny 2 lore guru.

Hate It Or Love It As A Way to Understand Multitasking

Slight content warnings about the song: violence (as you might expect) and possible implicit homophobia

In January 28, 2005, The Game and 50 Cent released Hate It or Love It, which was something like an autobiographical collaborative piece for the two of them. Then in March 3, 2005, 50 Cent’s The Massacre released with a remix of the song that featured each other member of G-Unit providing their own verses after the second. I didn’t ever actually hear the song until maybe 2009/2010 when it came up in Pandora Radio, and then I heard both versions, and honestly I prefer the remix – and here’s why:

It’s structurally representative of how any kind of multitasking in computing functionally operates.

50’s parts are the central framework – think like the kernel of an operating system, or Python’s asyncio event loop, or the JVM. 50’s verse (also the first one) maps very cleanly to the bootloader or whatever other initialization process you might think of. It sets the stage and the context for the entire song just like the bootloader and kernel set up the computer to start doing work. After his verse, he moves into the chorus, which works just like how the process scheduler in a kernel (or the JVM) or the “loop” part of an event loop would work:

  1. Present the next rapper (i.e. find the next task)
  2. Hand control of the song (i.e. computer) to it

Then the rapper(/task) has a short slice of time to present their world and tell their story (or for the task to do whatever they need to do). Once they finish, the chorus comes back in and repeats the process above – just like a kernel would do with a running process, or the event loop would do when a task has yielded control back to it.

One of the main differences between the remix and the original song is that the remix nominally represents more of a cooperative multitasking system – that is, the chorus only actually comes in when the rapper is done (in actual cooperative multitasking, including the asyncio event loop, this is more like “just done for now, let me know when something happens”). That said, the remix only features The Game’s first verse, where the original had him do every other verse too, which makes a case for preemptive multitasking as well – The Game’s full story essentially put on hold to allow other rappers to tell theirs. Most modern kernels do the same thing: each process gets a short slice of time to do what they want and if they run out of time, the kernel grabs control back (putting that process on hold) and passes it to another process. It just works out that the computer does this much, much faster than a song could possibly allow for, and it has to for everything to feel responsive and usable.

Realizing this at the time is what made the remix one of my favorites to listen to while doing programming/debugging for a long while. I’d like to think if I were teaching a computer science course (or really any kind of programming) I would use it to introduce those concepts, and I hope they came through clearly here as well.