Now, having reviewed the conceptual tool of an abstraction and the physical resources that is contained in a computer system, we turn our attention now to the major subject, the operating system. What exactly is the operating system? Come help me describe one. So we want to understand the functionality of an operating system.
What better way than ask you what you think are the functionalities that should be provided by an Operating System. So here are some choices I'm giving you in this question, and what I want you to mark off or select are choices that you think describe the functionalities that should be provided by an Operating System. And, more than one of these choices may apply to the functionality that you expect from an Operating System. So go ahead and choose these correct choices. The first choice is, Operating System is a resource manager. The second choice says, the Operating System provides a consistent interface for the hardware resources such as CPU, memory and so on. The third choice says, the Operating System schedules applications on the CPU. The fourth choice says, the Operating System stores personal information such as credit card numbers, social security numbers, e-mail addresses and so on. So, pick the things that you think are functionalities that you expect an operating system to provide.
Now lets talk through the choices I've given you. yes, the operating system is a resource manager. It is the boss in control of the hardware resources. So that's a functionality that you do expect from the operating system. Yes, the operating system - Is the entity that provides a consistent interface to the hardware resource. Remember earlier lecture on obstructions, I mentioned that operating system is a level in the obstruction hierarchy sitting between the application and the processor and the other resources and so in this sense, the operating system should be the entity that provides a consistent interface to the hardware resources such as CPU, memory, and io devices. So yes, the second choice is a good one in terms of functionality, that you would expect from an operating system. The third choice says the operating systems schedules applications on the CPU. This also seems like a think that the operating system should do because there could be multiple applications that require these resources and therefore their has to be an arbitor that is going to provide a way of scheduling. Those requests on the hardware devices and therefore yes. The operating system is an entity that schedules applications on top of the CPU. The last choice says the operating system stores personal information such as credit card numbers, social security number and email addresses. Now this looks like something that you wouldn't have want the operating system to do. And these are, these are personal information and you would not want the operating system to store such information, and therefore this is not a functionality that you expect of the operating system. So the first three choices are the right choices. The operating system is not an entity that should be storing your personal information such as credit card numbers and so on.
Most concisely, an operating system contains code to access the physical resources, that is contained in a computer system, and arbitrate among competing requests for those hardware resources, coming from multiple applications that may be running simultaneously on the processing platform. So in other words, the operating system is just a program, like any other program you may have written. Okay, slightly more complex than a hello world program, I'm being facetious here, intentionally. But you get the point. It's a matter of climbing the latter of programming, just like, a ball player may start from t-ball to little league to the minor league and then to majors, you can also do it. If Microsoft can do it, you can do it. If you can write a hello, world program today, you can eventually write an entire operating system. So what the operating system provides are well-defined APIs for accessing the hardware resources that are managed by the operating system. And these resources are provided as operating system services through this well defined interfaces, and an application may make a request to the operating system for such hardware resources through this well defined api interface. And the application, via the response from the operation system gets the services from the operating system via these API codes.
Let's start by giving a few examples of how hardware and software interact. An application asks for and obtains services from the operating system. For example, reading a file that is stored on the hard drive. Or clicking the mouse on Google Earth to take you virtually to some place. Now let's understand, how the hardware architecture and the system software work together to serve an app running on the computer system.
Here is another fun quiz to get you thinking about hardware, software interaction. And in this question, I am asking you, what happens when you click the mouse? And I'm giving you three choices. One of those is the right choice. And the first choice is, the mouse click corresponds to specific CPU instructions. The second says, the mouse click starts up a specific program to read the spatial coordinates of the mouse. And the third choice says, the mouse click results in a CPU interrupt. As I said, there's exactly one right choice, and I want you to pick the right choice.
As you may have guessed, the right choice is, the most clicked results in a CPU interrupt. That's the first thing that happens, and once the interrupt has been delivered to the CPU, there are domino effects that may eventually result in some program running to read the spacial coordinates. But the thing that happens when you click the mouse is it results in a CPU interrupt.
Let's understand what happens when you click the mouse on your computer. Let's say you're running the Google Earth application and you select the point that you want to visit on the globe by clicking the mouse. When you click the mouse, first the hardware controller that is interfacing the mouse, which is a hardware device. To the system using the conduit of the bus is going to raise an interrupt on the interupt line which is one of the dedicated lines on the bus. This conduit, which I call the bus, contains, as you know, data lines and address lines and one of the things it also contains is an interrupt line or multiple interrupt lines. And the controller asserts this interrupt line to indicate to the CPU that it wants attention. It's sort of like, if I'm teaching a class and you all were a live audience. If you have a question, you might raise your hand and that's exactly what happens when you click the mouse. The equivalent of raising your hand in a classroom is what the controller is doing, but asserting the interrupt line on the bus. Asserting the interrupt line on the bus results in an interrupt to the CPU, now the processor at this point of time, is running some program. Perhaps your Google Earth application is being run on the CPU at this point of time. An interrupt is a hardware mechanism for alerting the processor that something external, in this case the mouse click, requires the attention of the processor. It's sort of like a doorbell in a house. Someone is ringing the doorbell, someone has got to pay attention to who is at the door. Remember that the CPU is a dumb animal. All it can do is execute instructions. Right now, it's executing some application. Now, an interrupt comes in, some other program has to run on it, in order to field that interrupt, answer the doorbell. Who's that entity? That is the operating system. The operating system, which is also a collection of programs, schedules itself to run on the processor so that it can answer the doorbell. So the operating system is the one that fields this interrupt, finds out, who it is intended for, and passes it to the program for appropriate action for this particular interrupt. This example of a mouse click and what happens between the hardware and the software is a good way to segue into the abstractions provided by an operating system for managing the hardware resources.