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: Mon, 20 Jun 2005 14:04:16 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <4n7jgo3nxb.fsf@lifelogs.com> References: <6dbd4d0005060619227dd41364@mail.gmail.com> <87vf4oaft8.fsf@zemdatav.stor.no-ip.org> <4nd5quav0o.fsf@lifelogs.com> <4nll5btxv7.fsf@lifelogs.com> <4nvf4eqnec.fsf@lifelogs.com> <4nzmtpqdlp.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 1119290510 19558 80.91.229.2 (20 Jun 2005 18:01:50 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2005 18:01:50 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 20 20:01:42 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DkQa8-0005hj-VE for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2005 20:01:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DkQfU-0000Da-7f for ged-emacs-devel@m.gmane.org; Mon, 20 Jun 2005 14:06:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DkQeU-0000Bn-La for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:05:42 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DkQeR-0000Aa-PS for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:05:41 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DkQeR-0000AQ-M7 for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:05:39 -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 1DkQgV-0006gL-UF for emacs-devel@gnu.org; Mon, 20 Jun 2005 14:07:48 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1DkQXa-00057c-NX for emacs-devel@gnu.org; Mon, 20 Jun 2005 19:58:34 +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 ; Mon, 20 Jun 2005 19:58:34 +0200 Original-Received: from tzz by asimov.bwh.harvard.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 20 Jun 2005 19:58:34 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 29 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:M/6b8+TcBjnuH/lE+tjvsVIuO7Y= 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:39185 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39185 On Fri, 17 Jun 2005, rms@gnu.org wrote: > I'm thinking of ways to avoid the stack penalties the other proposals > involve. Could we allow only secondary threads with thread-local > variables and forked copies of globals? > > "Forked copies of globals" would mean copies of the values of > thousands of Lisp symbols. And how would the Lisp interpreter know > whether and where to look for them? It does not seem practical. Don't make copies of the globals then, unless they are modified. If the secondary thread modifies a global, make the copy then (Copy On Write). If the primary thread modifies a global, trigger a copy for every thread of the OLD value (null op if no threads exist). The interpreter would just have to keep a hashtable of hashtables; primary key is the secondary thread ID and the secondary key is the global symbol. When a thread modifies a global, look in the HoH; if the symbol is not in there you create an entry. To get a symbol value in a thread, you do two hashtable lookups; in the primary thread there's no lookups. There should be a way that a thread can send data back to the main thread on request (the main thread asks for the data). Ted