Is there a way to run both the front end(& kernel) locally while the having Mathematica's filesystem(inode's at minimum) reference another os's filesystem?

For example currently I run Mathematica in Ubuntu, but I constantly have issues with Mathematica freezing. Could I run Mathematica inside Windows while running ubuntu in a virtual machine(or remotely) so I could still effectively interface with the linux OS(read and write calls at minimum).

Although this is less the ideal, I am hopeful there might be some simple configs to modify.

Ideally I am looking for a way to run a Mathematica Notebook both on a virtual machine OS(linux in the case) and the host OS(Windows in this case) but have the code interact as if it was running on the hosted OS. Considering there are a lot of different types of software that allows you to create virtual machines, let's assume for this question(unless a better idea is stated) that I am using either port forwarding or a bridge adapter and shared folders in Virtualbox as a way of communication.

  • $\begingroup$ I think this is not really a Mathematica question. I'd suggest asking on other sites (SuperUser?) about how to access files on another machine, in general. I'm sure there's a workable solution to this (which is independent of Mathematica) and you'll find more expertise on the topic elsewhere. $\endgroup$
    – Szabolcs
    Nov 16, 2013 at 1:38
  • $\begingroup$ @Szabolcs (I just finished adding this to the answer) Virtualbox supports both file sharing and port forwarding natively. Would it be more suited for me ask what functions depend on the OS uniquely? The biggest issue is dealing with inode's and other function like compile which really shouldn't be using Windows executables but Linux executables in the OS Virtual Machine. $\endgroup$
    – William
    Nov 16, 2013 at 1:43
  • $\begingroup$ That sounds like a different question ... Compile must use the compiler on the same machine where the kernel is running, otherwise the kernel can't possibly load the created library. If Compile is the main reason you want Linux: MinGW's gcc works fine with it and it's free. The Visual Studio compiler is also available for free (you don't even need to install the IDE, just the command line tools). $\endgroup$
    – Szabolcs
    Nov 16, 2013 at 1:51
  • $\begingroup$ @Szabolcs in some ways I am asking this question because I am not entirely sure about the viability of accessing/communicating w/ OS alternative to where Mathematica's kernel is running. I don't know enough about dynamic libraries .so (I believe are what they are called in Linux) to really know if I can compile them in Windows and run them in Linux or whatever combination which is needed. I do currently have Visual Studio and gcc(in cygwin installed). I won't be able load dynamic libraries(those running in the Virtual OS) to be loaded into the M kernel, but emulation might be possible. $\endgroup$
    – William
    Nov 16, 2013 at 2:07

1 Answer 1


Why not simply launch another kernel in your Ubuntu session, but not as your main kernel, but a slave. In fact, if you cannot connect to it (it crashed), your main one can always re-spawn it. And the sole purpose of that kernel would be to run file system calls and return results.

You can do it through lightweight grid, but that's probably more complex than you need to, a simple "remote kernel" connection with MathLink will do. Especially since it doesn't sound like you need to share variables, only the results of calls. Here's the reference: Running Programs on Remote Computers

You can also write a service that starts the kernel and the default action on service failure is to re-start... or create a scheduled item to re-run the kernel regularly, but obviously the license limitation will cause it to fail if another kernel is already running, thus ensuring that only one instance is always running.

Another option, which I'm not sure if it'll work, but would be super cool if it would. Run R on Ubuntu and use RLink to get yo9ur data from R on linux to Mathematica in Windows.

Hope this helps.

P.S.: Check various drivers and configurations as well as run and memtest to determine if there's a system-based source of crashes, and if MathKernel is really crashing or maybe it's Java VM.

  • $\begingroup$ To keep with stackexchange's guidelines of posting self contained examples do you mind posting a/the working example? I am not really certain what fprog refers to in the example you linked to, but a short explanation would be helpful. $\endgroup$
    – William
    Nov 22, 2013 at 3:32
  • $\begingroup$ Liam, I'd love to, but this is more about setting up and running remote kernels, not actual code to connect (which is already listed in the link I provided). fprog is any MathLink compatible program, or in your case mathkernel. You can learn more about parameters to start a kernel on a remote machine and to connect to it in Kernel Configuration option in your Evaluation menu in Mathematica. I use java on windows to launch mathssh (jar comes with mathematica installation) to launch a remote kernel. My parameters are: -LinkMode Listen -LinkProtocol TCPIP -LinkOptions MLDontInteract $\endgroup$ Nov 22, 2013 at 16:43
  • 1
    $\begingroup$ You can create a remote evaluation kernel, programmatically create a new notebook, whose evaluator is set to that remote kernel, and use that notebook to run your remote filesystem commands, get answers back, then dispose of the notebook object. groups.google.com/forum/#!topic/comp.soft-sys.math.mathematica/… $\endgroup$ Nov 22, 2013 at 16:46
  • $\begingroup$ reference.wolfram.com/legacy/applications/parallel/Tutorial/… $\endgroup$ Nov 22, 2013 at 16:47
  • $\begingroup$ reference.wolfram.com/mathematica/ParallelTools/tutorial/… $\endgroup$ Nov 22, 2013 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.