Doh! Stupid Programming Mistakes <humor>

Topher Fischer javert42 at cs.byu.edu
Thu Oct 19 13:00:50 MDT 2006


Alex Esplin wrote:

> This is going to show my inexperience in a big way, but I might as
> well take the chance to learn some more today.
>
> Now that I know what fork() does, what kind of situations would you
> want to use it in?  I can see this as being really useful, but I don't
> quite have my head wrapped around it yet.
>
> Thanks for being patient with me...
>
Dr. Mercer's Computer Architecture (CS345) class gave me my only
experience with a practical use of forking.  We wrote a small UNIX
shell, and when the user typed in a command, the program would fork. 
This creates a new process with its own memory space, file descriptor
table, signal handlers, etc.  The child process would then exec (man 3
exec) the user's command, which takes over the process that was created
by the fork command.  If concurrency is the only goal, then threads will
usually take care of the problem.  However, if you need a completely new
process with its own resources, then fork you.  I mean, then you fork.

-- 
Topher Fischer
GnuPG Fingerprint: 3597 1B8D C7A5 C5AF 2E19  EFF5 2FC3 BE99 D123 6674
javert42 at cs.byu.edu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
Url : http://plug.org/pipermail/plug/attachments/20061019/266aae14/attachment.bin 


More information about the PLUG mailing list