Re: Pthread problem using IRIX 6.5.4 with multiple processes
- From: "DomF" <Dominic.Fraser@xxxxxxxxx>
- Date: 16 Dec 2005 08:07:17 -0800
Thanks Loic for your answer.
On this link,
http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/0650/bks/SGI_Developer/books/T_IRIX_Prog/sgi_html/ch13.html#id77267
I have noticed that the address space for POSIX Threads is shared.
I have also noticed that the Memory-mapped files and arenas are also
shared.
Do you know what it means?
Does it mean that all the pthreads are saved in the same place in
memory?
It would explain why there is a conflict with my threads between my two
different instances of my program.
For my question : Does it mean that the kernel owns all the threads?
I just wanted to know where the threads are saved in memory and if the
kernel manages the memory between my two instances.
Thank you again
loic-dev@xxxxxxx wrote:
> Hello,
>
> > I know that both kernel threads and pthread can be used with IRIX but
> > how can I be sure that I am using the POSIX threads. Here is an example
> > of how I link with pthreads:
> >
> > CC -n32 -D_POSIX_C_SOURCE=199506L -o TacMap map.o contour.o -lpng
> > -lz -lshape -ltinyxml -lglut LANG:STD -lc -lftn -lGLw -lXm -lXt -lX11
> > -lXmu -lm -lGL -lGLU -lpthread
>
> Looks good if we refer to:
> http://techpubs.sgi.com/library/tpl/cgi-bin/getdoc.cgi/0650/bks/SGI_Developer/books/T_IRIX_Prog/sgi_html/ch13.html#id77267
>
>
> > In my code, I include header <pthread.h>
> >
> > Do you see a problem with my linking command?
>
> A priori, no.
>
>
> > 2-
> > I have put traces in my code using pthread_self to print the thread ID
> > and I have noticed that my two processes are using the same thread ID.
> >
> > App.1 : Thread #0 tid = 65537 pid = 8192 ppid = 1700
> > App.1 : Thread #1 tid = 65538 pid = 8192 ppid = 1700
> > ...
> > App.2 : Thread #0 tid = 65537 pid = 8193 ppid = 1700
> > App.2 : Thread #1 tid = 65538 pid = 8193 ppid = 1700
> > ...
> >
> > Is it correct?
>
> With POSIX threads, thread identifiers are only meaningfull within a
> process. IOW, it is perfectly possible to have the same TID in two
> different processes.
>
> > I thought that the parent pid (ppid) should differ from one process to another.
>
> No. The ppid can be the same, if the processes are sibling. What's
> unique is the process id (one pid per process). However, within a
> process you may have several threads, and each thread should return the
> same pid.
>
> > Does it mean that the kernel owns all the threads?
>
> I don't understand your question fully...
>
>
> HTH,
> Loïc.
.
- References:
- Prev by Date: Re: RW locks-when to use?
- Next by Date: Re: RW locks-when to use?
- Previous by thread: Re: Pthread problem using IRIX 6.5.4 with multiple processes
- Next by thread: RW locks-when to use?
- Index(es):
Relevant Pages
|