tags:

views:

55

answers:

2

Is there any difference between the address space relocation and the relocation task done by the linker??As far as I know ,relocation task done by the linker includes process of connecting the symbolic references to symbolic definitions.And address space relocation is concerned when the executable file is to be brought into the memory and all its address references are resolved with reference to the starting address of the place where it is being placed in the memory,isnt it??And I also want to know who does this address space relocation??

+1  A: 

Yes, you're right. The process loader in the operating system does the load-time relocation. It in fact acts as a run-time linker.

sharptooth
+1  A: 

There is MMU (Memory Manegememt Unit) in procesors. It gives each process/program its own limited memory space. This is the reason that buffer overflow in programs can not do much damage nowdays. This way each program lives in its own memory. OS handle this.

EDIT:

Programs generaly runs from red only locations (ROM/Disk/Flash) and they need stack for temporary values. For instatnce in c/c++ almost evertying but specialy values defined as char/int/long/float and arrays of course go on stack. That mean that linker use and expect only data on stack or in program itself (which is generaly read only)

When program need extra memory in sizes which can not be defined in time of compilation it need heap. Heap is allocated whit malloc or new (c/c++)

But becuase reading from ram is usually faster than from other kind of memory storage divice, OS copy the program from disk on ram and start executing program from there.

ralu
@ralu can u please elaborate the difference between address space relocation and relocation done by the linker.??nyways thanks for ur answer
wantobegeek