Hi Folks,
Currently I am studying memory management scheme in the operating system. First we studied relative address that during the load time the loader basically put the relative addressing in the program then at the run time or the execution time it is the job of the linker to link that
physical address by adding the base register but this is the case of contigious memory location. Now lets come to the concept of paging. Lets suppose the paging is involved. The loader again loads the program in the memory but this time each bytes are loaded they are recorded
in the page table with the page number with the respect to limit such as the page size is 4KB so first 4 KB in page 1 next 4 KB in page 2. Address now calculated is corresponding to the page number and offset however the address present in the instruction was the relative
address. Now here I am confused, How that linear address or relative address is changed into the page format address (Page Index + displacement). Whose job is to make that happened. I have made an equation by my own but I am not satisfied. The equation is as given below
v (p,d) where p is the page index and the d is the displacement. Now if the relative address is lets suppose 751th byte to jump on then the page index would be p = x1/y1 where x1 is the 751 and y1 would be the page size lets say 4 and it would give the page index number. Now if we
want to calculate the displacement it would be d = ((p -1) x y) - x1. So the final address would be 188th page and d would be 3. I know this sounds crazy, But please shed some light on it
Linear/Relative Address and Paging Address mapping
Re: Linear/Relative Address and Paging Address mapping
Let the CPU do itgreen1 wrote: Now here I am confused, How that linear address or relative address is changed into the page format address (Page Index + displacement). Whose job is to make that happened. I have made an equation by my own but I am not satisfied. The equation is as given below
First figure out how many pages you need; for example, if you're loading 40KB, you need 10 pages. Set up the page tables so that you have 10 contiguous pages in virtual space, then just load your file; you don't need to worry about what byte is falling on what page.green1 wrote: Lets suppose the paging is involved. The loader again loads the program in the memory but this time each bytes are loaded they are recorded
in the page table with the page number with the respect to limit such as the page size is 4KB so first 4 KB in page 1 next 4 KB in page 2.
Re: Linear/Relative Address and Paging Address mapping
Dear,
Thanks for your reply. But I am not doing any practical example. All I am studying the theoretical work. Therefore I need an understanding for that. It would be very nice, if you can guide me in this way. Thanks
BR
Thanks for your reply. But I am not doing any practical example. All I am studying the theoretical work. Therefore I need an understanding for that. It would be very nice, if you can guide me in this way. Thanks
BR