Reply
Old 05-28-2009, 11:43 PM Threading Question
Average Talker

Posts: 16
Trades: 0
Hello!

Would you tell me, please, what technics of multi-thread usage can icrease CPU's calculation speed?

Thank you!

Last edited by Termito; 05-28-2009 at 11:50 PM.. Reason: Already posted, sorry
Termito is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 05-30-2009, 12:32 AM Re: Threading Question
willcode4beer's Avatar
Super Moderator

Posts: 1,388
Name: Paul Davis
Location: San Francisco
Trades: 1
First off, threads don't increase CPU calculation speed.

They do allow multi-tasking and exploiting CPU idle time and the use of multiple cores and. multiple CPUs.

For example (single core single cpu):
Say you have a page that requires 4 database calls. Each call takes 50ms for the database to respond.
In a single threaded environment, the server will spend 200ms, just waiting on the database.
If you executed each query in it's own thread, the server will only spend 50ms waiting on the database.

make sense?
__________________
Paul Davis

earn $$$ write for willCode4Beer.com
willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 05-30-2009, 11:54 PM Re: Threading Question
Average Talker

Posts: 16
Trades: 0
And there are many other cases, in which multi-threading can endecrease general time for algorithm execution. For example mathematical calculations.

(A+B)*(C+D).
.(A+B) and (C+D) calculations can be executed simultaneously, because A,B and C,D variables are not dependent on execution step. But for “*” operation we should wait for execution of these 2 threads: .(A+B) and (C+D) – operands are dependent from previous step of execution

Is there any automated tools or techniques to find potential able for multi-threading parts in general algorithm (to find ability to execute simultaneously (A+B) and (C+D) in the example)? If no it is wonderful to develop one, program, which makes multi - threadable algorithm from single threaded one.
Termito is offline
Reply With Quote
View Public Profile
 
Old 05-31-2009, 12:29 AM Re: Threading Question
NullPointer's Avatar
Will Code for Food

Latest Blog Post:
Easy PHP Search with Opera
Posts: 1,067
Name: Matt
Location: Irvine, CA
Trades: 0
Look into the actor model paradigm. Microsoft recently released Axum, which will work with the .NET framework.

Other languages have support for multiple threads, but actor model languages were developed with parallel computing in mind.
__________________
Tinsology | How to Post Code | EverythingDev
NullPointer is online now
Reply With Quote
View Public Profile
 
Old 06-12-2009, 11:33 AM Re: Threading Question
Super Talker

Posts: 101
Trades: 0
Threading does not increase the CPU speed. It just uses the CPU ideal time for any valuable processing. Multithreaded programming makes programs running faster when dealing with multicore processors or multiple processor computer systems.

Support, you have one application and that has 3 features.

- uploading image it to the server
- Inserting the record of this screen shot in the database
- Printing the taken screen shot

You can use 3 different threads for executing these three function and execute them simultaneously to increase the task completion speed.

If you are developing applications on .NET platform, then there is a System.Threading namespace that has the wide range of built-in classes to deal with threads, process contexts, dealing with critical region of processes etc.
__________________
AccuWebHosting.Com - Windows Hosting Expert
ASP.NET 3.5 | SQL 2005 Database | US Based Hosting Company | 24 X 7 Support | Daily Backups | Uptime Guarantee | Affiliates - $50 Per Sale
| Website Hosting
twhdir is offline
Reply With Quote
View Public Profile
 
Old 06-12-2009, 11:19 PM Re: Threading Question
Average Talker

Posts: 16
Trades: 0
Thanks!
Termito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Threading Question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.12440 seconds with 13 queries