Categories
Linux Tutorial Series

Linux Tutorial Series – 3 – What is an operating system and why do we need it?

Here is the video version, if you prefer it:

Wikipedia defines operating system as “system software that manages computer hardware, software resources, and provides common services for computer programs”. (“Operating system,” n.d.) In simpler language, operating system is the “glue” which enables applications such as Mozilla Firefox (from here on just Firefox) to communicate with your computer hardware.

Why would Firefox, or Microsoft Word, or any program, for that matter, have to communicate with your hardware? Well, let’s take the example of Firefox. Firefox has to somehow display the web page you request. How does it do that? Well, there are two solutions to this issue. The first one is believing in magic and just saying “It’s magic.”. But this post should help take some magic away.

Think of it like this – Firefox (a user process) exists on a certain “level” of your computer, as depicted in Figure 1.

Figure 1 – Operating system “levels” (modeled after Figure 1 on page 3 of (Ward, 2014))⁠⁠

In order to communicate with other “levels” of your computer, Firefox has to call certain operating system functions. So metaphorically it knocks on the operating systems door and asks – “Hey operating system, fetch me the data I just received in the network card, will ya?”. “Why wouldn’t Firefox access your network card directly?”, you may ask.A fair question. Two reasons:

  • It would be very difficult to program software that way; every software developer would have to deal with low-level hardware and that would be tedious. Also, imagine if someone wrote some code to deal with a certain piece of hardware and then someone else had to write it all over again for their program – that would mean every programmer has to start from scratch (literally) every time he writes some code
  • Imagine you are running two applications (let’s call them Firefox and Firefox2) and that both are trying to send some data over the network concurrently – uh oh. The data sent from Firefox and Firefox2 could mix together, creating some data that doesn’t resemble anything Firefox or Firefox2 tried to send.

This is why you call the operating system functions to interact with the hardware. They take care of the nitty-gritty details of communicating with hardware and make sure that there are no things such as two applications overwriting each others contents.

Put another way, operating systems are a layer of abstraction that eases programming in the upper layers of abstraction and makes programmers life more simple. They are the thing we take for granted today, but they are very, very, very challenging to make (program). Writing an operating system is super hard. I have never done it, but I imagine it is very difficult, since I have wrote some lower-level software and that was hard. So thank you operating systems (and operating system software engineers) for making our life easier. Hopefully after this post we will appreciate you more.

References

Operating system. (n.d.). Retrieved December 21, 2019, from https://en.wikipedia.org/wiki/Operating_system

Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 1-3

NewsletterUpdates on interesting things I am doing

Subscribe to my newsletter to keep abreast of the interesting things I'm doing. I will send you the newsletter only when there is something interesting. This means 0% spam, 100% interesting content.

Leave a Reply

Your email address will not be published. Required fields are marked *