so far we have seen that the size of the hard disk will be much bigger than the
size of the RAM okay ...now let us assume that just for an assumption our hard
disk can hold 500 programs okay... similarly let's assume that our RAM can
hold 50 programs why because size of a RAM will generally be lesser than
that of the size of the hard disk fine... now out of these 500 programs which
which are present inside the hard disk 50 programs should be copied from the
hard disk and then moved into the RAM okay... it is copy it like this just like
copy paste okay it is not like cut paste which we do in computer ok ...this 50
programs which I am moving into the RAM should also be present inside the hard
disk okay... such a way I copy the 50 programs and place it in the RAM... now my
question is ...out of this 500 programs which 50 programs should be copied from
the hard disk into the RAM that is the question okay... see for that what we can
do is the best idea is we can move the 50 programs which the CPU is most likely
to request next ...right..? why ..? because if the CPU is requesting for a program which is
present inside the RAM it takes very less time for the CPU to access it whereas
in case if the program with CPU is trying to access in the RAM is not present when
in case the CPU is trying to access a program which is not present in the RAM
it is going to take lot of time because we need to copy from the hard disk and
then place it in the RAM and then we might have to take it from there RAM it
is going to take lot of time so we should try to move the 50 programs
which the CPU can request next from hard disk to memory ok ...but the problem here
is...we will never be able to say which program will the CPU be requesting next
okay ... why ? because whatever CPU can request is
highly variable we cannot really predict for example as a user I can actually ...
I can actually open any software as I like
right ...nobody can say is that I will open a software only this because it is
a future... similarly our CPU cannot predict our CPU can actually request for CPU can
actually request for any program ok... there is no nothing like our CPU should request
this program so this is a future and it is not possible for anyone to
actually derive it exactly so one thing we can do is we can do prediction or we
can go for a guess ok we can simply say that we can simply put some program from
hard disk to memory some 50 programs based on some algorithm or some idea ok
see why do we need an algorithm for this see what I can do for example there are
two teams which are playing a match ok TEAM A and TEAM B now they are going to play
the match tomorrow and you want to predict the winner ok now you can
predict the winner based on various algorithms for example you can take the
past history and see which team has won the most number of matches and say that
he will be the winner tomorrow ok your guess might be correct or might not be
correct one you will know it only tomorrow similarly we can go with
another team which has lost most number of times but still you can say that that
team is playing in a ground which it has won all the matches so far so you can
say that the TEAM B can win the match ok so there are various kind of
algorithms so you can come up with you can come up with lot of algorithms
saying that this can be have this can happen or that can happen ok so this is
just a guess so .... similarly here also we can
move any 50 programs from hard disk to memory
based on various ideas saying that the program which is smallest in size may be
referred by the cpu in the future it is just an idea ok need not be correct
similarly the 50 programs which are the biggest in size can be referred by the
CPU next and so I need to move the 50 programs which are which is the biggest
in size from hard disk to memory so we can go for various kinds of guesses so
this guessing is done by something called as operating systems
okay our operating systems is a program it is a huge or a big program it will
have lot of functions inside it okay now one of the functions inside the
operating systems will hold the logic or algorithm which will say that which in
case if we come across a situation such that more than one program is trying to
access the capture the RAM here more than one program wants RAM right ..? but we
can move only a few programd into the RAM now which few programs we should move
from hard disk to RAM... that decision is being done being taken care by one of
the functions of operating systems similarly that might arise a situation
where let us assume there are more than one program in the RAM
let us assume there are two programs in the RAM which are trying to access the
CPU at the same time it is still definitely possible
why because I might actually open more than one program in my computer in that
case what will happen both the programs has to be has to be
executed by the CPU now it's up to the CPU to decide which program should it
execute next actually CPU will not decide CPU doesn't know anything other
than executing the program now it's up to us to decide which program should the
CPU executes next right among the two programs which are trying to access the
CPU now again for that we write another function inside our operating system
which will decide which among these two processes should capture the CPU okay so
what is actually happening here is it is nothing but resource allocation see what
is meant by resource anything which is present inside our computer is nothing
but a resource for example CPU is a resource Ram is a resource hard disk is
a resource mouse keyboard anything printer any device you can take in our
computer we can say that as the resource okay now in now what's happening here is
more than one program is trying to access the CPU and it's up to or
operating in and its operating system is deciding which among these two programs
should access the CPU using its program see operating systems
is a program now among this there are various functions and each function is
having a logic this function is having a logic saying that which among this two
programs should access the CPU similarly even here we are we have already seen
that whenever two programs are trying to access the RAM the operating system is
deciding which program should we should can get hold of the RAM which means
which program should be moved from hard disk to memory again this is being
decided by our operating systems so what operating systems is generally doing is
it is taking care of something called as resource allocation which means if more
than one program is trying to access a resource now operating system might have
to decide which one should get hold of the resource first see offcourse every
program will every program will definitely get hold of the resource at
some point in time that's for sure now among them which one should capture the
resource first that is our question and that is being answered by our operating
systems okay fine so the the important point which you
might have to note here is operating system is nothing but a program which
acts as a resource allocator or a resource manager okay that is the only
point which for this that is what I wanted to explain so I went for lot of
explanations just to give a rough idea of what is happening with the computer
so in case if you are not able to understand these points it is still fine
try to get a rough idea about it because we are going to see all these concepts
in a much more detailed way okay this is just a rough idea okay nothing nothing
that you should be able to understand it exactly
so try to get a rough idea about these points we are going to see all these
points in a very detailed way with lot of problem solving a lot of problems ok
you will get it very clearly so fine
Không có nhận xét nào:
Đăng nhận xét