Tuesday, November 1, 2011

virtual memory

so What are swapper and overlays in old systems ?

in old days , with the revolution of PCs, we went into multiprogramming mode where programs could be larger than the memory and there can be several such processes executing at a time.
The solutions implemented were swapping and overlays.
in overlays , we keep only the portion of program which are needed at the time of execution. Thus for a compiler we will only have lexer, then parser and then builder ...one by one . This needs a great deal of programming headache as programmers need to decide the overlay structure of their program to make it successful.
swapping is when a process finishes its timeslice, it is moved to secondary storage and bring back when scheduler demands for it again.The process which does this is called as swapper and used to be part of dispatcher(CPU scheduler). These two ways together makes a system as time shared system.

so how does multiprogramming was evolved then ?

well, it seems like there were a number of issues faced by ppl. foremost were fragmentation problem.
since processes used to be of multiple sizes, swapping them creats fragmented array where even though space is available but no process can occupy it. to deal with this situation , they thought to minimize the space required by a process to something which create a minimal fragmentaion. So they implemented Segmentation scheme. here all processes used to have segments for stack, heap, data ....
class segment{
register *logical_code;
register *logical_data;
register * logicalToPhysical(reg *logical){
/**
* if logical address is current Program counter
*/
if(logical == pc){
return (logical + logical_code);
}
return (logical + logical_data);
}
}
but this does not solve the proble at all, just minimizes it to some extent.
so concept of Page evolved. A page is fixed length and further divides the process

No comments:

Post a Comment