Results 1 to 2 of 2

Thread: IcePy and The global interpreter lock

  1. #1
    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

    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 ?
    Last edited by rc_hz; 10-17-2006 at 09:41 AM.
    Eric RC
    www.genband.com (telecommunication)
    I like ICE (Ice for C++/Java/Python)

  2. #2
    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
    1,441
    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP global $ICE variable not always defined
    By panthaloon in forum Help Center
    Replies: 0
    Last Post: 02-22-2010, 02:29 PM
  2. dead lock
    By jerrylucky in forum Help Center
    Replies: 6
    Last Post: 07-25-2008, 09:08 AM
  3. Timed Lock for Mutex Class
    By kalaxy in forum Patches
    Replies: 5
    Last Post: 03-03-2008, 06:03 PM
  4. IceGrid lock up/unresponsive
    By tctimmeh in forum Help Center
    Replies: 8
    Last Post: 01-18-2008, 04:54 PM
  5. boost::condiition lock Problem
    By ipek in forum Help Center
    Replies: 4
    Last Post: 03-10-2006, 02:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •