Which scripting languages support multi-core programming?

Ludwig Weinzierl picture Ludwig Weinzierl · Jun 16, 2009 · Viewed 9.4k times · Source

I have written a little python application and here you can see how Task Manager looks during a typical run.
(source: weinzierl.name)

While the application is perfectly multithreaded, unsurprisingly it uses only one CPU core. Regardless of the fact that most modern scripting languages support multithreading, scripts can run on one CPU core only.

Ruby, Python, Lua, PHP all can only run on a single core. Even Erlang, which is said to be especially good for concurrent programming, is affected.

Is there a scripting language that has built in support for threads that are not confined to a single core?

WRAP UP

Answers were not quite what I expected, but the TCL answer comes close. I'd like to add perl, which (much like TCL) has interpreter-based threads.

Jython, IronPython and Groovy fall under the umbrella of combining a proven language with the proven virtual machine of another language. Thanks for your hints in this direction.

I chose Aiden Bell's answer as Accepted Answer. He does not suggest a particular language but his remark was most insightful to me.

Answer

simon picture simon · Jun 16, 2009

You seem use a definition of "scripting language" that may raise a few eyebrows, and I don't know what that implies about your other requirements.

Anyway, have you considered TCL? It will do what you want, I believe.

Since you are including fairly general purpose languages in your list, I don't know how heavy an implementation is acceptable to you. I'd be surprised if one of the zillion Scheme implementations doesn't to native threads, but off the top of my head, I can only remember the MzScheme used to but I seem to remember support was dropped. Certainly some of the Common LISP implementations do this well. If Embeddable Common Lisp (ECL) does, it might work for you. I don't use it though so I'm not sure what the state of it's threading support is, and this may of course depend on platform.

Update Also, if I recall correctly, GHC Haskell doesn't do quite what you are asking, but may do effectively what you want since, again, as I recall, it will spin of a native thread per core or so and then run its threads across those....