In the last article, we have started studying about basics of operating system and we also saw the introduction of the operating system we saw what an operating system really is What it really does and we have also seen the functions of operating systems and we have also seen some basic examples of the operating system.
Basics of operating system
Now in this article, we will be seeing some of the basic concepts that you need to know before we really go into the details of the operating system so, in this article, we will be mainly studying computer system operations.
Ao basically it is about the structure of the computer system now why I am doing this is because some basic knowledge of the structure of the computer system is required to understand how operating systems work so by studying this structure of the computer system.
This will provide you a base for understanding the operating system so instead of directly diving into how operating system works we should have a base about this so that it will help us to understand in a clearer way about the operating system so after studying this when you study each and every concept of the operating systems.
You will not feel completely blank but you will have a proper idea of why we are doing this or why certain thing is working in that way and not only that by having a basic introduction to this structure of computer system.
You are getting a basic introduction to computer organization and architecture which is an important course as far as computer science and electronics are concerned all right so now let us see what we can study from this computer system operation.
Moder General Purpose of Computer System
In this article so here it says a modern general-purpose computer system consists of one or more CPUs and a number of device controllers connected through a common bus that provides access to shared memory so don’t worry about this definition it will become clear.
Which we can use to explain this sentence that is written here so let us break the sentence into parts and see what each – mean a modern general-purpose computer system consists of one or more CPUs now what do we mean by this a modern general-purpose computer.
It consists of one or more central processing units now what is the CPU. CPU is the main part or doubles we can call it the brain of the computer system it is the processing unit that is where all the computations and processing and calculations take place on a computer.
CPU what comes to our mind usually as an OVA is what comes to our mind is that big box beside your desktop that you have and that is what we generally think a CPU is we just look at it and we call it that this is a CPU but that box is not just two CPU.
That box consists of many things like your motherboard your cd-rom your USB cords many things are there but CPU is just a small chip that is there embedded into your motherboard and that small chip is responsible for performing all the computations and calculations.
And that is your actual CPU so that box itself you can just call it a cabinet but the CPU is just a small unit that is present inside that box which is there in your motherboard all right and then the modern computer systems it may have one or more CPUs depending on the processing power of your computer.
CPU and Controllers
So that is the meaning of the first line and a number of device controllers connected through a common bus that provides access to shared memory.
So here we have some hardware’s like your disk which will be your hard disks or anything like that and then we have some more hardware’s here like your mouse keyboards printers and then you have your monitors over here.
It is not limited to this but this is just an example I am showing you and then each of these hardware’s or devices are connected to a controller.
This controller is responsible for the way these devices work so here, for example, we have the disc which is connected via the disk controller and then these devices here like.
Assuming that all USB devices.
They are connected to the USB controller because these are connected to the USB ports and the USB controllers will take care of how these devices perform and then you have your monitor that is your display and that is connected to a video adapter and these adapters or controllers are responsible or they are in charge of how these devices actually work.
And then the CPU we have it here the central processing unit along with these controllers are connected via a common bus that we have here this line over here it represents.
The common bus this one which we talked about and we see that they are all connected to this bus it is common to all of them and that bus is connected to our shared memory alright let us see about this in more detail.
So here I have some points written down each device controller is in charge of a specific type of device so here we have device controllers and each of these controllers or adapters they are in control of a specific kind of device.
As it is shown here and then the CPU and the device controllers can execute concurrently competing for memory cycles now what do we mean by this line so we see that they are all connected to a memory controller over here and why is that is because I already taught you in the first article that whenever something has to be executed.
Whenever something has to be loaded it has to be loaded into your main memory is like your RAM random access memory that you have and don’t worry if you don’t know about it in detail I will do another article.
Where I will be explaining about the storage and memory that we have so just known that whenever something has to be executed.
It has to be loaded into your main memory and your main memory is not unlimited or infinite but it is limited it is a finite amount of memory that you have like in your laptops or in your desktops.
You may have 2gb of RAM or 8 GB of RAM so on and so forth so depending on the size of your RAM that is the amount of memory or the main memory that you have and whenever you execute.
Something that has to be loaded into your main memory and now we see that all these devices in order to work they need to be loaded into the main memory for any execution that has to be performed and then the disk controllers.
The adapters are taking care of this and this has to be loaded into the main memory and we see here that all these device controllers along with the CPU can execute concurrently now what do we mean by concurrently means that all these devices or controllers can execute all at the same time.
Suppose you are watching something like let’s say a video or a movie in your monitor and at the same time you can minimize and type something using your keyboard onto your Microsoft Word.
Now when you do this you don’t experience a lag you never experience a lag like when you are typing something your video gets a post or something like that you never experience why because they are all working concurrently.
They’re all working at the same time that is how powerful your system is and that is where you have to appreciate.
The beauty and power of your system now in order to make all this work seamlessly without having any lag or having any problems what do we need to ensure orderly access to the shared memory a memory controller is provided whose function is to synchronize access to memory.
These devices need access to the memory because they all have to be loaded to the memory in order to work and now we need to ensure that all of these devices gets their required share of memory so that they can be loaded correctly.
They can be executed in the right way without having any problem for the user so what we have is a memory controller so we have a memory controller here which ensures that every controller or every other controller or devices get the proper access to the memory that they need so that they can perform or work smoothly without having any problems.
So the memory controller synchronizes everything and makes everything works in a very smooth way so that is what we can understand the basic structure of how things are arranged so first we have the CPU and then the CPU along with the disk controllers which are responsible for the working of each and every device.
The common bus and that is connected to the memory controller which takes care of how the memory has to be shared between each and every device. so that it’s working is proper and smooth all right.
The first one is known as a bootstrap program so what is a bootstrap program the initial program that runs when a computer is powered up or rebooted is known as a bootstrap program so bootstrap program it is the first program that is executed or that runs when you power up or reboot your computer system.
So when you go and press the power button of your computer the first program that loads that help in powering up the system is known as the bootstrap program.
The bootstrap program it is stored in the room at home stands for read-only memory which is a kind of secondary memory so your bootstrap program is stored in your roam and then it must know.
How to load the OS and start executing
That system so as I told you bootstrap is the first program that loads when you power on your system and that program what is its function it must load your operating system.
Your operating system is the interface between you and the physical Hardware so your operating system also is the software it is kind of a system software so that operating system.
It is already residing or it is stored somewhere in your secondary memory and then the bootstrap program must know how to load that operating system.
And start it for you and also I told you that the operating system is stored somewhere in the secondary memory.
The bootstrap program must know where your operating system is stored and it must go there and it must invoke the operating system.
And it must load the OS kernel into your main memory it must locate and load into memory the OS kernel now what do we mean by the kernel is like the heart of the OS is the main part of the operating system.
So that has to be loaded into your memory and then the bootstrap program as you switch on your computer it is the first program that is run and it goes and finds where is your operating system and then the kernel of your operating system it takes it and it loads into the memory.
The operating system will come to life and after that, the rest of the things the operating system will take care so that was about a good strap program now the next thing that I want to introduce to you is something known as an interrupt.
So let us see what an interrupt is so what comes to your mind when you hear the word interrupt so in English we know what is an interrupt when you are doing something if someone comes and disturbs you or if someone comes and says please stop doing this work and do something else that is an interrupt we are interrupted.
So think of it in the same context this is almost the same even in case of a computer system and let’s see what or how we can define this and what it actually.
The occurrence of an event is usually signaled by an interrupt from the hardware or software so we know that the CPU is always working it is doing some work and when the CPU is doing that work sometimes the hardware or software may interrupt.
The CPU it may come and tell the CPU that wait just wait with whatever you are doing and please execute this task that I am giving you this is more important so the CPU has to stop and it has to execute that task which comes up and that is known as an interrupt.
The hardware may trigger an interrupt at any time by sending a signal to the CPU usually by the way of the system bus so we have different hardware in our system and then that Hardware can trigger an interrupt.
It can interrupt and how does it do that it sends a signal to the CPU and how can you send a signal to the CPU by the way of a system bus through the system. what I mean by bus so here this line represents the common bus we have so similarly using a system bus the hardware can send the interrupt to the CPU and the CPU has to stop whatever it is doing and it has to execute the interrupt.
So we will see how to CPU responds to the interrupt later so let us understand what is meant by interrupting that way.
It says a software may trigger an interrupt by executing a special operation called as system core now as I told you when Hardware triggers an interrupt we usually call it as interrupts if the software is what that is triggering the interim if the software is causing the interrupt then that is known as a system call or a monitor call.
So if it is the hardware we usually call it an interrupt or if it is triggered by software then we usually call it a system call or a monitor core so I hope that made clear to you what an interrupt actually means now let us see how does the CPU respond.
It receives an interrupt so here it says when the CPU is interrupted it stops what it is doing and immediately transfers execution to a fixed location so I already told you how interrupts can arise either from hardware or software.
So CPU is already doing some work and then immediately it gets an interrupt from either a hardware or software so when the CPU is interrupted in that way what does it do it stops what it is doing it stops what it was doing and would then it immediately transfers execution to a fixed location.
The CPU was doing it just stops it and then it transfers this execution to a fixed location now what is that fixed location that we are talking about the fixed location usually contains the starting address where the service routine of the interrupt is located.
We have a new term here which is called service routine now what is a service routine is nothing but it is something where what the interrupts actually wants to do is written so let’s not go into the technical details I’ll just tell you basically what it means so when interrupts arises there is something that the interrupts wants to do so there is something that the interrupts want to do something it wants to execute so what actually has to be executed or what actually the interrupts wants to do that is written in the service routine so every interrupt has its service routine known as the interrupt service routine sometimes.
It is known as AI s R so when the CPU is interrupted it stops what it is doing and it immediately transfers its execution to the starting address of the interrupt service routine so the interrupt service routine may be located somewhere and it has a starting address.
It should start its execution so the CPU it stops what it was doing and it transfers its execution for the starting address of the interrupt service routine so that is the first thing that the CPU does when it is interrupted and then what happens the interrupt service routine executes so whatever was written in the interrupt service routine gets executed completely and then what happens on completion the CPU resumes the intercepted computation.
So we know that the CPU was already doing something before so when the interrupts are roast what it did it transferred its execution to the interrupt service routine and then it executes it and when it is done once the interrupt service routine executes.
The CPU can go back from where it came from the execution of the CPU goes back to where it came from and it resumes whatever it was doing so this is how the CPU responds to interrupts and I hope that made it clear to you how an interrupt is handled by a CPU at least the basics so this was just a basic introduction to computer system operations so I will not go into great detail.
Also, read: what is OS
Because this is just the basics that you need to know before you really understand the details of the operating system.
I hope this was clear to you which is also an important topic that you need to be knowing for understanding your operating system. Thank you for reading this and share this article with your friends. Keep smile be happy.