Subject: python & C++ & threads
From: Otso Makinen (otso@hybrid.fi)
Date: Mon Nov 15 1999 - 21:14:24 EET
After some testing and documentation reading, I have come up with this proposal for the implementation of the server code: first we code most functionality with Python and when things start to work properly we start porting portions of the code to C++. The good thing in this approach is that we can almost freely mix python/C++. We can use python to rapidly test and prototype various systems and then gradually implement them in C++. With python things can be developed a lot faster, but C++ has some important advantages also. In addition to to being faster, C++ is also more stable and allows better 'information hiding' making it much more easy to e.g. prevent monster scripts from crashing the whole server. Python uses a global interpreter lock allowing only one thread at time to actually run python code while other threads are waiting for their turn. This means that Python code cannot take advantage of multiprocessor systems (except in some blocking I/O operations). Thus we have to use C threads running C code in all time consuming operations that can be executed in parallel. However, just calling C functions from Python causes the interpreter to be locked until the function returns, so we must manually handle the unlocking/locking every time we enter/leave C code. Um, I lost my chain of thought while listening to conversation in majik3, but there's some pointers for the direction we're taking in the server development. -- Otso Mäkinen / Majik 3D Project harum@majik3d.org https://majik3d-legacy.org
This archive was generated by hypermail 2b25 : Tue Feb 12 2002 - 00:00:23 EET