I have a script which runs several programs depending upon the contents of  a
state table ( implemented as a hash).

The main script and the spawned processes write into the state table and also
read from it before they perform something.

Is it necessary to implement the state table as a Shared Memory and use locking
of the shared memory to avoid simultaneous access by two competing processes ?

I think that Shared memory is not really required as the main script and the
processes it creates run in the same thread and so look at the same state table
which is not possible if using fork on UNIX. On UNIX the forked child gets a
copy of the variables from the parent and if both need to look at something in
common ( as the state table mentioned above), the common variable needs to be
implemented as shared memory.

The only problem I can think of on NT is, if the processes try to access the
state table simultaneously and there is a deadlock.

I have tried to use Amine's MemMap module and used it's shared memory
implementation on NT. It works fine and I can use the lock and unlock methods of
the module to prevent simultaneous access of the shared region by two or more
processes. But I need some opinion on whether such usage is an overkill, or
there is another elegant way to implement it.

Any views or advise is appreciated.

Thanks

Ashish Tiwari
Integrated Decisions and Systems.
[EMAIL PROTECTED]

--------
"The views expressed here are mine and do not reflect the official
position of my employer or the organization through which the Internet
was accessed".
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to