One part of main memory is to hold the instructions for the operating system and the other part is the program currently being executed. For multiprogramming systems, the user part is separated again in order to accommodate for multiple processes. The operating system handles the task of dividing up the work and managing the memory.
When dealing with multiprogramming systems, any available main memory is shared among other processes. It is very rare for a programmer to know in advance which program will be in main memory when their program executes. Another reason for relocation makes it possible to swap out active processes and help free up memory for processes that are becoming ready. Programs need to be allowed the freedom to be moved around in the main memory because of being swapped out to disk then back. It would be far too taxing to say a program must go back to the same place in main memory as before.
All processes have to be protected from unauthorized and unwanted interference from other processes. Programs in other processes shouldn’t be able to access memory locations in a process without the proper permissions. Usually, the protection requirement is made more difficult when the relocation requirements are satisfied. Since we are unable to