[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problem with threads programs



Yuri Kozlov a écrit :
Hello.

I just install the Debian Installer etch beta 3 on C3600.
yuray@nmc:~$ cat /proc/cpuinfo
processor       : 0
cpu family      : PA-RISC 2.0
cpu             : PA8600 (PCX-W+)
cpu MHz         : 552.000000
model           : 9000/785/C3600
model name      : Allegro W+
hversion        : 0x00005cf0
sversion        : 0x00000481
I-cache         : 512 KB
D-cache         : 1024 KB (WB, 0-way associative)
ITLB entries    : 160
DTLB entries    : 160 - shared with ITLB
BTLB            : not supported
bogomips        : 1101.00
software id     : 2009828607

Installation has been successfull. (except the missing russian fonts
on the console, I have an unsupported graphical card)
Next, I try to compile small program:

#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>

void *print_message_function( void *ptr );

main()
{
    pthread_t thread1;
    char *message1 = "Thread 1";
    int  iret1;

    iret1 = pthread_create( &thread1, NULL, print_message_function,
(void*) message1);

    pthread_join( thread1, NULL);

    printf("Thread 1 returns: %d\n",iret1);
    exit(0);
}

void *print_message_function( void *ptr )
{
    char *message;
    message = (char *) ptr;
    printf("%s \n", message);
       while(1);
}

yuray@nmc:~$ gcc-4.1 -lpthread thr.c
yuray@nmc:~$ ./a.out
Thread 1

Seems, all is OK.
But:
yuray@nmc:~$ ps -ef|grep a.out
yuray     5426  4914  0 07:23 pts/0    00:00:00 ./a.out
yuray     5427  5426  0 07:23 pts/0    00:00:00 ./a.out
yuray     5428  5427 97 07:23 pts/0    00:00:33 ./a.out

Why?
On x86 this program work as expected and have one process.


x86 (on 2.6 kernels only) is using the NPTL library for threads, while hppa uses the linuxthreads library. What you see is normal.

Bye,
Aurelien

--
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net



Reply to: