I’m currently working through an independent study this spring semester where my goal is to tinker with the MINIX 3 operating system. It’s almost supposed to be like a hands-on, more advanced systems programming class. However, one issue I have come across is that for one reason or another, I’m fairly shaky with my fundamental operating systems concepts. Thankfully the MINIX 3 textbook has a really fantastic overview of Operating Systems concepts, so I figured instead of just taking personal notes, I’d put some review up here as well. Also, as a heads up, much if not all of this information is coming from the official MINIX 3 book.
Let’s start with the absolute basics. Some brief definitions.
System Calls. What are they, exactly? Well, loosely, they are the means with which user programs interface with the operating system. They are extended instructions that the OS provides — I suppose you could think of them as an API, in a way. In MINIX 3, system calls generally fall into two categories: Those dealing with processes and those dealing with file systems.
Processes. A process is essentially just a program that is currently being executed. Each process has an address space and some set of registers. Within the address space, there exists a series of memory spaces that the process can read from and write to. These memory spaces contain the program’s instructions, data, and its stack. Outside of the address spaces and within the set of registers are things such as the program counter, stack pointer, and other info needed to run the program.
Note here that there are clear differences between processes and programs. Often these terms are used interchangeably, but they are not one and the same.
Files. Since the GUI in computers represent files in such an effective way visually, it’s pretty easy to understand how they work. MINIX, like other operating systems, has directories. Directories can contain files and other directories, which gives rise to the file system hierarchy. The file system hierarchy is organized like a tree, and the most top level directory is the root.
The Shell. While not actually a part of the operating system, the shell is the primary means with which a user interacts with the operating system (unless they’re using a GUI). The shell is a process that gets started when a user logs in. It uses the terminal window as its standard input and output. When the shell is started and running in the terminal window, it prints the prompt, which is some symbol (commonly a $) to show that it is ready to receive a command. When the user inputs a command, the shell takes it and spawns it as a child process, and then waits for that process to terminate. When the child process terminates, the shell resumes its process and again prints the prompt on the screen.
Each one of these concepts has a lot to them, and I’ll delve further with upcoming posts. Lots of self studying to do this semester, I’m kind of enjoying it! Also, don’t tell anyone, but I’m actually starting to enjoy this whole blogging thing, too.