Re: create thread from within another?
From: Anno Siegel (anno4000_at_lublin.zrz.tu-berlin.de)
Date: 02/25/05
- Next message: Dimitri Papoutsis: "Re: Annoying Problem with a Basic Perl app and XP Pro"
- Previous message: Anno Siegel: "Re: maximum size of a hash table"
- In reply to: gargoyle: "create thread from within another?"
- Next in thread: gargoyle: "Re: create thread from within another?"
- Reply: gargoyle: "Re: create thread from within another?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 Feb 2005 12:34:36 GMT
gargoyle <gargoyle@no.spam> wrote in comp.lang.perl.misc:
> I'm using ActivePerl 5.8.6.811 and have a question regarding threads.
>
> What are the implications of starting a thread from within another (as
> opposed to starting all threads from the main thread, ie. tid 0)? Will
> any nasty bugs or strange issues come to bite me? In other words, was
> the ithreads model written to handle this sort of behavior?
>
> The reason I'm asking is because I'm trying to find a way to keep memory
> footprint to a minimum, and yet be able to spawn new threads at any
> given time. I figured a "dispatcher" thread could be started as early
> as possible (before most modules are loaded, data structures filled,
> etc.) and then when a new worker thread is needed, main could signal the
> dispatcher (via a queue) and tell it to create a new thread with some
> specific parameters (based on the job that needs to be accomplished at
> that given moment).
What makes you think you can conserve memory that way?
Unlike a child process, a thread handles concurrency in the address
space of one process. It doesn't duplicate everything you have loaded
at the point of dispatch.
Anno
- Next message: Dimitri Papoutsis: "Re: Annoying Problem with a Basic Perl app and XP Pro"
- Previous message: Anno Siegel: "Re: maximum size of a hash table"
- In reply to: gargoyle: "create thread from within another?"
- Next in thread: gargoyle: "Re: create thread from within another?"
- Reply: gargoyle: "Re: create thread from within another?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]