LinuxThreads follows the so-called "one-to-one" model: each thread is
actually a separate process in the kernel. The kernel scheduler takes
care of scheduling the threads, just like it schedules regular processes.
So each thread is actually a process.
Werner
On Mon, 2 Apr 2001, Liu, Guangsheng wrote:
> Hi,
> I have one process creating several threads, inside each thread, I made
> getpid() call,
> it should display the same process id, but I got different number.
> Why?
> Thanks.
>
>
> ----
> void main(int argc, char *argv[])
> {
> ....
> for (i=0; i<threads; i++)
> {
> pthread_create(&t[i], &attr, rtf_thread, &i_thread[i])
> }
>
> for (i=0; i<threads; i++)
> {
> pthread_join(t[i], 0);
> }
> ...
> }
>
> void* rtf_thread(void* ptr) {
>
> printf("pid = %d, threadid = %d\n", getpid(), pthread_self());
> ...
> ...
>
> }
>
>
>
> _______________________________________________
> Redhat-devel-list mailing list
> [EMAIL PROTECTED]
> https://listman.redhat.com/mailman/listinfo/redhat-devel-list
>
_______________________________________________
Redhat-devel-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-devel-list