Subject: PTHREAD_CONCURRENCY and large SMP (8 CPUs)
To: NetBSD current <current-users@NetBSD.org>
From: Nicolas Joly <njoly@pasteur.fr>
List: current-users
Date: 12/01/2005 15:48:57
--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


Hi,

While playing with a 8 CPUs amd64 machine (4x dual-core 865 Opterons),
i noticed that a simple threaded program (source attached) does not
work with PTHREAD_CONCURRENCY >= 6. I already tested this small
program on NetBSD/i386 and NetBSD/amd64, but never with 8 CPUs.

Is there anything i can tweak to make it work ?

njoly@thorgal [~]> PTHREAD_CONCURRENCY=8 ./thr
main hello world
thread hello world
assertion "next != 0" failed: file "/local/src/NetBSD/src/lib/libpthread/pthread
_run.c", line 130, function "pthread__next"
zsh: abort (core dumped)  PTHREAD_CONCURRENCY=8 ./thr
njoly@thorgal [~]> PTHREAD_CONCURRENCY=7 ./thr
main hello world
assertion "next != 0" failed: file "/local/src/NetBSD/src/lib/libpthread/pthread
_run.c", line 130, function "pthread__next"
zsh: abort (core dumped)  PTHREAD_CONCURRENCY=7 ./thr
njoly@thorgal [~]> PTHREAD_CONCURRENCY=6 ./thr
main hello world
thread hello world
assertion "next != 0" failed: file "/local/src/NetBSD/src/lib/libpthread/pthread
_run.c", line 130, function "pthread__next"
zsh: abort (core dumped)  PTHREAD_CONCURRENCY=6 ./thr
njoly@thorgal [~]> PTHREAD_CONCURRENCY=5 ./thr
main hello world
thread hello world
njoly@thorgal [~]> PTHREAD_CONCURRENCY=4 ./thr
main hello world
thread hello world
njoly@thorgal [~]> PTHREAD_CONCURRENCY=3 ./thr
main hello world
thread hello world
njoly@thorgal [~]> PTHREAD_CONCURRENCY=2 ./thr
main hello world
thread hello world
njoly@thorgal [~]> PTHREAD_CONCURRENCY=1 ./thr
main hello world
thread hello world

This is a -current system from Nov. 7, running a GENERIC.MP kernel.

The full dmesg has already been posted on NetBSD/amd64 mailing list:
<URL:http://mail-index.netbsd.org/port-amd64/2005/12/01/0003.html>

Thanks in advance,
Regards.

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.

--azLHFNyN32YCQGCU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="thr.c"

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

void *thr_run(void *);    


int main(int argc, char **argv) {
  pthread_t thr;
  
  if (pthread_create(&thr, NULL, thr_run, NULL) != 0) {
    err(1, "pthread_create"); }
  
  (void)printf("main hello world\n");  

  if (pthread_join(thr, NULL) != 0) {
    err(1, "pthread_join"); }
  
  return 0; }
 
 
void *thr_run(void *arg) {
 
  (void)printf("thread hello world\n");
  
  return NULL; }


--azLHFNyN32YCQGCU--