SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,178
    Mentioned
    63 Post(s)
    Tagged
    2 Thread(s)

    Pcntl_fork() fun-ness

    Alright, so this ones for my peeps who have experience forking new processes.

    I have yet to write a script that does it, but I do get the general idea behind it, how it copies its self etc. My obstacle is that I need a way to either pass a variable or alter something so that I can make each process run something different.

    Lets assume I want to create 10 children to run an operation on table. I would like each process to run its operation base don the last digit in the id ( 0-10, 10 processes ). How might one achieve some sort of incrementation to pass to the children so that they are not running on the same term digit, short of using a db table to store and check for who's working on what.

  2. #2
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,178
    Mentioned
    63 Post(s)
    Tagged
    2 Thread(s)
    Just found this guy: http://www.php.net/manual/en/shmop.examples-basic.php

    I'll be sure to let everyone know how it goes and share some sample classes

  3. #3
    SitePoint Evangelist
    Join Date
    May 2006
    Location
    Austin
    Posts
    401
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do you need to know the state or result of the child processes? If not, a blind exec might be a cleaner way to do it and you don't need to wait for the child to finish execution.
    Merchant Equipment Store - Merchant Services, POS, Equipment, and supplies.
    Merchant Account Blog | Ecommerce Blog

  4. #4
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,178
    Mentioned
    63 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by jestep View Post
    Do you need to know the state or result of the child processes? If not, a blind exec might be a cleaner way to do it and you don't need to wait for the child to finish execution.
    Absolutely I need to know the state of the child process. That wouldn't be cleaner, it would just be less code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •