Solved

Dual Processor Issue

Posted on 2002-06-17
5
288 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
ID: 7083525
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
ID: 7083630
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

863 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

23 Experts available now in Live!

Get 1:1 Help Now