MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Multiple threads using Mathlink

  • To: mathgroup at
  • Subject: [mg88775] Multiple threads using Mathlink
  • From: Paweł Banasik <p.banasik at>
  • Date: Fri, 16 May 2008 05:32:16 -0400 (EDT)


I have a question regarding multithreaded access to Mathematica via MathLink.

I'm developing a set of webservices for use with the Taverna Workbench 
(, a computational biology tool. These webservices 
call Mathematica to perform some computations. Obviously, each webservice 
invocation creates a new thread. As I'd like the Mathematica environments 
belonging to different threads to be completely separated one from another, 
I've implemented a mechanism which creates a new MathLink object for every 
thread. Unfortunately, this leads to serious problems, including an 
application service crash, occuring from time to time. Apparently, this is 
some kind of a concurrent access problem - it doesn't happen when I run only 
one thread at a time, with subsequent invocations separated by a few seconds.

Perhaps there is a problem with my understanding of the relation between 
MathLink and Mathematica kernels? Is it true that each Mathlink object 
creates a separate kernel process? If not, how to achieve such behavior? Do 
the MathLink native libraries support multithreading?

Thank you for your help,
Pawel Banasik

  • Prev by Date: Re: Applying the Integration Function to a List Of Regions
  • Next by Date: Problem with cell brackets and Manipulate
  • Previous by thread: Re: DSolve question
  • Next by thread: Re: Multiple threads using Mathlink