Operating System Structures Multiprogramming and Multitasking

Operating System Structures Multiprogramming and Multitasking
Multiprogramming and Multitasking

Structures Multiprogramming and Multitasking

Computer system organization and architecture we are now ready to talk about operating system structure so in this article we'll be studying about operating system structure and will be mainly talking about multiprogramming and multitasking so operating systems.

They vary greatly in their makeup internally so we have different kinds of operating systems that we know like Windows who born - and so on and these operating systems.

They vary in their makeup internally the way they are made may be so much different but they also have so many common things in them so we'll be seeing about the common things that every operating system must be capable of doing in this article so we'll be talking about the commonalities so the first two things that every operating system must be capable of doing.
  1. Multiprogramming 
  2. Time-sharing or Multitasking 
So these are two very important topics which we'll be seeing in this article so first let's talk about multiprogramming.

 Multiprogramming and Multitasking

1. Multiprogramming

And then we will see about multitasking which is also known as time-sharing so coming to multiprogramming from the name itself we must have understood that multiprogramming means the capability of running multiple programs by the CPU.

A single user cannot, in general, keep either the CPU or the i/o devices busy at all times now if you are not having multi programming what will happen is that a single user will always keep the CPU or the i/o devices busy at all the times.

Because when a single user wants to execute a particular task he will use the CPU so until and unless the task is completed no other users can use the CPU or the i/o devices because it is not capable of multiprogramming but in multiprogramming what will happen is that it increases the CPU utilization by organizing the jobs which are cords and data.

So that the CPU always has one to execute so that means

Multiprogramming what we are trying to do is we are to increase our CPU utilization because a CPU is capable of executing multiple programs.
  • The job pool and the memory layout of the multiprogramming system.
  • Job is something that has to be executed which may contain codes and data.
So here we have a job pool which consists of all the jobs that enter the system so all the jobs that have to be executed are kept in a job pool like this and then here we have the memory layout of a multiprogramming system.

So on top, we have the operating systems and these are the jobs that are loaded into the memory so we cannot load all the jobs in the job pool into the memory because we don't have unlimited memory or memory is limited.

So by memory I mean the main memory or your RAM so here in this example we are having 512 megabytes of RAM over here so you are not able to load all of this into the main memory so a subset of this jobs or some of these jobs are loaded into the memory so for this example we have loaded job 1 2 3 & 4 into the memory now this operating system has to help in executing these jobs by assigning the CPU to this particular jobs so if we don't have this multi programming what will happen is that job 1.
  • Executing and is using the CPU now until and unless job 1 finishes
  • its execution completely the other jobs cannot use the CPU 
  • Job one was using the CPU and then it has to use some other resources in the course of its execution that said IO devices 
  • Job 1 goes to use the IO devices the CPU is not used and that CPU
  • A very inefficient way.
So in multiprogramming what happens is that let's take the same example again job 1 starts executing and is using the CPU and on the course of its execution.

Job 1 tries to use the i/o devices so when it goes for using the i/o devices or any other resources the CPU is released by job 1 and then that CPU instead of remaining idle it can be used by another job let's say job two.

 Job two can use the CPU until job one finishes his other i/o device operation and once the CPU back so job two will be using the CPU and again if let's say job two ones to go for using some other resources and does not need the CPU at a particular time.

The CPU again instead of remaining idle can be used by job three and so on so in this thing we see that the CPU does not remain idle whenever a particular job does not want to use the CPU can be utilized by another job.

So this is a very efficient system or an efficient way of executing so that is what multiprogramming is mainly about so we see that for the operating system to be efficient it should be capable of this multi programming so we can also relate this multiprogramming with our day-to-day life.

For example:
  • There is a lawyer who has different clients under him now the lawyer is not taking care of only a single client at a particular time.
  • let's say that he is taking care of one client.
  • That client's case is waiting to go on a trial.
  • The lawyer is waiting for his paperwork to be done.
  • He does not simply keep waiting for that single client but at that same time, he can take care of another client that is under him.
  • He is utilizing his time and resources efficiently so that is what we do in multiprogramming we are trying to utilize our CPU efficiently.
A multi-program system provides an environment in which the various system resources like CPU memory and peripheral devices are used effectively but they do not provide for user interaction with the computer system.

So in a multiprogramming system, it makes sure that all our resources are used effectively but they do not provide for user interaction with the computer system.

That brings us to the next topic which is multitasking or time-sharing systems so now let's see what is this time sharing or multitasking system and let us see how it is different from the multi-programming system.

2. Time-Sharing (Multitasking)

So first of all the CPU executes multiple jobs by switching among them now this is almost same like the multiprogramming system this first point it says that the CPU executes multiple jobs we have multiple jobs as we saw above and then instead of executing only a single job at a time.
  • It switches between the jobs and then the switching occurs so frequently that the user can interact with each program while it is running.
  • The switching happens it happens so quickly that the user can interact with the program while it is running so this was something that was not there in the multiprogramming.
So here the user can actually interact with the program even while it is running because the switching between the jobs takes place very fast in this time-sharing system and then this time sharing requires an interactive or hands-on computer system.

Which provides direct communication between the user and the system. This was something that was not there in the multiprogramming system there was the last point that we discussed but in this time-sharing system, there is direct communication between the user and the system and in this time-sharing system as the name suggests a time-shared operating system allows many users to share the computer simultaneously.

So that computer system is shared among many users simultaneously in this time-sharing system so let's see how this works so in order to elaborate this point.

An example:
  • We have a time-shared system over here and there are four users sharing this system users 1 2 3 and 4.
  • They are sharing this time shared system now that in this time-sharing system.
  • The switching between the jobs of the users takes place so quickly that the users.
  • The system they feel that the entire system belongs to just that one person so user 1 heating's 
  • The entire system belongs to me and user 2 3 4.
  • Because of switching between the jobs takes place
  • There is time-sharing or multitasking happening in this system.
Now let's say that using one is using this time-shared system and there is a certain job that he wants to execute. 

The job is being executed by the time shared system and then the execution of the job it takes place in CPU speed and we know that CPU speed is very high so the execution of the job takes place in CPU speed.

That after execution the user has to be shown some output and then the user has to give some input again to the system so after the execution of the job the output is shown to this user 1 and user 1 wants to give some other input to the system.

That means he's interacting with the system now the interaction between the user and the system it takes place in user speed or people speed which means it is taking place in human speed.

We know that CPU speed is so much higher as compared to human speed so when he gives an input to the system he is giving in the normal human speed.

The time gap itself is so big for the system that we have because systems are very fast so while he is giving that input to the system in that time gap the CPU can be used by user 2 for executing the job.

From user 2 so in that way we see that there is a time gap between the user and the system because users are usually slower than the system.

The time gap, the switching of the jobs takes place so quickly and it is so quick and so frequent that the user does not even realize that they are using a time-shared system.

They just feel like the entire system belongs to themselves so in this time shared system it uses CPU scheduling and multiprogramming to provide each user with a small portion of the time shared computer.

A small portion of the time the shared system is provided to each of the users.

But the user thinks that the entire system belongs to him and how this time will be shared among the users that will be decided using CPU scheduling algorithms.

Also read: CPU and controller

Conclusion: comment below your reviews about Operating System Structures Multiprogramming and Multitasking and share this article with your friends. Thanks for visit us. Keep smile be happy.

Post a Comment

0 Comments