yes, this is called shared text, and has been a feature in UNIX since
very ancient times, early '80s in BSD.
happy hacking,
Isildur
On Thu, 26 Sep 2002, Matthew Mondor wrote:
> Hi,
>
> Would anyone know if someone already implemented kernel-residentiable
> executables on unix, which may share the same text area in physical memory
> when many copies are being started?
>
> I know that there are COW pages, which permit to produce similar results
> when a process forks multiple times, and shared libraries which allow alot
> of code to be shared among processes using it;
>
> This however probably would look more in the form of a virtual fs
> or the like, where all executables started via execve(2) would actually
> share the same pages, it could also be static executables... basically it
> would be similar to if the process had already been launched once, but was
> sleeping in an invisible state, and a fork(2)-like operation would be
> performed on it when it then gets invoked...
>
> I mostly wonder if this already exists, or if some work was in progress
> to allow such a feature, which would probably be quite useful for some
> configurations, an example which comes to mind are external CGIs which an
> HTTP server would start many copies at once for instance. Although this
> last problem has various solutions in the web server area, this would
> consists of a generic solution for other similar issues, /bin/sh itself
> often has so many instances running is another example. The requirements
> of vm space would be reduced, while new process setup could also be
> faster.
>
> An operating system using a similar approach was AmigaOS 2.04+, although
> it required executables to be "pure", reentrant that is, and the rest
> seemed to be handled with special shell support. Of course the design
> was fairly different than what would have to be done on BSD
>
> Thanks,
> Matt
>