Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

thread overhead  RSS feed

 
Peter Straw
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does starting and running many threads create a lot of overhead in terms of CPU and memory usage?
Say I am running 3 or 4 threads concurrently, each doing various database operations, is it the database operations that will create overhead or is it the fact that there are several threads running?
Many thanks.
 
Jon Strayer
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Straw:
Does starting and running many threads create a lot of overhead in terms of CPU and memory usage?
Say I am running 3 or 4 threads concurrently, each doing various database operations, is it the database operations that will create overhead or is it the fact that there are several threads running?
Many thanks.

Yes. :-)
The only way to know for sure is to profile the application. My guess (and it's only a guess) is that the database operations will take far more time than the thread overhead.
But I can think of situations where that wouldn't be true.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!