Does every program require thread programming? Nope, but some benefit from it.
You can start up multiple threads and get a perceived performance gain when you spend time blocking on some operation, like reading or downloading files. If all your operations are CPU bound, like numeric computations, then splitting up multiple threads won't help on performance. I made a little program that downloads files from the Internet. For two to about five threads each new thread gives more throughput. After that it saturates the CPU and more threads slow things down.
You can also start up a "worker thread" separate from an AWT or Swing GUI thread so the user interface is responsive while some long running task goes on in background. Again, if the other task is CPU bound it might not give up enough CPU for the GUI thread to do much, so it won't always work as expected.
But how about if 1 programs that can redirect different user to different database? it will synchro right? if so, how can I specific in that program if it is sharing same databse then we do synchro, else (different databse) then we do concurrently?
OR It is not possible?since what ever program call thread also will synchro...
Joined: Dec 28, 2005
Actually What I wanna do is do synchro when sharing same database, If user from same set of program access to different database, I do multithreads.