aspose file tools*
The moose likes Threads and Synchronization and the fly likes what makes threads  the Threads? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "what makes threads  the Threads?" Watch "what makes threads  the Threads?" New topic
Author

what makes threads the Threads?

naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

my question is we can make any application without a thread , so then why do we need a thread
i understand thread is a light weight process but still
what makes threads so usefull ?


The Only way to learn is ...........do!
Visit my blog http://inaved-momin.blogspot.com/
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Every Java application uses threads. A standalone application uses at least one main thread which is implicitly created when you start an application. Applications running inside a Servlet container or application server even use many more threads.

Threads are useful if you want to have your application do more than one thing in parallel to improve performance. Multi-threaded programming is particularly useful with modern multi-core CPUs to get the most out of your hardware. If an application isn't designed to run with multiple threads you won't gain any improvement by using CPUs with more than a single core.

Marco
naved momin
Ranch Hand

Joined: Jul 03, 2011
Posts: 692

Marco Ehrentreich wrote:Every Java application uses threads. A standalone application uses at least one main thread which is implicitly created when you start an application. Applications running inside a Servlet container or application server even use many more threads.

Threads are useful if you want to have your application do more than one thing in parallel to improve performance. Multi-threaded programming is particularly useful with modern multi-core CPUs to get the most out of your hardware. If an application isn't designed to run with multiple threads you won't gain any improvement by using CPUs with more than a single core.

Marco


thanks but i have one more thing to ask is that i m making my final year project which is a bussiness management system which handles all the data about employess , and there attendence and salary and also this system contains tender management module ..till now i have just one thread and that too is main thread should i go for multi threads for this project
yes or no , if yes than should i make each and every listener class a thread .
if no ..then why ?
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Unfortunately it's not that easy to judge if it would make sense for your project to make extensive use of multi-threading. If you are unfamiliar with concurrency principles and you don't have any experience with threads I would recommend to not use multi-threading if there's no real need for it. Concurrent programming with multiple threads can be very tricky and chances are good that you will mess up your project.

Marco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what makes threads the Threads?