in reply to Re: Sharing in fork
in thread Sharing in fork

Thank You Sir for your feedback Right.. I am talking about the latter one. Problem scenario is something like this. A main process will create a queue,initialize head and tail. Now it will fork twice and create two other process. one of them will be responsible for enqueing and other is for dequeing, I had chosen fork to do this, i tried manipulating using reference. So, Sir please suggest a way through which the queue can be shared among both forked process and changes made by one process should be visible by other process. I am stuck at this, I dont want to use thread, for that i need to re-install my perl interpreter,(that i can not do).

Waiting for your reply...

Replies are listed 'Best First'.
Re^3: Sharing in fork
by almut (Canon) on Mar 23, 2010 at 08:55 UTC
    I dont want to use thread, for that i need to re-install my perl interpreter

    Then use forks and forks::shared, which uses sockets for inter-process communication.  Believe it, there is no direct way to share variables between child and parent, because each process has its own address space.

      Yeah...I am also thinking to go with fork.

      Need a clarification from your side..the situation that i described,is it well suitable to go with fork..?

      One more thing that...i tied to install forks.pm from CPAN,but it demands for some additional modules. and fails with saying something "/usr/ucb/cc: language optional software package not installed *** Error code 1 make: Fatal error: Command failed for target `forks.o' "
      I searched on Net and found something that this is problem with my C compiler, then i tried to use it without installataion, by creating some perl file in the same directory( correct me,If i am wrong) but fails to do so.
      so please,give some idea that if there is any way to use forks, without installing them, if installation is the last option then proper way to install it..

      Thanks Sir... I am on my way of getting solution

        "/usr/ucb/cc: language optional software package not installed ..."

        Sun Studio 11 (which provides cc among other things) is available for free (without being a SDN member, and - AFAICT - even without registering, these days) — currently here (613MB).

        This is the previous release, which will likely work just fine for this purpose, though.

        HTH.

        If a module needs a C compiler, it needs a C compiler. Manual installation will not work.

        Ask your system administrator to install the proper language packs and the proper C compiler for your Perl.

    A reply falls below the community's threshold of quality. You may see it by logging in.