I'm reading about memory management from a book called Operating Systems. I've studied about this subject before and it was all clear because there were only two types of addresses introduced: Physical & Logical (Physical & Virtual). However, this book seems to introduce three types where it sometimes views two of them as the same, and sometimes as different.
Here's a quote (translated myself, so might not be the best):
At the time of writing a program it is not know at which point in the memory the program will be, which is why symbolic addresses are used (variable names). The process of translating symbolic addresses into physical addresses is called address binding and it can be done at different points in time. If, during the compilation, it is known in which part of the memory the program will be then address binding can be done at that point. Otherwise (the most common case) the compiler generates relative addresses (relative to the start of the part of the memory that the process gets). When executing a program the loader maps relative addresses into physical addresses.
This all seems to be pretty clear. Relative maps to the physical. Here's what comes after:
During process execution, the interaction with memory is done through sequences of reading and writing into memory locations. The CPU either reads instructions or data from the memory or writes data into the memory. Within both of these tasks, the CPU does not use physical addresses but rather logical ones which the CPU generates itself. The set of all logical addresses is called the Virtual Address Space.
This is already confusing as it is. What's the difference between a logical and a relative address? Wherever else I look this up they're never separated. Here comes an even more confusing sentence:
In case the address binding is done at the time of compilation and loading then the virtual address space matches the physical address space.
Earlier on it is stated that address binding is the process of converting symbolic addresses into physical addresses. But then only later on is the concept of relative addresses introduced. And loading is said to be the process of converting relative into physical. So now I'm completely lost here.
Assuming that we have no knowledge of which part of the memory the process is going to take: how does the timeline go? The program is compiled, the variable names (symbolic addresses) are translated into ... relative ones I guess? Then the CPU needs to do some read/write and it uses ... logical ones?
And furthermore, the terms relative and logical seem to be used randomly in the following sections of the book. As if they're the same, but still defined as different.
Could anyone clarify this for me? The perfect answer would be maybe an artificial example of a program timeline. At which point is which address introduced, what is the difference between a logical and a relative address?
Thanks in advance.