NetBSD-Bugs archive

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

Re: port-amd64/46581: Continuous pthread_create may fail on amd64



The following reply was made to PR port-amd64/46581; it has been noted by GNATS.

From: "NARUSE, Yui" <naruse%airemix.jp@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: port-amd64/46581: Continuous pthread_create may fail on amd64
Date: Tue, 12 Jun 2012 01:48:12 +0900

 2012/6/11 Martin Husemann <martin%duskware.de@localhost>:
 > The following reply was made to PR port-amd64/46581; it has been noted by=
  GNATS.
 >
 > From: Martin Husemann <martin%duskware.de@localhost>
 > To: gnats-bugs%NetBSD.org@localhost
 > Cc:
 > Subject: Re: port-amd64/46581: Continuous pthread_create may fail on amd6=
 4
 > Date: Mon, 11 Jun 2012 11:23:37 +0200
 >
 > =A0I don't see what's wrong with this behaviour - you can not rely on you=
 r new
 > =A0threads being scheduled before running into the resource limit on thre=
 ads
 > =A0in the creating for loop.
 >
 > =A0Am I missing something?
 
 I'm sorry about confusing post.
 What I described about sched_yield is useless.
 
 The correct reproducible program is below and wrong platform is i386.
 On amd64, it fails as ulimit specified.
 But on i386, it completes working.
 
 #include <pthread.h>
 #include <stdlib.h>
 #define THREAD_COUNT 161
 void *dummy(void *p) {
     sleep(100);
     return NULL;
 }
 int main(void) {
     int i;
     pthread_t *threads =3D malloc(sizeof(pthread_t) * THREAD_COUNT);
     for (i =3D 0; i < THREAD_COUNT; i++) {
         if (pthread_create(&threads[i], NULL, dummy, &i)) {
             perror("pthread_create");
             abort();
         }
         sched_yield();
     }
     return 0;
 }
 
 --=20
 NARUSE, Yui =A0<naruse%airemix.jp@localhost>
 


Home | Main Index | Thread Index | Old Index