cctr120@canterbury.ac.nz (Brendon Wyber, C.S.C.) (11/22/90)
Hi, What exactly is the pure bit for. Many PD programs say that they have their pure bit set and can be made resident, but what does that means since you can set the pure bit on any file? If I was writing a program, what would I have to do so that I can say that it is `legally' pure? Be seeing you, Brendon Wyber Computer Services Centre, b.wyber@canterbury.ac.nz University of Canterbury, New Zealand. "Ph-nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn."
peter@dbaccess.com (Peter A. Castro) (11/27/90)
in article <1990Nov22.142858.9900@canterbury.ac.nz>, cctr120@canterbury.ac.nz (Brendon Wyber, C.S.C.) says: > > Hi, > > What exactly is the pure bit for. Many PD programs say that they have their > pure bit set and can be made resident, but what does that means since you can > set the pure bit on any file? Yes, you can set the Pure bit, but you shouldn't. There is a real reason for this bit. The resident command loads a Pure program into memory and keeps it for reuse. Thus, a Pure program must be re-entrant. I'll give you an example of what can happen if a program that is not Pure has it's Pure bit turned on and loaded with resident: The Manx environment comes with a program called 'ls'. This is not a Pure program. I turned on the Pure bit, loaded it with resident. Now for the fun. Open two windows. Type 'ls' in both without hitting return. Now, hit return in one window and quickly click on the other one and hit return. The programs start to take a directory, but somethings wrong... I get filenames from one directory in the other window, and visa-versa. and for some reason one 'ls' program is looping, and looping on the same name. If I let them go, I eventually get a Guru. (Kids, don't try this at home ;-) > > If I was writing a program, what would I have to do so that I can say that it > is `legally' pure? It must be "re-entrant" code, with no static data. > > Be seeing you, You are Number 6 ? > > Brendon Wyber Computer Services Centre, > b.wyber@canterbury.ac.nz University of Canterbury, New Zealand. > > "Ph-nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn." -- Peter A. Castro INTERNET: peter@dbaccess.com // //| c/o DB Access Inc. UUCP: {uunet,mips}!troi!peter // //|| 2900 Gordon Avenue, Suite 101 FAX: (408) 735-0328 \\ // //-||- Santa Clara, CA 95051-0718 TEL: (408) 735-7545 \// // ||
mclaren (Gavin McLaren) (11/27/90)
In article <1043@troi.dbaccess.com> peter@dbaccess.com (Peter A. Castro) writes: >in article <1990Nov22.142858.9900@canterbury.ac.nz>, cctr120@canterbury.ac.nz (Brendon Wyber, C.S.C.) says: >> If I was writing a program, what would I have to do so that I can say that it >> is `legally' pure? > It must be "re-entrant" code, with no static data. The manual says it must be reexecutable an reentrant. I concede, however, that reexecutable implies rentrant. Some programs cannot run twice in a row without reloading, because they contain initialized data that does not get reloaded. The uninitialized data can be allocated to each copy of the program, but they share the initialized stuff... Thus I think the requirement is a little less restrictive than no static variables. After all, all globals are allocated statically. However, there are no initialized static variables allowed.
dillon@overload.Berkeley.CA.US (Matthew Dillon) (11/27/90)
In article <1990Nov22.142858.9900@canterbury.ac.nz> cctr120@canterbury.ac.nz (Brendon Wyber, C.S.C.) writes: >Hi, > > What exactly is the pure bit for. Many PD programs say that they have their >pure bit set and can be made resident, but what does that means since you can >set the pure bit on any file? > > If I was writing a program, what would I have to do so that I can say that it >is `legally' pure? > >Be seeing you, > >Brendon Wyber Computer Services Centre, >b.wyber@canterbury.ac.nz University of Canterbury, New Zealand. > >"Ph-nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn." The pure bit tells AmigaDOS that the executable is 'residentable' .. multiple instances can be run using the same code image (i.e. shared code). The pure bit is set by the linker (specific example: Lattice's BLink and DICE's DLink) only when the executable is reentrant in this fashion. The pure bit should never be set manually, programs that are not residentable (pure bit not set) but forced resident are unreliable, even if only one instance of the program is run at a time. If you are talking about hunks, generally any program that contains a BSS or DATA hunk is *NOT* residentable and thus not usually pure. Residentable programs generally allocate their data/bss at run-time. -Matt -- Matthew Dillon dillon@Overload.Berkeley.CA.US 891 Regal Rd. uunet.uu.net!overload!dillon Berkeley, Ca. 94708 USA
jesup@cbmvax.commodore.com (Randell Jesup) (12/19/90)
In article <dillon.7348@overload.Berkeley.CA.US> dillon@overload.Berkeley.CA.US (Matthew Dillon) writes: > If you are talking about hunks, generally any program that contains a > BSS or DATA hunk is *NOT* residentable and thus not usually pure. > Residentable programs generally allocate their data/bss at run-time. One (unlikely) exception is a program that has Data segments, but never modifies the globals (i.e. const data only). Another would be one that makes new copies of the data segment(s) for each invocation in the startup, and then all global refs are done via a register or some other dynamic means. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)