|
|
About ::
TODO ::
Blog ::
RSS ::
Old blog ::
Projects ::
GIT ::
Gallery ::
Notes
Wed, 17 Jan 2007
pthread_create() vs. clone().
Did you ever tried to use clone() directly?
I bet you never tried it at least with recent kernels.
First, exported clone() does not correspond to
what kernel expects, it looks like it is only provided for
compatibility. Manpage for that call is utterly obsoleted
and incorrect (except useful flag description it contains
_wrong_ descrition of parameters at least for i386).
But I do not search for easy ways - I have glibc sources and can
dig into them.
That was my first impression of the man, who in theory can climb the Everest,
fly to the space and understand math behind string theory (the latter only if time permits,
it looks like the whole life can be spent there digging into more and more
new subtheories).
Now I think that all three tasks described above can be much-much-much
more solvable than digging in the glibc sources. And those people
says that I poorly described kevent - hey, look into glibc NPTL
implementation (and I even do not talk about its coding style)
and pray you will never see this again,
or just try to start a new thread using clone().
After about an hour of reverse engineering process trying to make __clone()
work (note, that clone() does not work at all, just forget
about this call, only __clone() is correct for i386 and 2.6 kernel),
I managed to start new thread. It was a win, except very small problem,
that it crashed somewhere in the provided function calling chain.
I want you to know, that I do not know low-level i386 arch enough
to easily read and understand asm code (some years ago I managed to
write asm application which entered protected mode in DOS,
but I do not recall asm already, and actually never understood
gas semantic good enough) found in sysdeps/unix/sysv/linux/i386/clone.S,
so I miserably failed to proceed.
Yes, I started to use pthread_create() for SMP scalability.
I do not hear how you scream 'loser', since you would be there too, but those of you,
who still lurks here and ironically nod your head would better point
me to something useful for understanding of how modern i386 (or actually any other arch)
starts and works with threads/processes.
/devel/threading :: Link / Comments ()
|