ohrnb@edstip.EDS.COM (Erik Ohrnberger) (02/28/91)
This may seem like a really ignorant question, but I have thought about it, talked to a few people about (they weren't sure), so I thought that I'd post it to the net and see what happens. Is creating sharable executables really that difficult? I mean that most operating systems seem to get very upset when you try to change some of the bytes in the executable code while the program is running. So the executable memory area is kept seperate from the manipulatable data area. The context of a process is determined by its instruction address, the state of its registers, and the state of its data area. If each process that is executing a shared executable (read only), maintaining its own private data area and register context there would seem to be reason that the processes couldn't share the same executable area. The operating system could map the virtual memory area that the executable is in into each of the processes address space, and the processes would think that they have their own copy, but they don't. When a process context switch is forced, the OS saves the process's IP & registers and stack & etc., and restores the IP & registers & etc. of the next process, which would then continue running. If a page of the executable is swapped out, it would be marked as such in the virtual memory manager. Either process that is sharing this executable could force a page fault and get the required page back in. The OS would have to keep track of all the executables that are in memory, and be able to quickly determine if the executable that a process is asking for is already in memory. The OS already has a list of currently running processes and their contexts and the executable file that is loaded (try deleting a executable file that you are running, it will error with a file busy). What if that list also stored the disk address of the executable that the proces is executing. A quick run through this list would be able to identify if the executable is already in memory. If it is, the OS would map the current memory copy into the requesting process' address space and start executing the program. Granted that this is a rather simplistic example, but I would like to know if there are any other specific problems that exist that make shared executables more difficult than I think they are. -- Erik Ohrnberger, EDS ...!uunet!edsews!edstip!ohrnb 800 Tower Dr. P.O. Box 7019 or ohrnb@edstip.EDS.COM Troy, MI 48007-7019 Voice:(313)265-9117 Fax:265-9241 -- Erik Ohrnberger, EDS ...!uunet!edsews!edstip!ohrnb 800 Tower Dr. P.O. Box 7019 or ohrnb@edstip.EDS.COM Troy, MI 48007-7019 Voice:(313)265-9117 Fax:265-9241