• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Will muti-threading make you program run faster?

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My answer to that question is no. It will even slow down your program by constructing and starting multiple threads.
Am I right?
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Edy Yu:
My answer to that question is no. It will even slow down your program by constructing and starting multiple threads.


The right answer is "depends". Multithreading may increase real performance by allowing you to do useful work while you would otherwise do nothing, for instance, when waiting for a blocked I/O call. There is no question that multithreading increases the performance of a web server.
It may also increase perceived performance by allowing your application to remain responsive, update the display etc. while some background activity is going on. There is no question that people will experience an improvement of the performance of your word processor if you do the spellchecking in the background, even if that means the spellcheck takes twice as long.
- Peter
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Great answer, Peter!!!
Just add one more point, the speed improvement will be more obvious if your computer has multi-processors.
Roseanne
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Peter already told the essence of multithreading for improving performance ,
as per my experience i believe u gotta know what task to put on how much priority thread and synchrize them properly so as to add positively towards performance of your application..
A group of poorly prioritized threads might slow your application to the level of unacceptable limits ..
 
Ranch Hand
Posts: 388
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
(i think)
ulti threaded code does not profit from multiple cpu's by default. it depends (wee, again) on the code. sometimes cpu-cpu communication will introduce more overhead.
right ?
karl
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi there Edy! i know i saw something really useful about this topic on the java jumpstart cd... i'll get back to you after i find my copy.
 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here you go...
Tech Tips on Threads
------------------
aka pinboxx
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic