Solved

How related is multi-threaded programming and multi-processor machines?

Posted on 2010-08-18
4
278 Views
Last Modified: 2013-12-17
Is writing a program to be multi-threaded automatically a way to make that program perform optimally on a multi-processor machine?  Or are there other considerations that need to be programmed into multi-threaded applications?

Curious...

newbieweb
0
Comment
Question by:newbieweb
4 Comments
 
LVL 18

Accepted Solution

by:
Anil Golamari earned 167 total points
Comment Utility
Multiprocessing : Several jobs can run at the same time.

Multi-threading : Same job can be broken logically and executed simultaneously and the results are combined at the end of processing

http://forums.techarena.in/software-development/1131462.htm
http://www.jguru.com/faq/view.jsp?EID=211169

hope these links help you.
0
 
LVL 16

Assisted Solution

by:Vikram Singh Saini
Vikram Singh Saini earned 167 total points
Comment Utility
Hi,

To your first question answer is  true.

Let us try to understand the scene behind. For example, your application is multithreaded app. and when it executes different threads for making program optimize ( or in other words it can be say to utilize maximum resources for faster execution of code).

The programs which doesn't use threading are tend to using single processor generally. If the application is multithreaded (as already said), then it will execute threads two or more at a time, causing load on processor, and since processor needs to make threads in queue to handle them one by one.

In that case if there is one more processor then the other threads waiting in queue can be send to the next processor to execute and hence you are using your computer resources to max. Ultimately this will increase performance of your application and yes it makes it optimize too.

Considerations that need to be programmed into multithreaded application:

(1) Your application should have proper managements of Threads.
(2) Sometimes if both thread tries to access single resource or are waiting for each other to complete their operation respectively can cause problem in your program. Or it makes your program non-responsive for long time.
(3) Creating lot of threads in program unnecessary is also not recommended because it will increase load on processor unnecessary decreasing overall performance of system.

Hope it helps u to understand.

Regards,
V.S.Saini


0
 
LVL 5

Assisted Solution

by:TechnicallyMaybe
TechnicallyMaybe earned 166 total points
Comment Utility
A program has to be coded to take advantage of multiple CPUs.  If not, it will only use 1. A multi-threaded app won't necessarily be multi-cpu.
An example of a multithreaded app is Firefox where each tab runs in it's own thread.  If one tab crashes, it doesn't cause the rest of the threads to crash.
0
 

Author Closing Comment

by:newbieweb
Comment Utility
Thanks.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In the modern office, employees tend to move around the workplace a lot more freely. Conferences, collaborative groups, flexible seating and working from home require a new level of mobility. Technology has not only changed the behavior and the expe…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now