jdeAlloc - Shared memory?

cscdans

Well Known Member
Hello List,
I have a quesion about jdeAlloc, the api-reference says:
jdeAlloc allocates a variable sized block of memory from a memory pool.
Means this, jde uses shared memory for jdeAlloc?
If BSFN are executed on the server, ther is aposibllity they'll run in different JDE_NET processes, so if JDE does not use something like shared memory for jdeAlloc, there is a risk for us to rum some BSFN on the server.
(I know to save the pointer I have to use jdeStoreDataPtr etc.)
If someone knows details or where jdeAlloc is more detailed documentated than in jdeApis, please post some information.

Regards,
Carsten

OW7334 SP20
AIX
WIN2000
Oracle
 
Carsten,

jdeAlloc, if I remember correctly, is but a macro, which resolves to the standard C malloc routine.

You can check AIX xlc documentation on where the memory is coming from, but I'm sure that 1) it's not shared between different OS processes and 2) unlike what's called "Shared Memory" it's not accesible by name and two different BSFN calls made even within the same process will get different chunks of memory.
 
Hello Alexander,
thank you for your answer. Do you kown any jdeFunction making memory availiable though cross BSFN-Calls (except jdeCache)?
Do you know/have experience if jdeCache is secure for that?

Regards,
Carsten
 
Carsten,

I don't think, that jdeCache implementation is using shared memory either (please, correct me if I'm wrong, because this is certainly possible). I would expect it to be simply passing the pointers to memory, which would resolve to the same chunk of memory only if used within the same process (and would probably not be thread-safe by default, again, please correct me if I'm wrong).

"secure" in what sense?

You will really need to explain what you need and what you need it for in more detail.
 
Hello Alexander,
what we are looking for is a funcktion for allocating memory in one BSFN (BSFN 1) and pass the pointer back. A second BSFN should access the allocaded memory from BSFN 1. When a report (and BSFNs) is running locally, it is no problem, but if report is submitted to server, the report is running in a process and the BSFN are running in one (or more) other processes. So a way to program this is to use shared memory
Is there any jdeFunction for that, so that the BSFN can be developed plattform independent?
I know there is possibility to use #ifdef AIX ... but it is not the best way if there is someting existing.

Regards,
Carsten
 
This confirms what I thought: OW does not use shared memory (that is: does not expose any API's, I'm sure there will be some shared memory used inside the Foundation). It's working on the client, because everything runs within the same process.

You will have to program this yourself from scratch, I guess.
 
Hello Alexander,
there seems to be no API, I have searched for and found only typedefs of structures for shared mem. jdeCache seems to use shared menm, so I guess I'll implement my function with jdeCache.
But we'll do some further tests and I'll post our conclusion.
Regards,
Carsten
 
Hello List,
this posting IS FOR FURTHER DISCUSSION. The conlclusions may not be right, they are only suggestions! So your are welcome to post your own tests, experiences and conclusion for further discussion.

We did some tests, to look where (PID) a BSFN is running and how it is queued. Therefore we created a BSFN retung its PID.
Reoprt running on Server: BSFN has same PID as the started runbatch-process.
If a report or apllication is started locally on the same computer a BSFN called on the server seems to get always the same PID during a session as long as they are linke in the same Library/DLL. The BSFN calls on the server are SERIALIZED(!), that means if you start a report/program calling a function in a library, other programs (started from the same computer, linked into the same Library) wait for execution of a server-mapped function (same lib) until the first call has finished. So maping BSFNs to the server may not spped up your Apllication/Report, it may slow it down, if such queuing occurs.

What does it mean for memory-safety?
Reports - Sharing normal allocated memory in ONE report between several functions seems to be safe as long as the functions are linked to the same library and as long sa they are called directly from the report.
Apllication - same as reports.
BSFN - dependent on mapping and library linked to

Conclusion - as I think the only real safe way to share memory between BSFNis to use OS shared memory, NOT jdealloc. So you can use jdeChache for that, because there you can keep OS-independent programming.
But be sure to use the rigth mappings. It will not work if you create a cache by a server-mapped function and the try to access the jdeCahce using a local-mapped function. Always initialize the cache, do not use the cache handle betwenn two functions.

I enjoy every body to post comments an own suggestions,
Regards,
Carsten
 
Latest addition:
The jdeCahce only works for BSFNs executed in the same process. So passing of chache bewenn APP/APP APP/UBE UBE/UBE is only possible locally (Report interconnects MUST NOT be asynchron). If the BSFN is server-mapped it is only possible, if both applications use the same JDE_NET process. If a Report is executed on the server it will not work. So be careful sharing Caches between two applications and/or UBEs.
Regards,
Carsten
 
Hi,

Have you ever found a way to share cache in the server?

Thanks in advance?
 
Back
Top