Every PC is nothing more than an integrated system of hardware and software where the operating system is what we could call the most important program by serving as a bridge between the programs and the hardware itself. Without the operating system, then the programs could not interact with the hardware, since we are talking about two different worlds: the first, which is basically intangible and which is that of programs or software, and the second, which is that of processors. and memories.
Actually when any of us makes use of an application on the computer we are not making use of that application only, the application uses the operating system, which in turn uses the hardware. So if, for example, you are now writing an email or reading this article, then you have to know that what you are seeing on the screen is the product of this relationship between the software, the operating system and the hardware.
The first operating systems were simple, but as the power of the hardware increased it became possible for them to do more and more things, while at the same time the operating system had to manage them. Nor can we forget the huge variety of hardware that exists for PC today. Most are generic products, but others require specific communication to function properly.
The Operating System decides what, where and when things run
Programs are nothing more than a series of sequential instructions that the CPU has to execute, it is true that a program has jumps and loops, if we are strict a program is nothing more than that. Within each program there can be several subprograms that run in parallel or in series. Be that as it may, these have to be executed on the CPU and there are dozens of routines and processes that the operating system has to manage at all times.
Programs don’t decide what process or routine it runs at all times, neither where and much less when. This is the work of the kernel of the operating system that manages the different processes. Surely you have ever given the task manager, specifically to the background processes tab.
Well, all this is what the operating system has to manage and it has to do it in such a way that each one of the programs receives the processing time from the CPU that it requires. When a program or the PC is slow, this is because the operating system does not have enough power (or optimization if necessary) from the CPU to carry out its day-to-day tasks.
VIP client on RAM and processor
The operating system runs like the rest of the programs in RAM, but to prevent the rest of the programs from interfering with its operation and even modifying the data and instructions handled by the operating system, what is done is to reserve a RAM space exclusive to the operating system to which no other program can under any circumstances under normal conditions.
Because the operating system is the one communicates with hardware This has a hierarchy that is above the rest of the programs, since when managing the execution of the routines, the operating system also has access to the RAM space of the programs. In other words, the operating system is like a housekeeper who has access to all the rooms in the mansion that would be memory, while the programs would have limited access. In the case that we are running a virtualized operating system, then the operating system’s hypervisor is the one that has direct access to the hardware.
However, nothing is perfect and there are times when security holes can be created that are exploited by certain programs to execute code in the operating system space. For example, computer viruses are so called because they manage to infect the part of memory assigned to the operating system with their code, allowing them to escape its control.
Communication between the operating system and hardware
On the PC, access to the hardware is done using certain memory addresses, which when sending data to them do not cause a reading or writing effect of the same in RAM, but end up generating a specific action on the hardware associated with said memory address. Either automatically or failing that, the data serves as an input method for said function. Today, due to the enormous number of routines and processes that are executed, drivers are used to communicate the programs with the hardware.
Therefore, when the OS requires access to certain hardware functions, it makes use of the drivers. A driver is just one abstraction how the hardware works. In computing we call abstraction a program that emulates an element as much as possible. In the specific case of the driver, it does not emulate the hardware in its entirety, but what it does is emulate its communication interface. The same driver is then the one that transforms this into instructions that the hardware does understand so that the operating system can communicate with the different components and devices on the PC.
Despite the fact that in the x86 architecture the addressing of memory and I / O is unified at practical levels and today it is separated, since access in general although it is done through the MMU, is the IOMMU the one in charge of communication with the peripherals, which is subordinate to the first.
In short, hardware and operating system are essential among them, they do not work alone in any case and they need a third actor such as drivers, which complicates the entire framework even more in all its functions.