Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Thread/process synchronisation

rfvujm
Beginner
403 Views
Hi All,

A general, newbie question: say I'm using a shared memory and multiple threads and processes accessing it. If they implement some very secure data validation (or say I don't care about my app stability), do they need any access synchronisation mechanism at all (e.g. mutex)? Is lack of synchronisation dangerous only for my apps or for an OS as well, eg. two processes accesing the same memory will crash the OS?

Thanks very much in advance for any replies.

Mario
0 Kudos
3 Replies
Dmitry_Vyukov
Valued Contributor I
403 Views
In general, that should not compromise OS security, just like any other application programming error. Think of synchronization errors as of buffer overruns of something similar.

However, I heard of some precedents (can't find references now) of compromising OS security by exploiting data races inside of a kernel. I guess this area (data races baked up by multicore hardware) is a kind of "dark side of The Moon" for now, some time is required to polish all the quirks related to data races in OS kernels.
0 Kudos
jimdempseyatthecove
Honored Contributor III
403 Views
The OS should be rock solid and take anything an application can throw at it (either intended or unintended).Should an application crashan OS, or cause corrupted results, then the OS is buggy. Since you are a newbie, I will assume you are not writing or supporting an OS. Therefore, let's address the issues relating to an application.

You should review the synchronization and interference avoidancefunctions provided by:

the OS
the threading toolkit (e.g. OpenMP, TBB, pthreads, Windows threads, ...)
the run-time system library
tips and tricks gleaned from web searches
inventions of your own

I suggest you begin with OpenMP. The coding samples in OpenMP cover most of the initial concepts you will need to learn about multi-threading programming.

Do this research before you attempt to tackle your application. The time spent runing through the sample programs will save you time and aggravation in conversion of your application.

In a manner similar to general coding design follows bottom-up or top-down, the parallelization effort can follow hot spots-out (bottom-up) or data/function-flow-in (top-down) methodology. The better strategy will depend on your application.

Jim Dempsey
0 Kudos
infotechproximity8
403 Views
.NET 4 offers a default task scheduler for Task Parallel Library and PLINQ. This scheduler uses the improved .NET 4 pool of threads to queue and execute work for tasks and parallelized queries. It is also possible to create a custom scheduler for specific tasks or queries.
______________________________________________________
apartamentos amueblados panama
0 Kudos
Reply