Forking is, at its heart, a Unix term. It has to do with multi-processing, not multi-threading.
A quick primer. Processes are how the OS (be it Unix, Win32, or whatever) keeps track of the things that are using its CPU, RAM, etc. It is the way that a single-CPU machine can have multiple things happen on it at once, through the miracle of timeslicing. (If you want to read more, search for timeslicing on your favorite search engine.)
Threads are "processes within processes". According to the CPU, there's only one thing executing. According to the code, there's multiple things.
The reasons you want to fork are numerous. It could be anything from wanting to do data-munging in parallel to a web server handling multiple requests of a CGI script to the gods know what. What I've discovered is that, in over 8 years of programming, I've never wanted to fork ... not even once. Others work with forking on a daily basis.
There are a number of headaches dealing with forking, such as parent-child relationships, race conditions, data-sharing, signalling/communication, and overflowing the OS's process table ... just to name a few of the more common ones. If you do want to fork, read up on it. A lot. Then, read some other people's code. Try it out. Expect to have a number of issues and questions pop up.
Good luck. *winces*
------ /me wants to be the brightest bulb in the chandelier!
Vote paco for President! | [reply] |
| [reply] |
| [reply] |
i belive the quote is "If you can't find it with super search, it aint a substring of a text field in your database" (found that here) -p
| [reply] |
Oh cool! There is a super search? I'll have to try that out. Does it find more specific searches or something, and thus is superior to basic searching?
Mr.T
qw/"I pity da foo' who don't use Perl!"/;
| [reply] |
You really have to read the Learning Perl and Programming Perl. I had so many of the same questions as you when i started and these, i hear, are the best out there. I have finished reading Learning Perl cover to cover. I am working on Programming Perl, and i learn something new all the time. just thought i'd put my 2 cents in. :)
Ray | [reply] |