Solved

Dual Processor Issue

Posted on 2002-06-17
5
278 Views
Last Modified: 2013-11-20
Hi,

We are developing a WIn32 application using MFC Sockets. Once a successful connection is established, we are spawning a thread which will get realtime data from a Server whenever RealTime data comes. I am setting the thread priority as THREAD_PRIORITY_HIGHEST

This works fine in a Single Processor machine.

The same program crashes on a dual processor machine.

What could be the reason.

Where can I find Dual Processor and Threading related issues.


Thanks
0
Comment
Question by:gurukg
5 Comments
 
LVL 16

Expert Comment

by:AlexNek
Comment Utility
2 gurukg
It is hard to answer without additional information. (Is it every time the same place for crash? In which thread it crached? What program did in this time? ...)

I can suggest thread synchronization problem. For test try to suspend main thread while you read the data. Or play with function:
SetThreadIdealProcessor( HANDLE hThread, DWORD dwIdealProcessor);
0
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
Comment Utility
Your question is VERY general but chances are you have a very SPECIFIC error.

But in general, you have most likely made an error in your coding and made an ASSUMPTION about something w.r.t. the multiple thread.  There are many things that CAN happen in a multi-thread environment that happen differently in a single vs. a dual CPU system.  In fact a single CPU system will NEVER have two threads running at the same time.  It's IMPOSSIBLE since there is only one CPU.  but a dual CPU will have threads running at once and if you assume anything about when things might happen (i.e. order of completion, etc.) you will eventually get burned.

Go back and double check ALL places where you have dependencies between threads and either eliminate them or protect them with "gates" that will make sure that one thread CANNOT pass the gate until the other thread has done whetever it had to do first.

BTW, if the application is crashing you should be able to determine very simply where the problem lies.  Just examine the crash data and find out which thread crashed and where it crashed.  Then look at your code and find out what's wrong....

Run it in the DEBUGGER if you need to.  The VC++ debugger runs multi-threaded apps just fine.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 36
WinWaitActive parameters 12 31
has77  challenge 9 66
tripleUp challenge 7 65
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

763 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

6 Experts available now in Live!

Get 1:1 Help Now