Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

Synchornization with Multiple processors

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
tommyq
Asked:
tommyq
  • 4
  • 4
1 Solution
 
tommyqAuthor Commented:
Edited text of question
0
 
Tommy HuiEngineerCommented:
What problems are you having?
0
 
necfmCommented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
tommyqAuthor Commented:
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
 
necfmCommented:
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
 
tommyqAuthor Commented:
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
 
necfmCommented:
Yes. That's how it works.  This is called asymetric multitasking.

0
 
tommyqAuthor Commented:
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
 
necfmCommented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now