Solved

Synchornization with Multiple processors

Posted on 1998-11-24
9
184 Views
Last Modified: 2013-11-20
Does anybody know about problems with using synchronization objects like CEvent, CSingleObject?
I am having strange problems on a Korean Win NT 4.0 with 4 processors.

Thanks,
Tommy
0
Comment
Question by:tommyq
  • 4
  • 4
9 Comments
 

Author Comment

by:tommyq
ID: 1325244
Edited text of question
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1325245
What problems are you having?
0
 

Expert Comment

by:necfm
ID: 1325246
Tell us for which resource you are using the synchronisation object. Is your application is a multithreaded one? Can you give us the exact scenario?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:tommyq
ID: 1325247
Well, This is a multi theraded application. It uses synchronization objects like: CCriticalSection and mainly CEvent.
My question is regarding two points:
1. One of my customers is running the program on a 4 processor machine - does this make any change?
2. Is it right that if the second time the same thread locks on a critical section MFC will let him go thorugh (because it is the same thread)?

Thanks for your attention,
Tommy
0
 

Accepted Solution

by:
necfm earned 100 total points
ID: 1325248
Hi Tommy,

Ans 1:
There will be no difference/problem with the Kernal objects even when they are run on a multi-processor kernal/machine.  But just note that in the Mutiprocessor case two threads can run at the same instance of time, compared to that of a Single processor case where though threads are said to run parallely there will be only one thread run at any instance of time (Because they are time sliced).

Ans 2:
Yes when the same thread is trying to lock on a critical section (WaitonSingleObject) again, the system will let it proceed.


0
 

Author Comment

by:tommyq
ID: 1325249
necfm,

Is it possible that although my program was not written specifically for the a multi-processor machine, Win NT will take two of my threads who belong to the same process and run them in two different processors?

Thanks,
Tommy

0
 

Expert Comment

by:necfm
ID: 1325250
Yes. That's how it works.  This is called asymetric multitasking.

0
 

Author Comment

by:tommyq
ID: 1325251
So, overall, is ther any specail considearation to take when running an application on a multi-processor environment?
Or maybe if my app is thread safe on one processor it will be safe also on multi-processors?

Thanks,
Tommy
0
 

Expert Comment

by:necfm
ID: 1325252
There is no special consideration in running multithreaded application on a multiprocessor environment.  Try to avoid run time libraries instead use win32 API for example instead of malloc use HeapAlloc with serialization.  If your application is thread safe on one processor it should probably work in multiprocessor environment.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ADO Memory leak with DELPHI 2007 37 181
ORA-01403: no data found 43 101
How to convert MFC::CString to UTF8 wchar_t* 10 211
JQuery serialize and unserialize 8 86
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

809 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