?
Solved

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

Posted on 2010-08-18
4
Medium Priority
?
342 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 18

Accepted Solution

by:
Anil Golamari earned 668 total points
ID: 33469019
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 668 total points
ID: 33469107
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 664 total points
ID: 33469132
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
ID: 33469182
Thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Great sound, comfort and fit, excellent build quality, versatility, compatibility. These are just some of the many reasons for choosing a headset from Sennheiser.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

770 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