UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2004-02-05 08:35 PM

koo
Member
Registered: 2004-01-24
Posts: 2

Re: Paused thread?

Hi,
I have created a quite large program under windows and now I am porting it to linux and uinx.

Under linux everything is working perfectly.
But under unix...

When I create a thread with pthread_create the thread dosen't start until I in the end of the program when I call pthread_join.

I find this really wierd because I tested these functions in a much simpler program and it all worked fine.

Does anyone have a solution or even a hint what's wrong?

Regards,
Koo

Offline

#2 2004-02-07 04:31 AM

Uzume
Administrator
Registered: 2002-08-30
Posts: 186

Re: Paused thread?

I am not really a threading or pthread guru, however, you might want to mention what you mean by "unix". The term Unix is owned by the Open Group and they let people apply such to any product that meets their Unix standard specifications (which are now developed jointly with IEEE POSIX). I believe Unix, can and does refer to some versions of Linux in fact, however there are a number of Unix-like OS venders that have obtained Unix standardization and thus use that name and I presume you are referring to one of such platforms.

Offline

#3 2008-02-21 01:17 PM

mlampkin
Administrator
From: Sol 3
Registered: 2002-06-12
Posts: 911
Website

Re: Paused thread?

Ha!

Another question that was never fully answered... nevermind that its from 2004... :)

A number of systems / *NIX OSes set the default concurrency level for threading equal to the number of processors available on the system e.g. 1 processor means a concurrency level of 1 and ONLY a single thread will execute at a time... 2 processors would allow ( only ) 2 threads to run simultaneously...

So I am guessing this is what you are seeing... the concurrency level is defaulting to 1 ( or something very low ) and the first thread executes... your main program does a join against it... and when ( and only when ) the join finishes indicating the first thread has completed - does the next one get to begin execution...

If you run into this check for the existence of either pthread_setconcurrency or thread_setconcurrency on you system... and call the function with the desired number of threads you want to execute simultaneously...

We now return you all to 2008... :)


Michael


"The only difference between me and a madman is that I'm not mad."

Salvador Dali (1904-1989)

Offline

#4 2008-09-27 02:57 AM

yuqingeng2005
Guest

Re: Paused thread?

Virgin wranglerNot only was Zarqawi killed, but so were seven of his cronies... making it a good day for the U.S. military, but a bad day to be a virgin wrangler in Muslim heaven. Eight martyrs, 72 apiece? That's nearly 600 virgins needed, stat. My guess is some of the lower ranking guys might not be getting a full compliment if you know what I'm saying. I think the cherry orchard may have a couple bruised fruits. 111

Board footer

Powered by FluxBB