Re: Compiling C read only code from 4GL
Posted in 1999
Topics: Stored Procedures & SPL, Connectivity: ESQL/C, 4GL & Embedded SQL, Triggers, Constraints & Referential Integrity, Platform-Specific Issues, Jobs, Consulting & Announcements
>>> <munsoor.negyal@datelgroup.com> 08/31/99 02:56PM >>> >I am writine a 4GL "control" program that will be executing (via the >RUN command) other 4ge's. Often these 4ge's will be the same program, >but not always. > >However, the logic will ALWAYS be :- > >WHILE NOT FINISHED > RUN Program1.4ge > Wait for program to finish >END WHILE > > >A this "Control" Program will be potentially loading thousand's of >these 4ge's, I need to ensure it does so in the fastest possible way. >Am I right in assuming the following :- If you want this as fast as possible then you might want to do all this is in C >When you compile and link a 4GL program (NOT using shared libaries) >that the 'C' compiler automatically (ie, not passing any extra flags >to it via the 4GL screen front end) builds the executable code so that >is split into read only code segment and data segment. When the >"control" program RUNS a 4ge for the first time, both the read only code >and then the datasegment are loaded into memory. When the "control" >program loads subsequent versions of the same 4ge, only the data >segment is loaded, thus speeding up program loading. This will depend on the flavour of Unix but ... Both the vnode pages (read-only code) and anonymous pages (data pages) will be page faulted in when the program starts. Subsequent runs of the code should not page in the vnode pages but use the existing ones. The anonymous pages by default will be re-used which means the two programs will try and alter the same areas. This won't happen because the action will trigger a copy-on-write and a new data page will be generated. If the some of the pages are paged out due to a short-term memory shortage then the vnode pages will just be used and when they are needed again they will be read from disk and not paging space. The anonymous pages will be paged out to disk and depending on the OS are able to be paged back in from paging space. Most Unix's these days use a NRU mechanism for paging so as long as your app's anon pages are active it will be unlikely to loose it's pages from real memory. >I presume, if the above is the case, these read only code processes >will only be terminated when the "control" program finishes, as it is >the parent and they are its children. The pages will be left on the free-list, pages are not explicitly cleared, and depending on the version of Unix might be reclaimed when the program next starts - AIX (4.1+) does not reclaim pages, it always goes back to disk. Bascially you have very little control over how Unix handles this, just make sure that your app is as fast as possible and let the OS do the rest. This is were, IMHO, the OEM compilers come into their own. Paul Watson WF Software Ltd Tel: +44 1436 674729 Fax: +44 1436 678729 www.wfsoftware.com/informix # If you broke it, hide the evidence ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************