In order to make my computations faster I have developed a C/C++ application calling Mathematica kernel and performing many operations using Mathematica functions for equation solving.
Now I want to use multithreading and in particular I plan on taking advantage of the Posix library in order to do so (
pthread). But how does the link behaves when many threads insist on it?
I guess that being a buffered/packet approach, if two threads try to send stuff to the same link without a mutex in guard (of the link), everything is a mess.
SO I should create as many links as many threads I create. So here my questions:
- Is there a limit to the number of links I can create to MathLink?
- Is there a way to perform parallel activities on the Mathematica kernel in an automated way? I know about the parallel core of Mathematica, but what happens when I am interfacing to Mathematica through MathLink from C/C++?