Re: Pthread problem using IRIX 6.5.4 with multiple processes



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.

.



Relevant Pages

  • Re: Linux inotify - how can I get process id of processing doing action?
    ... pid would simply have been a stepping stone to finding the user id. ... Process changes user ID. ... Process writes a byte to the memory, no kernel call is involved. ...
    (comp.unix.programmer)
  • 2.6.33 dies on modprobe
    ... The kernel starts up fine and mounts the root-filesystem, ... Freeing unused kernel memory: 408k freed ... # CPUFreq processor drivers ...
    (Linux-Kernel)
  • Re: [PATCH] intel-agp.c: Fix crash when accessing nonexistent GTT entries in i915
    ... has info that 256K is for GTT bar, so max video memory size is 256M. ... IGD DVMT/FIXED MEMORY: 32 MB ... Access kernel.org in iceweasel and the X server will crash. ... Sometimes, the kernel freezes. ...
    (Linux-Kernel)
  • Re: s2disk hang update
    ... This looks like we have run out of memory while creating a new kernel thread ... because the I/O doesn't work at this point). ... Keep 1 MB of memory free so that device drivers can allocate some pages in ...
    (Linux-Kernel)
  • [UNIX] Linux Kernel do_brk() Vulnerablility (Explained)
    ... Get your security news from a reliable source. ... A critical security bug has been found in the Linux kernel 2.4.22 (and ... earlier) memory management subsystem. ... for the code working at the lowest privilege level. ...
    (Securiteam)