How an Operating System Talks to Hardware?

Topics Covered

What is Nix Operating System?

A Linux distribution operating system called NixOS was created on top of the Nix package management. It enables trustworthy system upgrades and leverages declarative configuration. There are several official packages" chan nels" available, including the most recent Unstable release and the current Stable release. Tools specific to DevOps and deployment activities are available in NixOS.

Features of the Nix Operating System

  • Declarative configuration method. All the applications, kernel, configuration, and file configurations are built by using a Nix package manager. This means if we build a new configuration in the operating system, then there will be no effect of this configuration on the previous configuration. The new configuration overwrites the older configuration.

  • Reliable updates. No matter what packages or configuration files are present on the system, evaluating Nix files always yields the same result since they are pure and declarative. Therefore, updating a system is just as trustworthy as completely reinstalling it.

  • Atomic upgrades The system will still be in a consistent state: it will either boot in the old configuration or the new configuration if the upgrade to a new configuration is interrupted, such as if the power fails halfway through. In certain other systems, a machine can become inconsistent and cease to function altogether.

  • Can be rolled back using some commands. We can easily roll back to the older configuration if the new configuration is not as per the user's expectation. Also in casethe new newer version crashes or does not perform well, we can roll back to the older version.

  • Reproducible system configurations. It is simple to duplicate a system configuration on a different computer thanks to NixOS' declarative configuration model. The same system configuration (kernel, programs, system services, etc.) is produced by copying the configuration file to the target machine and executing the system update commaexceptn for system components not under the control of the package manager, such as user data.

  • Consistency The Nix package manager will rebuild all necessary packages to guarantee that the operating system is compliant with the logical specification of the system. For instance, package management will make sure that external kernel modules are rebuilt if the kernel is altered. Similar to this, when a library is changed, it makes sure that all system packages, even ones that are statically linked to it, use the new version.

  • Multi-user package management. NixOS does not require any privileged access to install the software. Every user has a specific profile that they can install packages in addition to the system-wide profile. Nix additionally permits the coexistence of several versions of a package, allowing various users to have various installations of the same package in their profiles. Only one copy will be created or downloaded if two users install the same version of a package. This is safe according to Nix's security architecture since only users who have been expressly trusted by the system configuration are permitted to utilize build parameters that would allow them to manage the output of a derivation.

What is Kernel in Operating Systems?

The Kernel is a very essential part of an operating system. The kernel is like a core mechanism that provides all the basic services for other parts of the operating system. The Kernel of an operating system resides between the main layer and the computer hardware. A Kernel performs tasks such as memory management, file systems, works related to networking, process input and output, etc. All these tasks are managed by the Kernel of an operating system. When we start a computer system, the BIOS (Basic Input-Output System) helps to start the computer hardware or the BIOS is responsible for the booting of the hardware of a computer system.

After that, the bootloader starts working and it loads the kernel from a storage device. The storage device like hard drives where from where the kernel is loaded into a protected memory of the system. As soon as the kernel is loaded into the computer memory, the BIOS (Basic Input Output System) hands over the control to the Kernel. After that, all the other components of the operating system are loaded into the system, and here the booting of the computer system completes. Now, the computer system is started and the user can get access to use the system using an interface or system screen.

Kernel in Operating Systems

It is a must that the Kernel should be working properly. If the Kernel is damaged or there is any issue in the Kernel, the system will not boot up properly. Then we will need to do a service check. The service check will analyze the kernel and fix any hardware damage or update the kernel to a working version of the kernel correctly function the kernel.

Features of Kernel

The following are the features of a Kernel:

  • A Kernel provides an interface in which a user can communicate with the application software of a computer system. All the applications are launched and managed by a Kernel. Also, the Kernel is responsible for hardware devices.
  • A kernel manages all the other simpler components of an operating system such as the device drivers. The processes and threads initiated by an application are managed by the Kernel of an operating system.
  • The scheduling of processes and which type of scheduling algorithm to be assigned to a thread or process is also managed by the Kernel of an operating system.
  • The Kernel is responsible for managing the functioning CPU, cache use and file system, all the networking mechanism, etc.
  • All the input-output devices like adapters, disk drives, USB ports, etc are managed by the Kernel of an operating system.
  • The system calls, and hardware interrupts are managed by the Kernel.

Types of Kernel

Now let us learn the different types of kernels and discuss them in detail.

1. Monolithic Kernel:

The monolithic kernels are the very basic type of operating system for a computer. This kernel has features like file management, memory management, and other resource management. This type of kernel provides the operating system with a primitive architecture where all the resources are linked with the kernel space. The operating systems that use Monolithic kernels are Solaris, LINUX, Dos, and OpenVMS. A monolithic kernel is responsible for tasks such as System calls, CPU scheduling, etc. The resources managed by a monolithic kernel are limited. That's why this kernel provides the basic functionality of the operating system.

The monolithic kernel has features like security, and speed of access, and it is more reliable, all these features make this type of kernel to be in more useful for financial projects. The components of the software that controls the hardware reside inside the monolithic kernel. This makes it possible for the kernel to communicate directly with each other without any medium.

Advantages of Monolithic kernel

  • A monolithic kernel is fast and secure in terms of memory management, file access, etc.
  • In a monolithic kernel, a single process runs in a single address space inside the kernel.
  • Monolithic kernel is a single static file.
  • In this kernel, there are fewer security issues and fewer bugs.
  • In a monolithic kernel, the operations are performed by a system call.
  • In this kernel, the process is executed very fast because there is separate memory space for the user and the kernel in this.

Disadvantages of Monolithic Kernel

  • There may be an entire system failure if any service of the kernel fails.
  • It is not easy to do coding and debugging in this type of kernel.
  • If there is any bug in one part of the kernel, it will strongly affect the rest part of the kernel.
  • A monolithic kernel is not portable.

2. MicroKernel:

A microkernel is almost like a monolithic kernel in terms of system architecture, file management, input-output management, system calls, and scheduling process. The thing that makes the microkernel different from the monolithic kernel is that this kernel has some separate memory space that is being allotted for other processes such as kernel services and file sharing. There is a particular space allotted in this kernel for every service. This makes the size of this kernel smaller which alternatively results in the reduced size of the operating system.

The microkernel breaks down the operating system into simpler, smaller, and well-defined modules that make this OS more reliable. Also, this kernel establishes communication between the user program and the services in the user space. Whenever a new service is introduced in the userspace, the kernel does not need to be modified. As all the services run in the userspace so the microkernel is more secure.

Advantages of Micro kernel

  • The microkernel has a modular structure, so there is less possibility of a system crash at all.
  • The influenced parts of this kernel do not affect the other parts of the kernel. Hence, the overall operating system is more secure.
  • The architecture of the microkernel is more compact, isolated, and modulated.
  • For adding new functionality in this kernel we need to compile it first, otherwise, it is not possible to add the functionality.

Disadvantages of the microkernel

  • In an operating system having a microkernel, providing the services is pricy in comparison to a monolithic kernel.
  • There may be an issue due to the uniform performance of the microkernel.
  • The microkernel needs context switching or a function call when we implement the drivers as procedures.

3. Hybrid Kernel:

A Hybrid kernel is a combination of monolithic kernel and microkernel architectures. A Hybrid kernel is a concept where we put some additional codes in the memory space of the kernel and some attributes of the monolithic kernel that together makes a Hybrid kernel. These additional features make a Hybrid kernel much more efficient in performance. A Hybrid kernel does not load the modules at the time of running. A hybrid kernel helped in the development of many operating systems like macOS, WatchOS, and tvOS operating system.

In a Hybrid kernel, some components of the operating system are kept inside the kernel and some components are kept outside the kernel of the operating system. This concept of the Hybrid kernel increases the performance of the kernel, vendor lock-in, and simplicity of the kernel is also increased.

Advantages of Hybrid kernel

  • A hybrid kernel consists of layered architecture due to which it becomes easy to manage. Fewer layers in this kernel.
  • The kernel size is small as compared to the monolithic and microkernel.
  • This kernel is more secure and provides better protection.

Disadvantages of Hybrid kernel

  • As we know the Hybrid kernel is an extension of the concept of combining the monolithic and microkernel, so there are also some disadvantages of a hybrid kernel that are some of the monolithic and microkernel.

4. Nano kernel:

Basically, a Nano kernel is the type of kernel in which the code of the kernel is very small. The code of the nano kernel has the advantage of hardware mode. The nano kernel supports the resolution of nanosecond. Let us take an example of KeyOS. This operating system is an object-oriented OS. It was developed around 1983. The architecture of KeyOS is based on a nano kernel. This operating system was developed keeping in mind that the performance, speed, reliability, security, etc are increased. Also, this operating system was able to run more than one instance of operating system in a single system. The memory size required to run the KeyOS nano kernel was 100kb.

Advantages of Nano kernel

  • The source code of the operating system was very small. The code was only around twenty thousand lines code of C language.
  • The Nano kernel has high performance.

Disadvantages of Nano kernel

  • There are not lots of features like other kernels.
  • This kernel is not in much use because it is almost sthe same as the microkernel.

5. Exo Kernel:

An Exo kernel is a type of kernel that mainly focuses on the management of hardware resources at the application level. The architecture of the Exo kernel is a way that the resource is isolated from the management and priority is given to application-specific customization only. In this kernel, the end-to-end principle is applied. Exo kernel was created with the ultimate goal of imposing as few abstractions as possible whallowing application developersnity to utilize abstractions as and when necessary.

This makes Exo kernels different from micro-kernels and monolithic kernels in that there is no imposed abstraction. All of the hardware abstractions are transferred into unreliable user-space libraries known as library operating systems (libOS), which are linked to programs and used to call the operating system. In essence, the kernel distributes to various application programs the machine's basic physical resources (disc blocks, memory, and CPU time), and each programmer determines what to do with them.

Advantages of Exo kernel

  • This kernel is preferred for application control.
  • This kernel provides a low-level interface.
  • and management both are handled separately in the Exo kernel.
  • Abstractions can be moved safely to a "Library Operating System".
  • Library Operating System provides compatibility and portability to this kernel.

Disadvantages of Exo kernel

  • There is less consistency in this type of kernel. This is because, during the development of the application or operating system, each developer develops according to their own mindset.
  • The interface of the operating system which is based on the Exo kernel, is complicated.
  • Complex design.

What are the Ways in Which An Operating System Controls the Hardware of a Computer?

The interaction of hardware and software results in everything you do on a computer. The operating system manages the majority of the hardware's operations, whereas the hardware supplies the raw power and functionality necessary for the computer to function. Without an operating system, your hardware wouldn't be able to connect, making it difficult to use your computer. Various components work in coordination with the proper functioning of an operating system in a computer system. Let us understand them one by one.

Drivers

Drivers are necessary for the operating system to communicate with your hardware. The operating system learns how to communicate with each piece of hardware through drivers. Drivers are necessary for USB peripherals, sound cards, networking cards, graphics cards, and everything else you attach to your computer. The operating system then makes use of these drivers to guarantee that each device is running properly.

Memory Management

All computers have RAM, often known as random access memory. RAM is what recalls everything you're doing right now, as opposed to hard disc storage, which is more or less permanent. The progress and state of each program you have open, including a browser, photo editor, music player, and messaging program, are all saved in RAM. The operating system manages how much memory each application, including the OS itself, uses in conjunction with your RAM sticks.

CPU Control

The central processing unit, or CPU, of your computer, runs the processes. What happens and in what order are determined by signals sent to and from the CPU. Together with the central processing unit (CPU), the operating system creates a checklist of tasks to complete and monitors their completion. A CPU can only handle one activity at a time; It gives the impression that multiple tasks are being done simultaneously because CPUs are so fast. The operating system oversees and prioritizes each task until it is completed.

Fans and Cooling

Your computer's cooling system is one of the most crucial parts. During times of high stress, the CPU is prevented from overheating by the fan.CPUs can become permanently damaged by overheating. To help ensure that the computer stays cool, the operating system communicates with both the CPU and the fan. Applications running on the operating system can overwrite this process, which is aided by the motherboard's internal controls known as the BIOS.

Learn More

  • To learn more about the Kernel in the operating system, click here- Kernel in OS

Conclusion

  • The Nix OS enables trustworthy system upgrades and leverages declarative configuration.
  • There are several official package "channels" available, including the most recent Unstable release and the current Stable release.
  • The Kernel is a very essential part of an operating system.
  • The kernel is like a core mechanism that provides all the basic services for other parts of the operating system.
  • The Kernel of an operating system resides between the main layer and the computer hardware.
  • Various types of kernel are Monolithic kernel, Micro kernel, Nano kernel, Hybrid kernel, and Exo kernel.
  • The monolithic kernels are the very basic type of operating system for a computer.
  • This kernel has features like file management, memory management, and other resource management.
  • A micro kernel is almost like the monolithic kernel in terms of system architecture, file management, input-output management, system calls, and scheduling process.
  • The thing that makes the microkernel different from the monolithic kernel is that this kernel has some separate memory space that is being allotted for other processes such as kernel services and file sharing.
  • A Hybrid kernel is a concept where we put some additional codes in the memory space of the kernel and some attributes of the monolithic kernel that together makes a Hybrid kernel.
  • A Nano kernel is the type of kernel in which the code of the kernel is very small. The code of the nano kernel has the advantage of hardware mode.
  • An Exo kernel is a type of kernel that mainly focus on the management of hardware resources at the application level.
  • The architecture of the Exo kernel is a way that the resource is isolated from the management and priority is given to application-specific customization only.
  • Various components work in coordination with the proper functioning of an operating system in a computer system such as Drivers, Memory management, CPU Control, and Fans and Cooling.