User Id :    Password :      New Member   Forgot Password  
Topic: What are multithreaded applications?
Anamika singh
23 Nov 2010 at 02:15 AM
What are multithreaded applications?
Re: What are multithreaded applications?
16 Dec 2010 at 03:18 AM
Most programming applications were single-threaded.  That means there was only one thread in the entire application.  You could never do computation A until completing computation B.  A program starts at step 1 and continues sequentially (step 2, step 3, step 4) until it hits the final step (call it step 10).   A multithreaded application allows you to run several threads, each thread running in its own process.  So theoretically you can run step 1 in one thread and at the same time run step 2 in another thread.  At the same time you could run step 3 in its own thread, and even step 4 in its own thread.  Hence step 1, step 2, step 3, and step 4 would run concurrently.  Theoretically, if all four steps took about the same time, you could finish your program in a quarter of the time it takes to run a single thread (assuming you had a 4 processor machine).  So why isn't every program multithreaded?  Because along with speed, you face complexity.  Imagine if step 1 somehow depends on the information in step 2.  The program might not run correctly if step 1 finishes calculating before step 2 or visa versa. 
Total Replies: 1
Featured Text Ad

Featured Ad