If the program is your own program running a few times in the day it makes no difference. If your program is called by other programs your program does not know if the caller is rentrant or not. It will usually need storage for variables. With C you have the stack. Other programs use STORAGE requests. This is an important difference.
In the comment "code is code" what you say is true. But if you have 10,000 copies of the non reentrant program, there will be management costs with managing all of these copies, eg allocating/freeing a page to put the program in moving the data to the page etc. Once the code is being executed there may be a small difference in costs, (down at the hardware cache level) but that should be small. If you are a student you can decide to use reentrant or not. If you are writing software for banks, commerce, industry etc you should be using reentrant code. Colin On Sat, 24 Aug 2024 at 11:42, Lennie Bradshaw <[email protected]> wrote: > Brian, > I disagree with regards to the execution speed issue. Use of reentrant > coding techniques require all instances executing the code to use their own > work areas. This means that memory management macros (GETMAIN, FREEMAIN, > STORAGE etc.) must be used. > > In contrast a non-reentrant program can use a storage area assigned within > the program code, thus dispensing with the overhead of using those system > services. > > Lennie > > -----Original Message----- > From: IBM Mainframe Discussion List <[email protected]> On Behalf > Of Brian Westerman > Sent: 24 August 2024 07:53 > To: [email protected] > Subject: Re: Non-reentrant program not allowed (where?); Advantages of > reentrant programs? > > Regardless of what anyone may have told you, a re-entrant program does NOT > have to reside in LPA, it can reside in any load library you want. > > There is nothing inherently faster about the code that executes with being > re-entrant for a general program. It does force you to use better coding > techniques, and also it does allow you to put it in LPA (someday) if you > decide to do so, but that would depend more on how often it will be used > (cut down on the loads), rather than anything else. > > If you write a program that gets loaded 300,000 times a day, then it > should be in linklist or LPAlib anyway if you can, to cut down on the > overhead of loading the program into storage. > > If you are going to write complex programs, (main module with > multiple|many sub-modules), then re-entrant is a good idea as well. > > As for execution speed, there is no real difference, once the program > starts, code is code. > > Personally I try to always write re-entrant code, but that's probably > because I write a lot of exits, and it's a requirement for (most of) them > to be re-entrant. > > Brian > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, send email > to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
