Re: [AD] multithreaded callbacks

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Henrik Stokseth wrote:
> 
> Stepan Roh <stepan@xxxxxxxxxx> wrote:
> 
> > The most common POSIX Threads implementation for Linux (LinuxThreads
> > included in glibc2) is just wrapper for clone syscall. Why do you think
> > it's slow?
> 
> just a comparision i saw a the linux-kernel mailinglist a while ago. linus
> said people were better off using the native linux system calls for speed
> and not the posix system calls and refused to do anything to speed it up.
> btw. i don't have any experience with threaded programming but aren't
> clone() used to fork whole processes? that's not threaded programming...
> 
> -henrik

No... fork() is uses to fork whole processes :)

here's a snippet from the __clone manpage:

NAME
       __clone - create a child process

SYNOPSIS
       #include <sched.h>

       int    clone(int (*fn) (void *arg), void *child stack, int
       flags, void *arg)

DESCRIPTION
         clone creates a new process like fork(2)  does.   Unlike
       fork(2),    clone  allows the child process to share parts
       of its execution context with its parent process, such  as
       the  memory  space, the table of file descriptors, and the
       table of signal handlers.  The main use of   clone  is  to
       implement  threads:  multiple threads of control in a pro­
       gram that run concurrently in a shared memory space.

-- 
Thomas Fjellstrom
tfjellstrom@xxxxxxxxxx
http://strangesoft.net



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/