14210 NE 20th St
Bellevue, WA 98007
Phone: (425) 440-6206

      Home
      Why Us
     Products
      Services
       Gallery
      Articles
     Company
       Jobs
      Contact

The Operating System

By Amir Majidimehr

You have heard the names: Windows, MacOS, iOS, Android, Linux.  These are all examples of very popular operating systems.  Being the most critical component of our computing devices and increasingly, consumer electronics, it is important to have an understanding of its functions and capabilities.

Operating System

 

The operating system is specialized software that sits between your computer hardware and the applications that run on top of it.  The motivation for creating it was to make it easier for software developers to write their programs.  By isolating the programs from the hardware,  programs could more readily be moved from one hardware platform to another.  Think of how you can upgrade your computer to a faster one with totally new hardware yet able to install the same software it as the old.  This is accomplished by the operating system providing an interface to the hardware capabilities that does not change.

 

Modern operating systems allow multiple concurrent applications to load and be active at the same time.  We call this “multi-tasking.”  To do this well, we need to make sure each application thinks it has the entire computer dedicated to it.  That way, if one program crashes, it can’t bring down the rest with it.  In addition it is important to not allow a program to peer into another.  This partitioning is an important feature provided by the operating system which makes your environment more secure, stopping attempts from one program to for example, steal your password as you type it into another.

 

One of the core concepts of the operating system is the notion of "privileged" operation.  This feature actually exists in your computer CPU.  The best way to understand what this does is to look its opposite.  If the privileged mode is off, the software that is running cannot communicate with the computer hardware.  If it for example attempts to directly read the bits from the hard disk rather than nicely asking the operating system, the CPU stops it and complains to the operating system.  This in turn will cause the application to be shut down.  We call this a “program fault.” 

 

In addition to above restriction, non-privileged application code can only see the memory that it occupies.  If it attempts to peer into the memory that it does not own, such as that of the operating system or other applications, it will again be forcefully shut down.  Sometimes this occurs not because the application is trying to be malicious but due to some bug (software defect) that causes the application to access memory it doesn’t own resulting in its demise. 

 

As implied, the operating system has none of these bounds.  It can freely access all the hardware as it pleases.  It is also all-seeing in that it can peer into any application that is running although it does not usually attempt to do that.  While this is an essential feature of the operating system, in the case of Linux, this can lead to some limitations   Linux is an "open source" operating system meaning anyone can download it and make your own custom version of it.  Well, if you are a hacker, you can modify Linux to peer into an application and with it, steal its secrets.  Case in point is secure playback of video formats such as DVD and Blu-ray.  You will not find commercial applications for Linux that play these formats since it is impossible to safeguard the copy protection keys that are used to decrypt the movies.  Indeed, lack of DVD playback led on Linux led to Norwegian programmer Jon Lech Johansen to search for ways to break the DVD copy protection and succeeding in doing so.  And you thought operating system concepts had nothing to do with audio/video!

 

Google Android

Sometimes an operating system is not what it seems.  Case in point is Google Android.  You probably think Android is an operating system but it is not by strict definition.  If you have an Android device, the operating system is actually Linux!  Linux performs all the core functionality that I described earlier.  What you know as Android is “middleware” which is a software layer between your applications and the Linux operating system.  Linux by itself does not have a graphical interface, support for touch or voice interface, or marketplace for downloading applications   All of this is and then some is provided by Android.  Think of Linux as the engine the in the car, quietly powering the system, and Android as everything else that makes a car. 

 

To separate the concepts above, we use the term Kernel to describe the role Linux plays for Android.  Everything else is libraries/middleware and applications.

 

In the old days the kernel was “pure” in that it provided the core functionality that was needed but no more.  This provided rock solid isolation between the hardware and applications resulting in high level of reliability as applications could never cause the system to crash.  That line has been blurred in the case of features such as graphics and video decoding/display support in Windows.  There, in the interest of providing maximum performance for games and multimedia applications such as video, direct access is allowed to the hardware for application programs.  The down side is that applications can perform functions that could cause the entire computer to crash. 

 

Going back to Android, did you know that it is a cousin of MacOS?  Yes, you heard that right.  The kernel that MacOS is based on is called Mach.  Mach was developed at Carnegie Mellon University as a derivative of another operating system called UNIX.  When the late Steve Jobs left Apple years ago, he started a company called NexT which used Mach for the workstations they were designing.  Later when his company was bought and he returned to Apple, Mach became the kernel for the Mac OS, modernizing it and giving it such essential features as multi-tasking.  For its part, Linux was also a variation of UNIX written from scratch to avoid needing a license to the original source code for UNIX which at the time, belonged to the then dominant phone company in the US called AT&T.   So putting it altogether, both operating systems trace their roots to UNIX.

 

The Life of a Kernel Developer

The kernel software is written in a programming language just like the applications you use every day.  Its functionality though is quite specialized and working on it requires extensive knowledge of its architecture and that of the hardware.  The job is made more challenging by the fact that slightest mistake can cause the system to crash altogether.  Contrast that with bugs (defects) in application programs where just that program dies and your computer keeps going.  Not so when the kernel faults.

 

Complicating the life of the kernel developer is that when something goes wrong it can manifest itself sometimes days or even months later!  Imagine if you print a document and due to a programming mistake some piece of memory in the kernel is corrupted.  Since printing is done, all is well for now until you try to print another document.  It will be at that time that the kernel crashes due to that corrupted memory, not when the defect was originally created!   I say that from personal experience, having had to trace kernel failures that took weeks to manifest themselves after billions of lines of code were executed! 

 

I started my career in 1982, working on the UNIX kernel just as the operating system was taking off to power mid and large size computers.  At the time there was little to no documentation on how it worked.  To learn it I printed out the entire source code and started studying it line by line.  The listing was 250,000 lines and created one massive book, probably weighing some 20 to 30 pounds.  I would carry that under my arm to work and home every day.  I would spend most of my free time hand documenting what every line did on that printed book.  Thankfully I was married by then so I did not have to worry about looking like a textbook geek!   As challenging as that work was, it was extremely rewarding work.  I learned at the deepest levels how the computer system functioned, enabling me to better understand its capabilities. 

 

By the way, 250,000 lines may sound like a large program but in today’s world, it is nothing.  The “little” media player application that plays music and videos as part of your operating system likely clocks at a million lines of code just by itself!  Modern operating systems are beasts and have incredible breath of functionality and code to support them.  With literally thousands of people working on them every year, they keep growing in an attempt to keep up with the latest hardware technologies and expectations for what an operating system should be.

 

Operating Systems and Audio/Video Devices

An interesting development in operating systems is extensive use of them in consumer electronics devices.  It used to be that TVs and DVD players were pretty simply devices and did not have an operating system.  Today, they have so much functionality akin to a smaller computer that they almost always run an operating system with that choice almost always being Linux.   The operating system takes care of features such as accessing the Internet or our home network, reading and writing hard disks and flash memory, running multiple "apps," streaming audio/video from the Internet, etc.  This is why it takes a while for your equipment to turn on and shut off.  It is the kernel booting and shutting down!

 

Further Reading:

Why Computers Crash
Device Drivers

Back to Articles