This page contains some (hopefully funny) poems I have composed on topics related to operating systems, which I have used (somewhat unsuccessfully) to add some humor to my (otherwise dry) OS lectures. The Process Not ScheduledInspired by the famous poem "The Road Not Taken" by Robert Frost
Two processes were ready to run in the queue Three Ready ProcessesTo be sung in the tune of the nursery rhyme "Three Blind Mice"
Three ready processes Processes and MotherhoodProcess P spawns a child C one dayThen waits for it to die and cleans it away Oh, what a cruel mother, some might say But they are processes, not humans, so all okay! Albeit, humanity is not a rare find For proof, look no further than the init Which adopts orphan children sired by others Without asking "For me, what's in it?" Lost in Translation"Fetch the data at this address", the CPU asksThe MMU and the OS give each other furtive stares The address is only virtual, not real, they know But together, they must translate and manage the show The MMU first checks if the TLB can help Else it must do the long page table trek The MMU wonders if they should've kept things real "No", says the OS, "I believe in the virtual" What is an OS, you ask?
You want to run a program? Great Power, Great ResponsibilityA process running in user mode carefreeEncounters a trap that forces it to be More responsible in the kernel mode As it traps into the privileged OS code "Don't panic", says the OS, "I'll handle this" Saves context on the trap frame and dives right in To its trap handling code that does what must be done To handle the trap and bring the process back to run The Switching GameAs the stack pointer moves to another stackAnd the program counter points to another's code The distraught process begins to wonder "Am I still alive or am I dead cold?" Little does the process know it will be back soon For that's the game -- run a bit and get swapped And when its context is restored into CPU registers It will resume like it had never been stopped Communication is KeyOne process P1 said to its friend P2"It's been long since I have heard from you Let's communicate by sharing some memory? Or how about a socket, a pipe, or a message queue?" "No", said P2, "none of this is easy I do not know your port number or unique key Neither are we related to use the same pipe So I really do not know how you can reach me" Processes, like humans, always have an excuse To avoid talking, we are never short of a ruse But find a way out, get the conversation going Nothing's better than IPC* to get over the blues! *IPC = Inter Person Communication The Life of a ShellRead a command, fork, exec, and waitThat's all there is to the life of the shell Day after day, command prompt after prompt, Like the monotony of Tom Hanks in “The Terminell” The only excitement is in the minor skirmishes When signals are thrown via the system call "kill" And processes defend using signal handler shields Or perish by bowing to the operating system's will Two Threads Tango"The CPU cannot add", thread T1 laments to T2"How can 1+1 not be equal to 2?" "Oh, that is a race condition", T2 responds "For things to make sense, we must both use locks" "Wait till I finish", thread T1 says to T2 But paying no heed, T2 starts to run As a very offended T1 yells "how could you?" It hears back, "a CV or semaphore, you use either one?" The Lazy Disk"Read a few bytes from this file", a process saysThe OS starts the system call, but the disk responds late As it searches for inodes and disk buffers and bytes on sectors The process, very bored, switches to sleeping state To avoid such delays, the OS decides To store fetched blocks in the disk buffer cache So when another process needs the same disk block The lazy disk need not be approached again |