From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96075317506515.tru64-unix-managers.marc@archive.invalid> From: matap () LURE ! LATROBE ! EDU ! AU (Andrej Panjkov) Date: Tue, 14 Feb 1995 03:47:52 +0000 To: tru64-unix-managers Subject: SUMMARY: compiling a file crashes its running executable X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96075317506515 THANKS! Thanks to all who replied! I'm very impressed with the generosity, expertise and quality of responses from all who replied! I had a small problem: recompiling a program while an earlier version is running crashes the running process. This is a bother to me because I test enhancements to my programs while a production version is running. The general consensus was that OSF/1, like many other UNIX OSs, performs paging on demand--code is read in from a.out only when needed. It's not clear to me that this is true of every UNIX, as claimed by some writers. I didn't get this on AIX, for example. Two writers pointed out that other UNIXes, including ULTRIX, had something called ETXTBSY. A signal meaning "executable text is busy--come back later." It was suggested that this wasn't included in OSF/1 out of deference to the recent UNIX standard. A few respondents thought that a UNIX with demand paging should normally protect the running process by locking the disk file, or keeping its pages in the file system. As one writer pointed out though, things like fork() might get weird... Another point made by some respondents is that demand paging can cause extra trouble under NFS. If the filed a.out changes while a remote machine executes the older a.out, the process doesn't crash. Instead, the network can get flooded with requests when the client demands more a.out code from the server. One thing still bothers me. Sometimes my running version kept on running after I compiled. Perhaps all of the code text had been loaded into memory by then... Here are fixes/workarounds: * Wait till the executing process finishes before recompiling! * Rename the old executable. (If this works though, it suggests that the OS is smart enough to keep track of the file with the old executable--perhaps by keeping a link to the old file. Why shouldn't it be smart enough to protect the file , or its links, or move it by itself? Because cc/ld reuses existing links. * Delete the old executable. This is similar to the last point. * Put a call to plock(2) in the code to prevent it being paged while compiling, then more code to rexec the processif it gets SIGHUP. Whew! * Compile with -N: makes a.out neither sharable nor pageable. All up, I think I'll just give stable running versions a new name, like cprog.running and compile test versions to plain cprog. CREDITS: Ireland: Fergal McCarthy England: Kevin J Walters, Dave Newbold UK: Andrew Gabriel USA: Clyde Hoover, Jon Howell, David Warren, Drew Kramer, Tom Blinn USA (?): Tr Nguyen, Drew Gallatin, Mike Iglesias, Alan Rollow, Steve Gibbons Germany: Rob Hooft Austria: Peter Lanstoeger Switzerland: Stefan Monnier ---------- Andrej Panjkov, | email: matap@lure.latrobe.edu.au School of Mathematics, | ph: 61 +3 479 2595 La Trobe University, | fax: 61 +3 478 7621 Bundoora, Vic, 3083 | Australia. | Aphorism/Film quote/Freudian Slip goes here.