469,287 Members | 2,646 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

- any ideas how to do this efficiently?

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

Best regards,
Jul 18 '05 #1
0 905

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by David | last post: by
12 posts views Thread by Anthony Greene | last post: by
2 posts views Thread by alexander.stippler | last post: by
31 posts views Thread by krypto.wizard | last post: by
224 posts views Thread by Jon Slaughter | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.