From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: Threads in emacs implementation Date: Thu, 16 Jun 2005 12:25:47 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <4nvf4eqnec.fsf@lifelogs.com> References: <6dbd4d0005060619227dd41364@mail.gmail.com> <87vf4oaft8.fsf@zemdatav.stor.no-ip.org> <4nd5quav0o.fsf@lifelogs.com> <4nll5btxv7.fsf@lifelogs.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1118939136 19269 80.91.229.2 (16 Jun 2005 16:25:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Jun 2005 16:25:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 16 18:25:30 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DixAq-0003TO-JD for ged-emacs-devel@m.gmane.org; Thu, 16 Jun 2005 18:25:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DixGI-00061s-0n for ged-emacs-devel@m.gmane.org; Thu, 16 Jun 2005 12:30:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DixDe-0005D8-Do for emacs-devel@gnu.org; Thu, 16 Jun 2005 12:27:54 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DixDZ-0005AW-Np for emacs-devel@gnu.org; Thu, 16 Jun 2005 12:27:50 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DixDZ-0005AM-JB for emacs-devel@gnu.org; Thu, 16 Jun 2005 12:27:49 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DixEK-0005a3-Uu for emacs-devel@gnu.org; Thu, 16 Jun 2005 12:28:37 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Dix6q-0002ka-Cs for emacs-devel@gnu.org; Thu, 16 Jun 2005 18:20:52 +0200 Original-Received: from asimov.bwh.harvard.edu ([134.174.8.118]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2005 18:20:52 +0200 Original-Received: from tzz by asimov.bwh.harvard.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2005 18:20:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 41 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: asimov.bwh.harvard.edu X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:szQbM0ldfRTPLKD4swwNo+I9iHs= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:38970 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38970 On Thu, 16 Jun 2005, snogglethorpe@gmail.com wrote: On 6/16/05, Ted Zlatanov wrote: >> I'm not sure I understand the problem. Do you mean that if a user >> changes variable A in thread 1, he expects thread 2 to also notice the >> change for certain global variables? That's easy to do, if you >> consider that such global variables are few and far between compared >> to local per-thread variables. > > This is not really true for typical elisp programs -- global variables > (especially buffer-local global variables) are used extremely often, > and in almost every case must be "truly global" (visible in all > threads). At the time of the fork, the thread will pick up all globals. I was talking about important globals that are modified after the fork. At least my experience has been that after you initialize Emacs, it's rare to modify globally important variables unless you are specifically customizing Emacs. By far, I'm not as experienced with Emacs internals and packages as you and many others on this list, so please excuse any dumb suggestions :) > However, if a global variable is let-bound, the let-binding should > of course be thread-local. Yes. Perhaps let-bindings will end up being the only thread-local bindings and the VM will pay the stack penalties RMS mentioned. I just hope it doesn't have to be that way. > My personal feeling is that it may be easiest to simply move to a > deep-binding system for elisp (and ideally use lexical-binding for > local variables), but such a change may be a lot of work given the > myriad special varieties of variable bindings (buffer-local etc). Whatever the path, I'm just excited that others have picked up on the multithreading Emacs idea, and I'll be glad to contribute what I can to the effort. Ted