Go Back   ZeroC Forums > Comments

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 10-17-2006
rc_hz rc_hz is offline
Registered User
 
Name: Eric RC
Organization: www.genband.com
Project: No project yet
 
Join Date: Jul 2004
Location: Hangzhou, China
Posts: 189
Send a message via MSN to rc_hz
-->
IcePy and The global interpreter lock

As we know, python has the concept of global interpreter lock(GIL), that is, only one thread can be really running in the python virtual machine at any point in time. Python threads must acquire a single shared lock (GIL) when they are ready to run, and each thread may be swapped out after running for a set number of virtual machine instructions. So python threads have a bad reputation of performance because they can not really run concurrently.

For IcePy, its threads or thread pools comes from Ice.so written by C++. Does it have the constrait of GIL ?

For example, this is a simple slice file:
Code:
module Demo
{

    interface Printer
    {
	void printString(string s);
    };

};
This is the server implementation:
Code:
class PrinterI(Demo.Printer):
	def printString(self, s, current=None):
		print s
		# there are many other computation to do
		# ...
Suppose Ice.ThreadPool.Server.Size=5 and there are 5 clients send request to the server simultaneously, how does GIL play its role ? Are there any principles ?
__________________
Eric RC
www.genband.com (telecommunication)
I like ICE (Ice for C++/Java/Python)

Last edited by rc_hz : 10-17-2006 at 10:41 AM.
Reply With Quote
  #2 (permalink)  
Old 10-17-2006
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 971
Hi,

The GIL affects server-side dispatch too. The C++ Ice run time does as much as it can in the available native threads, such as accepting new connections, unmarshaling requests and sending replies. However, eventually it must call into the Python interpreter to dispatch the request to the servant, and only one thread at a time can be active in the interpreter. If this poses a serious problem, you should write your server in another language.

Take care,
- Mark
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
visual Studio & ice 3.0 & Global Assembly Cache loheron Help Center 7 11-23-2006 08:39 AM
IcePy and shutdown alexm Help Center 6 04-20-2006 11:59 PM
boost::condiition lock Problem ipek Help Center 4 03-10-2006 03:31 PM
about icepy.py code Help Center 2 06-12-2005 04:26 PM
IcePy on AIX? zephyr007 Help Center 1 03-11-2005 04:17 AM


All times are GMT -4. The time now is 04:26 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.