Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site mordor.UUCP Path: utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!amdcad!lll-crg!mordor!ehj From: ehj@mordor.UUCP (Eric H Jensen) Newsgroups: net.arch Subject: Re: Addressing modes (conditional branches) Message-ID: <5705@mordor.UUCP> Date: Fri, 28-Feb-86 21:39:20 EST Article-I.D.: mordor.5705 Posted: Fri Feb 28 21:39:20 1986 Date-Received: Sun, 2-Mar-86 00:11:51 EST References: <546@tekcrl.UUCP> <426@utastro.UUCP> <5681@mordor.UUCP> <1106@mit-eddie.UUCP> Reply-To: ehj@mordor.UUCP (Eric H Jensen) Distribution: net Organization: S-1 Project, LLNL Lines: 38 In article <1106@mit-eddie.UUCP> jbs@eddie.UUCP (Jeff Siegal) writes: >In article <5681@mordor.UUCP> ehj@mordor.UUCP (Eric H Jensen) writes: >>I can't see how you could effectively manage a POLICY of >>"self-modifying code is okay" in a statically linked environment. >>Every sub-system that linked in a routine that modified its own code >>would inherit the 'impure' curse. Perhaps this would not be such >>a problem in a dynamically linked environment. > >I'm not sure I understand what you are saying. Under Unix, at least, >sub-systems are not shared. Please explain. Lets say csh uses a library routine FOOBAR which modifies its code (assuming this is allowed). Now consider that csh forks another csh (called csh<2>). csh<2> does not get the state of the csh executable on the disk, it gets the state of its parent executable. Furthermore assume that the parent does not wait for it's child to exit but keeps on running. If csh and csh<2> share the executable and they both make use of FOOBAR - good luck trying to find out what went wrong when your system pukes. So to rectify the situation when you fork, you bring in a clean copy of the executable. You mentioned a copy on write scheme. Maybe on a machine that allows a physical page to be mapped to more than one virtual page this could be done right, but on a machine like the latest IBM risc a physical page can only be mapped to one virtual page (this saves a (pipeline stage) or (gobs of hardware) for determining if you hit or not) you are forced to copy the executable into a new segment. But the above really doesn't get at the issue. If performance is a goal, the hardware is going to be slower (or more expensive) if it has to deal with self-modifying code even if the software can handle it. -- eric h. jensen (S1 Project @ Lawrence Livermore National Laboratory) Phone: (415) 423-0229 USMail: LLNL, P.O. Box 5503, L-276, Livermore, Ca., 94550 ARPA: ehj@angband UUCP: ...!decvax!decwrl!mordor!angband!ehj