What is an operating system and how operating system works?
The software that controls the program execution of any type of computing device is called the operating system. Simply put, Simply put, it is a computer program or software whose job is to coordinate between the computer’s hardware and software according to the user’s instructions and to work on the input, output, storage, and processing of various computer programs.
No matter which way you measure it, an operating system is the most important software installed on a computer. The operating system not only acts as a controller for many computer processes, it also allows the user to make the most of the various words, graphics, and memory power in the computer’s hardware.
The biggest thing is that there are so many computer users now, all of their computers will be useless if no operating system is installed in it. As the computer has improved and developed lately, so have the various commercial, free, open-source, closed source operating systems of the computer.
some operating system examples
Here some operating system examples- Microsoft Windows, Linux, Unix, Mac, Android, etc. Amongst them Windows operating system, Mac and Linux is widely used and most popular pc operating system.
Many of you probably know what services of operating system are. The above writings may seem very familiar to them. But do you know how operating system works in computer?
In today’s article, we will try to tell you in detail how an operating system works actually. You can download a pdf version of this article “how operating system works pdf” by clicking here (pdf version link).
Read: all about amd free synch you need to know
Types of operating system and how operating system works
How many types of operating system? Some say, there are four systems, and what are the 4 types of operating system? Moreover, what is operating system and function of operating system?
The operating system can be divided into different types based on the user interface, the number of users, the number of processors used, the ownership of the program, etc. to understand the classification of operating system, here are some of the most widely used types of operating system-
- Batch operating system (Bank Statements, Payroll System, etc.)
- Time-Sharing Operating Systems (Multics, UNIX, etc.)
- Distributed Operating System (LOCUS)
- Network Operating System (Microsoft Windows Server 2003, Microsoft Windows Server 2008, Mac OS X, UNIX, Linux, etc.)
- Real-time Operating System (Scientific experiments, weapon systems, robots, air traffic control systems, medical imaging systems, industrial control systems, etc.)
There are some best game for graphics pc, if you are interested then take a look!
What is the function of the operating system?
Maybe you have a device with the latest operating system. But do you know what does an operating system do actually? The main function of an operating system is to manage the programs running on a computer. Each program requires a number of resources.
Such as processor, memory (RAM), storage, network, etc. One of the functions of the operating system is to present these resources in an easy-to-use way. So that the general programmer does not have to worry about how the resources work, whether they are available, etc. This process is called virtualization.
Should you take dual channel vs single channel ram? Which is better? take a glance if you want!
Another important task is to distribute these resources among different programs. So that one program does not interfere with the execution of another program (intentionally or unintentionally).
A modern desktop operating system probably has a lot more to do. But these are the main operating system functions. Some says, there are 10 functions of an operating system.
How operating system works–Process
The process is an ongoing program. We call some instructions stored in storage a program. When it starts running on the machine, it becomes a process.
There are several things involved in the process. For example, indicating the number stored in a register in the CPU, how many numbers of instructions are being executed in the process at the moment?
This register is called PC (Program Counter). In addition, some registers are associated with a process that uses the process to settle accounts.
Then there is the memory associated with the process that the process can access. One part of this memory contains the code of the process itself. Then the declared variables are in a stack. Then there is the hip which contains the manually allocated memory.
Anyway, do you know Why Benchmark your Gaming Device is Necessary and How to Do it?
Mode of operation
No one process can be allowed to do everything in the system. As such, not all processes are allowed to arbitrarily occupy memory or access storage. This can be a problem for other programs in the first place. Or the programmer may crash the entire system if it misuses that resource.
how operating system works brainly to get rid of these types of problems?
Somehow the limited size of the program should allow for the use of resources. To solve this problem a special mode is used in the CPU. user mode. In this mode, a process cannot perform any prohibited work (such as I / O operation).
If so, the CPU will raise an exception. And the OS will kill the accused process!
Processes can perform prohibited tasks through system calls. To make a system call, the process must execute a special trap instruction. If you execute this instruction, the processor will jump into the kernel and change the mood to kernel mode.
At this point, the process’s PC and other information on the CPU will be pushed to a kernel stack assigned to each process.
Read: 4k gaming Monitor
In kernel mode
In kernel mode the CPU can execute all types of instructions without interruption. The system can then see if the prohibited work is approved or if there will be a problem.
If all goes well the system will execute a special return-from-trap instruction again. Then the mode will go back to user mode and the kernel stack will pop up. The process will continue normally.
Now if you tell the user process where the code is in the kernel, various security problems will be created. So at boot time, a trap table is set up to inform the CPU, where the addresses of system operations are stored with a number.
When a user program wants to operate a system, it will call this number. The CPU will then understand where the execution will jump. In C programming language we see many system calls, such as open, read, write, fork, connect, etc.
One of the steps in CPU virtualization is to run multiple programs simultaneously on one CPU. (Although modern computers have more than one processor, many more programs need to be run simultaneously).
The solution is very simple! You have to run a program for a while then stop it and start running another program, then another one. This strategy is known as time-sharing.
Read: 15 inches subwoofer!
One thing to note is that if the OS wants to control other processes, the OS will need its own but the CPU, meaning the OS code must be executed on the CPU.
Now suppose a process is running on the CPU. The CPU is executing the program’s instructions one by one. If it continues like this now, how will the OS itself return to the CPU?
And how to control those processes or other processes? And what if the process causes an infinity loop? What is the way without opening the power cord?
The CPU has a mechanism to solve this problem. The CPU raises an interrupt after a while running the program. This causes the process to stop temporarily and move to the execution kernel.
The trap table tells you in advance where the execution kernel will go in the interrupt. This way the OS regains control and can switch to another process if necessary.
To implement time sharing, you must have the ability to switch from one process to another. This is why the OS usually executes a low-level instruction, which copies the process’s PC and other registers and puts them somewhere in memory.
And the PC and other registers of the process that is being switched are loaded into the CPU. This process is called the context switch.
So now the process is controlled and run with limited privilege. The context switch is also arranged. Now we have to decide which processes or processes will be allowed to continue first and which ones later. All operating systems have a scheduler to make this decision. The objectives of a scheduler are:
- The CPU never sits down even when there is work
- Complete all processes in the system as soon as possible
- Separately complete each process in the minimum time. Which means it’s about to be the most delusional time of the year, as well.
- Minimize the time it takes for a process to respond or generate output for the first time
- Minimize the time it takes for each process to be executed
An easy solution would be to run the process that comes first and finish it first and then move on to the rest. The problem with this is that if one program is too big for time and comes first, it will outperform all other small programs. If the user wants to run a new program, it will also sit.
Another solution can be found in this way. Each process runs for a certain period of time, in which case it is over, otherwise, it moves on to the next process. In this way, all the processes turn around and come back to the first one. This technique is known as Round Robin (RR). This time slice is often called scheduling quantum. The smaller the slice here, the better the response time.
the problem is again much smaller
But the problem is again much smaller. Because it takes some time to switch context. If you do it too many times, it will take a lot of time for the system.
Another thing is I / O. I / O operations usually take a long time outside the CPU. So when you start a process I / O, it is a good idea to switch to another process without leaving the CPU. Then another decision has to be made whether the I / O of that process will be switched back to that process as soon as it is over or the others will come back to it again after the end of the round. If not switched on immediately, it will be seen that the processes that have more I / O will get very little CPU time.
But they are usually interactive types of programs where the user expects to get input as well as output. Again, if switched on immediately, a process will be able to return to the CPU almost immediately after a certain period of time (just before the end of the scheduling quantum) by making a small I / O call without any reason. In this way, the whole process can occupy the CPU alone. Keeping up with such opportunities may not be good for the system.
Multilevel Feedback Queue (MLFQ)
Multilevel Feedback Que is a popular scheduler. It executes much like RR by placing processes in multiple queues with multiple different priorities. It uses some special techniques to assign CPUs to processes based on features of operating system windows/behaviors. Here are some of the ones I found to be interesting:
- The first Q is the highest priority. Less of the latter. There may be several queues for different priorities
- In any new process in the system, it will actually be inserted in the first queue
- The processes that have the most processes in the queue will be executed in the RR strategy. In this case, if any process is issued I / O, it will be stopped. I / O will be switched on again at the end
- If a process passes a scheduling quantum drawn in a queue, it will be dropped to the queue below it. This prevents non-interactive long processes from occupying the CPU
- Ignoring how many times a process has stopped issuing I / O, when the scheduling quantum of a queue is over, it will also be lowered to the bottom queue. By doing this, no process will be able to manipulate the CPU
- Now the problem is that if small processes keep coming to the system then the big processes will not get CPU at all. Again, if a process uses only the CPU without any interaction at first, then it will be a problem if it wants to be interactive later. All you have to do is boost the priority after a certain period of time and put all the processes in the first queue.
Some implementations use a single size scheduling quantum for each cue.
A rough illustration of MLFQ
MLFQ solves many problems of schedule quite well. A slightly modified version of this scheduler is used in the BSD derivatives of Unix and most likely in Windows as well.
However, one of the problems is that there are many parameters. For example, how many queues will be used, how much will be the scheduling quantum, how long will the priority boost be done, etc. These are quite difficult to determine correctly.
Read: Bluetooth boom box
Completely Fair Scheduler (CFS)
The Linux kernel currently used is the Completely Fair Scheduler. As the name implies, it looks at all processes equally. Everyone has a virtual runtime or runtime associated with the process. As long as a process lasts, its runtime is increased accordingly.
The process with runtime is taken when deciding which process to run. To make the matter efficient, the processes are kept in a red-black tree. Every process in CFS again has a nice value. Using this value, time slice and runtime are calculated separately for each process.
In this way, the value determines the priority of a process. Smaller values indicate more priority. (More value of a process means that the process is polite, even if you don’t pay much attention). This value is found in the NI column of the top tool in Linux. The user or system admin can change it if desired.
Some other schedulers are BFS, O (1) scheduler (name based on the time complexity of process search), O (n) scheduler etc.
What are the major components of the operating system?
All components of an operating system exist so that the various parts of a computer system work together. All users have to undergo the operating system in order to utilize any of the hardware, whether it is as basic as a mouse or as complicated as an Internet browsing component.
Basically, the components of operating system play a key role to make all the computer system parts work together. The major operating system components are discussed below –
- Process Execution
- Memory Management
- User Interface
Hopefully, after reading this article you have got a detailed idea about how operating system works with hardware and the importance of operating system. Apart from this, Esports education–a career, it’s part of Education, if you want to know more about it, then take a glance!