Operating Systems Exploration
A set of tutorials/assignments that I use in the Operating Systems course. The idea is that you should explore some hard to understand concepts by actually see that they do exist and that you can play with them. It's one thing to read about memory management and try to understand what's going on but if you have written your first malloc (and it will only take you five minutes) you learn that it's not magic.
Understand that these assignments can be done with your mind closed (harder to do with your eyes closes) and you will learn nothing. The assignments should be seen as a way start thinking about what these concepts mean and how they can be used. There is a Swedish expression "help someone over the doorsill" and this is my intention.
All assignments have been developed using C, gcc and a 64-bit Linux system. You should be able to run them on OSX or Windows or something else but you might have to change which libraries to use etc. Most of the code is given so you don't have to be an experienced C programmer but you need to know how to compile and run small examples. Try to use the compiler from a regular shell, that will give you a better feeling of what is going on and you'll learn to navigate the shell. Working in a IDE is probably very productive for larger projects but it also protects you from what is actually going on.
The boot process
This experiment will guide you through the boot process. Allthough this is what happens before the operating system starts it is fun to go through the steps needed to print "OK" on the screen.- How to start from scratch: Booting a kernel
Processes
Experiment related to processes, what they look like and how they are created. If you follow these tutorials you will be able to put kernel-hacker in your CV by next week.
- The structure of a process: A heap, a stack, a bottle and a rack
- How to create a process: Hello Dolly
- How to signal a process: Don't do this at home
- How to signal a process: Ready, Blocked or Done
Kernel modules
- Write a kernel module: Want to play a game
Virtual memory
These experiments with the algorithms used for memory management. We start by implementing malloc in five minutes and then explore the TLB and page management.
- Segmentation: Segmenting a memory
- User space memory management: My malloc: mylloc and mhysa
- Using mmap() instead of sbrk(): My malloc using mmap()
- Malloc uing the buddy algorithm: That will be the day, ...
- Malloc using the magic: The magical mystery tour
- Malloc done like ptmalloc: Next, previous, before and after
- The kernels page management: Page frame reclaiming algorithms
- The importance of the TLB: How large is the TLB?
Concurrency
Concurrency is probably the most complex thing to handle when it comes to operating systems. If this is your first contact with concurrent programming you're in for a big surprise. Things do not happen one thing at a time and sometimes they even happen before they have happened (I know, sounds absurd but it's a fact). So buckle up and enjoy the ride.
- Fooling around with contexts: Threads - roll your own
- Why and how to implement locking: Take me for a spin
- Your own green threads : Green, green threads of home
- Process communication: Ping-pong and Echoes
File systems
The file system consist of two parts: the drives where we store files and the tree like structure of directories that we use for navigation. We will first try to figure out if it actually does take as long time as they say to read from a hard drive (it does). We will then run round the file system and collect some information; this will show you were things are actually found and possibly give you a hint on how large files in general are.
- Secondary storage: Storage - take your time
- File operations. Exploring the file system