Why operating system and virtualization...

Dipanshu Torawane - Mar 11 '22 - - Dev Community

We in this modern era are the power users of computers which contain an interface to interact and perform our day-to-day tasks. But really why is there an interface and why you should care about it?

Every computer is made up of hardware such as CPU, memory, storage, and I/O devices like a monitor, keyboard, and mouse. All the programs running on the computer need to use these hardware resources.


How do we run apps if there were no operating systems?

Let us understand what it takes to run your favourite browser on your machine. Use of browsers like Chrome*(pretty heavy duty)* will require some CPU, memory & I/O devices to interact and do the task (how to center a div)😅.

Some things to keep in mind are that

  • apps don't know how to talk to the hardware,

  • apps can't be installed directly on the hardware.

We need to write code for that application and configuration with the hardware in order to use the application on the hardware. Imagine doing this for every application we need to use, it will be so inefficient. Writing code and configs require knowledge of programming languages, converting to machine code*(0's and 1's)* and then optimising it for better performance. Ohh god, feels like a long TDS and inefficient process.

As to remove this inefficiency we use an intermediate to talk to the hardware which can handle all these for us which we call an Operating System. The operating system can interact with hardware & applications so it is like a middleman between the two.

A-basic-working-of-an-Operating-System.png


What does an O.S. do to make our life easier?

We focus on performing day-to-day without caring about managing, allocating resources and so on. But there's a lot of stuff happening behind the scenes.

taks.jpg

The above image shows the functions and tasks that are performed in order to run our next-level heavy-duty applications.


What is the operating system made up of?

The operating system contains layers of software that have specific tasks when a computer is powered on. It starts with the kernel, a program that consists of device drivers, dispatchers, schedulers, file systems, etc.

The kernel always loads first. It is the heart of every operating system responsible for managing hardware components. It starts the process for the app, allocates the required resources and also cleans up when not needed.

Linux Distros like Ubuntu, Mint, CentOS, etc, and Android are based on the Linux kernel. Linux Kernel is the most widely used. On the other hand, macOS & IOS are based on different kernels known as Darwin.


How to interact with the kernel?

Graphical User Interface*(GUI)* and Command Line Interface*(CLI)*, both are ways to interact with the kernel and have their own importance.

GUI uses a combination of technologies and devices to provide a platform that users can interact with, for the tasks of gathering and producing information. A series of elements conforming to a visual language have evolved to represent information stored in computers. This makes it easier for people with few computer skills to work with and use computer software. The most common combination of such elements in GUIs is the windows, icons, text fields, canvases, menus, and pointer (WIMP) paradigm, especially in personal computers.

The WIMP style of interaction uses a virtual input device to represent the position of a pointing device's interface, most often a mouse, and presents information organized in windows and represented with icons. Available commands are compiled together in menus, and actions are performed by making gestures with the pointing device. A window manager facilitates the interactions between windows, applications, and the windowing system. The windowing system handles hardware devices such as pointing devices, graphics hardware, and positioning of the pointer.

In personal computers, all these elements are modelled through a desktop metaphor to produce a simulation called a desktop environment in which the display represents a desktop, on which documents and folders of documents can be placed. Window managers and other software combine to simulate the desktop environment with varying degrees of realism.

Layers of a GUI-based on a windowing system

There are three main operating systems for computers:-

  • Linux

  • Windows

  • macOS

Each OS has many versions. The kernel stays the same but the application layer is being developed & improved.

The operating system for servers (which are extensively used in Software Development to the apps reach the user with high availability, and no downtime). The servers are mostly Linux-based (more lightweight and performant).

The servers use the command-line interface (no GUI or other user applications). CLI is commonly used to debug apps that are accidentally stopped due to bugs, on the servers they are deployed on. This interface gives us the whole control of the OS with the use of commands and is also used to automate some stuff on the servers with the help of scripts*(are written using scripting languages that OS provides as Linux provides with bash as the terminal and bash scripting is used to write the scripts)*.

The servers use the concept of virtualization and virtual machines to make efficient use of available resources and these are the building blocks of cloud computing.

Virtualization and Virtual Machines.

What is a Virtual Machine(vm)?

A computer system is created using software on a physical computer in order to emulate the functionality of another separate physical computer. Virtual Machines are completely isolated means if something breaks inside the vm, it doesn't affect the host machine.

And if it breaks, you can delete that vm and create a new fresh one easily. This is achieved by using Hypervisor (a technology that allows multiple virtual computers on a physical computer host OS on top of the OS that is already installed).

Virtualization Architecture

VMware was the one to come up with virtualization. Nowadays people can add their own hypervisor called Oracle VirtualBox which is open-source, in order to test different operating systems and test the compatibility of their applications on different OS so that every user has a great experience while using the app.

Virtualbox Logo

VirtualBox takes hardware resources from the host OS and creates a virtual CPU, virtual RAM, and virtual storage for each virtual machine. You can only give resources that you actually have, which means hardware resources are shared.

The benefits of using a Virtual Machine are to learn and experiment with different operating systems as you don't need to buy a new computer for that. Mainly, you don't endanger the main OS.

Virtual Machine Benefits


There are two types of Hypervisors

  • Type 1 Hypervisor

    • Type 1 Hypervisor use cases efficient usage of hardware resources. As to use all the resources of a performant big server and users can choose any resource combination.
    • Some big cloud providers like AWS, Azure, GCP, etc use this type of Hypervisor.

      GCP Azure AWS

  • Type 2 Hypervisor

    • VMware and VirtualBox are examples of this type of Hypervisor which gives users flexibility for various use cases.

      Hypervisor Types


Why are companies adopting Virtualization?

The main benefit is the abstraction of OS from the hardware.

Without Virtualization =>

  • Companies have their own servers and are managed by themselves.

  • OS is tightly coupled to the hardware.

  • If any part of the hardware fails, the whole data is gone*(one-point failure)*.

With Virtualization =>

  • OS acts as a portable file(Virtual Machine Image includes the operating system & all applications on it).

  • You can have backups of your own OS*(known as* snapshots).

  • The OS is portable and not dependent on the physical server.

  • They can be secured very easily.


Thanks for reading and hope you would have now understood what is Operating System, and how it works. The main takeaway is Virtualization, the backbone of the servers to make efficient use of resources.

Please do share your thoughts in the comments and like the blog so that it reaches everyone who is stumbling across this topic and want to understand the idea behind it.

You can find my all socials at => bio.link/dipanshutorawane

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .