Why is the exe file always loaded at the same address space? What happens when another file want to load at the same address. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why is the exe file always loaded at the same address space? What happens when another file want to load at the same address.

reverse engineering,operating system,linker

17th Jan 2019, 8:13 AM
sss
sss - avatar
2 Answers
+ 2
It isn't. You are probably looking at addresses relative to the memory allocated to the program. And even using that frame of reference, the OS may implement ASLR and not load resources at exactly the same place. https://en.wikipedia.org/wiki/Address_space_layout_randomization
17th Jan 2019, 9:42 AM
Zen
Zen - avatar
+ 1
When an exe file executes it is the beginning of a process on the cpu , it can have 5 states ( Start,Ready,Running,Wait, Exit) this process can also use fork () for example to make a child process of itself (share all resources) and then the parent must WAIT while the child uses the resources. you also need to understand context switching, this is how the CPU initiates the different states of the process. An Process Control Block (PCB) This holds alot of information about the process and is pushed and retrieved from the stack as required by the CPU. An OS uses threads (lighter than processes) to share access to memory spaces and resources. These threads can be controlled with mutexes and semaphores to ensure access is granted to CRITICAL points on a program in a controlled manner. inter process communication can also occur with the use of shared memory spaces or message passing (retrieved from a queue) There is a lot going on to insure memory is allocated accordingly
24th Jan 2019, 1:40 PM
Ed Hanlon
Ed Hanlon - avatar