Types of Operating System

There are roughly two types operating system that nowadays system uses: monolothic and microkernel.

It differs on where this two operating system's services located, basically.

Monolithic OS

Monolithic has all services lies on its kernel, using the same kernel's address space, which means, crash in monolithic can be catastrophic. It halts the entire PC.

Monolithic kernels can be compiled to be more modular, meaning that module can be inserted to and runs from the same space that handles core functionality (kernel space).

Example for this kind of operating system is Linux.

Microkernel OS
  • Advantage: small, failed service can easily be restarted.
  • Disadvantage: performance due to constant system call.

Taken from Wikipedia: a microkernel is a minimal computer operating system kernel which, in its purest form, provides no operating system services at all, only the mechanisms needed to implement such services, such as:

  • low-level address space management

  • thread management

  • inter-process communication (IPC).

So other OS services like file system, process management, or network protocols are running as user-level programs.

To be able to communicate between user-level program they use, for instance to a file system, you need to use the IPC (inter-process communication) from the OS.

Due to this circumstances, what in a monolithic kernel requires a single system call may require in a microkernel multiple system calls and context switches.

To elaborate this, when a program needs to use the disk, it needs to system call the IPC which will call the file system, subsequently, the file system, which a user-level program itself, needs to execute several system call before being able to get itself access to the disk.

An example of this OS would be MacOS.

Operating System Protection Boundary and System Call

Nowadays CPU has multiple ring (protections). Normal users (programs) have restrictions on giving CPU instructions, especially access hardwares like RAM, disk, GPU, etc.

Kernel-privileged programs has no limitation on giving CPU instructions. Operating system, for instance, is a program that operates under kernel mode.

For normal application to be able to access the underlying hardwares, it needs to ask on behalf of the operating system.

Operating system has an API served just for that specific purpose, each request is referred to as a “system call”. By specifying a predefined API, programs now have constriction on what it can do, thus making it much more safe for our application to not break the entire system.

For short: programs running in user mode can't directly access any hardware on it's own, it needs to ask the OS to do it for them, namely "system call". This occur due to safety, that is why operating system exist in the first place.

Services provided by OS includes scheduler, memory manager, block device driver, file system, and more. These service types categorize the huge list API.

Examples of the system call API and their corresponding services (in Windows OS):

File System:

  • CreateFile()
  • ReadFile()
  • WriteFile()

Device Manipulation:

  • SetConsoleMode()
  • ReadConsole()
  • WriteConsole()

Other things to note:

The compiler generates native machine code that can be run straight on the processor. The executable files that you get from the compiler, however, contain both the code and other needed data, for example, instructions on where to load the code in the memory.

When you make a system call, it is just an instruction in the machine code that calls the OS.

Introduction to Operating System

I have been really curious on the subject of operating system. Since I left my school days before I hit this subject, I suppose I can just learn this by myself. Couple of days ago I took the course on Udacity, tought by lecturers from University of Georgia, which also available on Youtube, for free.

Operating system sounds really fancy. But it turns out to be just another computer program like those we as a software engineer build day to day.

What differ is the purpose.

Operating system is a program that manages other programs.

It manages how each of our program uses the available resources such as the disk, memory, or processor.

It provide isolation and protection among applications, and hides hardware complexities through system calls (sort of API of using your hardware on behalf of the OS).

Examples of operating systems are Mac OS and Linux, which both are Unix-based. Other forms might include Android, iOS, and Symbian on embedded platforms.