473,543 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

- 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 984

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Slash | last post by:
I often do a lot of text-mode programming in Linux and wanted to use colors in text mode, and found the ncurses library needlessly complex for small applications. So I wrote my own little header to handle colors in C++. (The code follows.) This allows me to write code like cout << gotoxy(10, 11) << color(lightcyan, blue) << "some text...
by: adavidso | last post by:
I am a bit of a newbie to python, and would like a little advice on how to more efficiently process arrays. I work a lot with satellite data, and have opened and read two binary images into separate 2-D arrays using numarray.fromfile. What I want to do is is test each pixel in each image for various conditions, and depending on which condition...
by: eyh5 | last post by:
Hi, I'm writing some C codes to run simulations. I'm wondering if there is a website that may contain useful information on how to make one's code run more efficiently and in a computational-time-saving manner. Specifically, what I'd like to know is if there're any useful tips about writing your codes more efficiently. One such useful tip...
by: David | last post by:
I would like to set up a copy protection scheme where the application must be provided with an unlock code before it can be installed. Any ideas for a relatively simply system for doing this ? I seem to remember something like reading PC BIOS, adding the current date and XORING with a fudge factor to create a code that the user rings up and...
by: david ullua | last post by:
Hi, In Expand.c of BSD system, I met the following codes, the expression (column & 07) if used to compare variable column and 7, if column<=7, it returns true, else false. It use (column & 07) rather than (column<=7), thus it brings me a question, does bit operation always work more efficiently than math operation? How about plus without...
by: Anthony Greene | last post by:
Hello, I know this isn't really a python centric question, but I'm seeking help from my fellow python programmers. I've been learning python for the past year and a half, and I still haven't written anything substantial nor have I found an existing project which blows my hair back. Python is my first language, and I plan on learning lisp...
by: alexander.stippler | last post by:
Hi I posted a similar question yesterday ("static polymorphism and Factory pattern"). Now looking at a different aspect: I have one interface, several implementations. How can I choose one relization at run-time EFFICIENTLY? So no virtual function calls and no CRTP (for other reasons). I need just one realization per program run, but...
by: krypto.wizard | last post by:
How to divide a number by 7 efficiently without using - or / operator. We can use the bit operators. I was thinking about bit shift operator but I don't know the correct answer.
by: Jon Slaughter | last post by:
Sorry for all the cross posting but I'm interesting in getting a serious discussion about how usenet has become lately. Many people are moving away from usenet because of all the spam and cooks that have been showing up. The rate of spammer seem to be growing exponentially(ok, not really but it feels like it). I think maybe its time to do...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.