S
Shuaib
I wonder if anybody could shed some light on a problem I am
encountering.
I have written a program in C that runs on Solaris 2.8. At busy times
of the day there may be multiple instances of it running (5-10), each
process taking approx. 3 seconds to complete.
Each instance of the program basically fetches data from a Oracle
database (using Remedy ARS API routines) and stores it in a user
defined structure that I have defined as a global variable. The
problem I encounter is when multiple instances of the program are
running. Often I find that the data in memory being held in one
process is mixed up with the data in memory of another.
A simplified example could be:
process instance 1 fetches data from record NA1234 and stores record
id in a string variable str1:
process instance 2 fetches data from another record NA9999 and stores
record
id also in a string variable str1:
However when I check the value of var1 in process instance 2, it
sometimes may say NA9999 (which would be correct) but other times it
may say NA1234 (ie. it is sharing the memory space of process 1),
especially when the processes are running in parallel.
Can this phenomena be attributed to global variables - if so changing
to a local instance would relieve this?
Any assistance greatly appreciated.
-- Shuaib
encountering.
I have written a program in C that runs on Solaris 2.8. At busy times
of the day there may be multiple instances of it running (5-10), each
process taking approx. 3 seconds to complete.
Each instance of the program basically fetches data from a Oracle
database (using Remedy ARS API routines) and stores it in a user
defined structure that I have defined as a global variable. The
problem I encounter is when multiple instances of the program are
running. Often I find that the data in memory being held in one
process is mixed up with the data in memory of another.
A simplified example could be:
process instance 1 fetches data from record NA1234 and stores record
id in a string variable str1:
process instance 2 fetches data from another record NA9999 and stores
record
id also in a string variable str1:
However when I check the value of var1 in process instance 2, it
sometimes may say NA9999 (which would be correct) but other times it
may say NA1234 (ie. it is sharing the memory space of process 1),
especially when the processes are running in parallel.
Can this phenomena be attributed to global variables - if so changing
to a local instance would relieve this?
Any assistance greatly appreciated.
-- Shuaib