Multithreaded program in C: calculating thread stack space

Posted by SlappyTheFish on Stack Overflow See other posts from Stack Overflow or by SlappyTheFish
Published on 2010-04-23T12:11:43Z Indexed on 2010/04/23 12:13 UTC
Read the original article Hit count: 375

Filed under:
|
|
|

Situation:

I am writing a program in C that maintains a number of threads. Once a thread ends, a new one is created.

Each thread forks - the child runs a PHP process via exec() and the parent waits for it to finish.

Each PHP process takes the next item from a queue, processes it and exits.

Basic code: http://www.4pmp.com/2010/03/multitasking-php-in-parallel/

Problem:

The PHP processes are Symfony tasks and Symfony requires a fairly huge amount of memory. How can I safely calculate the required stack space for each thread so that PHP processes will have enough memory?

The memory limit set in php.ini is 128Mb so should I allocate this much space in the stack?

© Stack Overflow or respective owner

Related posts about c

    Related posts about multithreading