Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pthread_create returns error code 11

748 views
Skip to first unread message

Harshith

unread,
May 27, 2009, 1:32:02 PM5/27/09
to
I read up that this could be due to exceeding the THREAD_MAX limit for
the process. But i want to use only about 24 threads at a given time,
and i destroy the threads (or atleast i thought so) can someone tell
me what i am doing wrong here it would be of great help! thanks!

for (i=0; i<no_pairs; ){
for (j=0; j<MAX_THREADS && i<no_pairs; j++,i++){
data[j].a = seeds[i/no_seeds];
data[j].b = seeds[i%no_seeds];
data[j].N = N;
data[j].L = nones+nzeros;
data[j].p1 = get_string (seeds[i/no_seeds], nzeros
+nones-1);
data[j].p2 = get_string (seeds[i%no_seeds], nzeros
+nones-1);
data[j].results = pairs[i];
rc = pthread_create (&threads[j], &attr, run_actree,
(void*)&data[j]);
if (rc) {
printf ("ERROR; return code from pthread_create() is %d
\n", rc);
exit (-1);
}
}
for (k=0; k<j; k++){
rc = pthread_join (threads[k], &status);
if (rc) {
printf("ERROR; return code from pthread_join() is %d
\n", rc);
exit(-1);
}
}
}

pthread_attr_destroy (&attr);

Above is the main loop i create threads in, MAX_THREADS = 24

the number of pairs is about 300 million, the above code worked
correctly (or atleast the results seemed correct and there were no
errors) for 2 million pairs.

David Schwartz

unread,
May 27, 2009, 2:02:54 PM5/27/09
to
On May 27, 10:32 am, Harshith <harshi....@gmail.com> wrote:
> I read up that this could be due to exceeding the THREAD_MAX limit for
> the process. But i want to use only about 24 threads at a given time,
> and i destroy the threads (or atleast i thought so) can someone tell
> me what i am doing wrong here it would be of great help! thanks!

Whether or not this should work, why would someone want to do
something so horribly awful?

DS

Harshith

unread,
May 27, 2009, 5:02:57 PM5/27/09
to
LOL because its my work :)
anyways i found out the reason and it turns out it has nothing to do
with this code - its because 300 million just makes me run out of 8 gb
or ram and 16 gb of swap :)

anyways barcelona won the champiions league hurray!!
and sorry for wasting your time with this post :)

David Schwartz

unread,
May 27, 2009, 5:44:30 PM5/27/09
to
On May 27, 2:02 pm, Harshith <harshi....@gmail.com> wrote:

> LOL because its my work :)

I don't see why that requires you to create and destroy threads rather
than reusing them.

DS

0 new messages