By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,813 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,813 IT Pros & Developers. It's quick & easy.

- any ideas how to do this efficiently?

P: n/a
Dear Python fans,

I recently selected Python as scripting engine for our research project.
This implies my beginner experience with Python.

Let me explain the background of the problem I want to solve.

Our research group has designed a formal language for building
special "connectors" which allow one to specify formally and
explicitly the cooperative behavior of some component instances.
We define a component instances as a black box with at least
one live animal (thread/process) inside which can communciate
with the outside environment through special holes we call "channel
ends". The formalism of the language defines the primitives a
component instance can perform on channel ends.

We have built a simulator in C++ for the our language.
We want to design a special type of component instance called
a "scriptbox" which runs a Python script. This week I have
successfully linked CPython to our applciation and have called
Python functions and have let Python functions call back the C++
API of our language (embedding and extending Python at the
same time).

Now, since our simulator can have multiple instances of
script boxes, we would like to have them execute Python scripts
concurrently. I wonder, do you guys have any good idea to
allow concurrent execution of Python scripts, which call back
the C++ API of our language (the simulator will further deal with
synchronization issues internally)?

Yesterday I read about the threading module of Python (basically
Java-like, thus quite familiar) and I think of the following solution:
Using the Python C API for every scriptbox instance I will
instantiate a custom thread object, the run method of which
will evaluate the specific Python script for that scriptbox.
Now, I have read about the limitations of Python threads
concerning their actual paralelism (as compared to OS
processes) and I can live with those. Do you think this will
work?

Best regards,
Nikolay
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.