Re: thread_create,thread_join

Jeff Rosenwald <[email protected]> Thu, 12 Jun 2014 08:37:47 -0400 (EDT)
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Hi Josef:

What OS are you using? A thread that's waiting around shouldn't be causing performance issues. Are your threads detached or not. If not detached, then you must do a thread_join in order to claim its resources. Otherwise you're leaking memory.

My experience with 32-bit Windows is that about 300 threads are possible per process. On 64-bit Linux, about 1500.

Of course, having a multi-threaded system is of no use if you don't have the computing resources to manage their aggregate computing requirement. Amdahl's Law hints that 2 fast cores is better than 4 not-so-fast cores.

Performance could also die do to concurrency issues. That is waiting on mutexes and stuff. You may find that your program runs sequentially despite being parallelized due to the need for all threads to access a single resource that requires serial access. Too many hands in the cookie jar. Things are no longer random. Livelock ensues.

What is the structure of your program. Can you pipeline it or vectorize it?

Reduce your program to one thread. See what happens. Then add a thread at a time. See what changes.

 

 Regards,

 

-----Original Message-----
From: Josef Fydl <[email protected]>
To: swi-prolog <[email protected]>
Sent: Wed, Jun 11, 2014 12:06 pm
Subject: [SWIPL] thread_create,thread_join


I am using http_server, relatively slow value, But each request is internet 
extensive, 90 % is waiting for sites. I use thread_create etc.
However, If I go above 30 threads, performance dies.

So I do not need big pool for handling requests coming in, but big pool of 
working threads. How can I go about it?

Thanks Josef Frydl
_______________________________________________
SWI-Prolog mailing list
[email protected]
https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog

 
-------------- next part --------------
HTML attachment scrubbed and removed