If one program, for example grep
, is curretly running, and a user executes another instance, do the two instances share the read-only .text
sections between them to save memory? Would the sharing of the main executable text sharing be done similarly to shared libraries?
Is this behavior exhibited in Linux? If so, do other Unices do so as well?
If this is not done in Linux, would any benefit come from implementing executables that often run multiple instances in parallel as shared libraries, with the invoked executable simply calling a main function in the library?