From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.user,gmane.comp.gnu.guix.user Subject: Re: Introducing GNUPaste (and guile-wiredtiger future) Date: Mon, 18 Dec 2017 10:06:25 +0100 Message-ID: <876094s8vi.fsf@igalia.com> References: <11c569c155672a6da5fce60c67b358f4@hypermove.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1513587912 13202 195.159.176.226 (18 Dec 2017 09:05:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Dec 2017 09:05:12 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) Cc: Kristofer Buffington , guile-user@gnu.org, help-guix@gnu.org, Help-Guix To: Amirouche Boubekki Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Dec 18 10:05:08 2017 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQrM6-0002fQ-GJ for guile-user@m.gmane.org; Mon, 18 Dec 2017 10:05:02 +0100 Original-Received: from localhost ([::1]:57350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQrO3-0003NX-Qy for guile-user@m.gmane.org; Mon, 18 Dec 2017 04:07:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQrNe-0003NP-PS for guile-user@gnu.org; Mon, 18 Dec 2017 04:06:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQrNb-0003N4-Kr for guile-user@gnu.org; Mon, 18 Dec 2017 04:06:38 -0500 Original-Received: from pb-sasl2.pobox.com ([64.147.108.67]:56963 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eQrNb-0003Kl-D6; Mon, 18 Dec 2017 04:06:35 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id D1722AA819; Mon, 18 Dec 2017 04:06:32 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=gb1raFMSANcx7Kl2LF6df0lB3fQ=; b=smYe06 1dEKZuHdZRUaaUGnNWPhe0Hfu6FNJVLNwAY5sm4PDc4iwtj0IazPEyTr62PhwmZz G8Ukv1C979Hns6NwdbeEqQ9yr7CpYJ0TPzTXNSm2x7yA18WfCqM+iZR56d3TI9En KPnkCYBunN+fhuSXd7SVEzL0HbRdbqxVpki6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=fZdy2XjFRUuULd79eT2GZkPnEhNc+tz3 SKR+FxJVksbphXqjFZU67GKVMoKsfCI4l4bEcVv00pY69JQMGqYwES12txj47tCb 0xZ0fn4u/Hu/SIeaYBDJ6jYwcna5H1FeIk9unes38PDSvcITbb3nL6u9UYPzidfr Fy/2qDAdHmk= Original-Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id B9123AA817; Mon, 18 Dec 2017 04:06:32 -0500 (EST) Original-Received: from rusty (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 0C297AA816; Mon, 18 Dec 2017 04:06:31 -0500 (EST) In-Reply-To: <11c569c155672a6da5fce60c67b358f4@hypermove.net> (Amirouche Boubekki's message of "Sun, 17 Dec 2017 15:39:52 +0100") X-Pobox-Relay-ID: BD9AC5EC-E3D2-11E7-858E-EA54894C8D7C-02397024!pb-sasl2.pobox.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.108.67 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:14382 gmane.comp.gnu.guix.user:2780 Archived-At: On Sun 17 Dec 2017 15:39, Amirouche Boubekki writes: > Basically, guile-wiredtiger is not compatible yet with fiber > in the general case, because fiber will spawn several threads > and several fibers in each thread (and I think that fibers > can be stolen by other threads but I am not sure). Note that it's possible to run fibers with only one kernel thread. See the docs. Also note that in fibers (and indeed in Guile threads), a newly spawned fiber (or thread) inherits the fluid values that were current when the thread was spawned. Fluid values in other fibers or threads are unaffected. Anyway I reply to offer some more general notes :) If what you need is sequential access to a database, you can arrange to access the database from a single fiber. That fiber can communicate with others via channels (for example). If the fiber migrates to another threads, that usually doesn't matter -- it's as if a kernel thread migrated to a different CPU. The memory model of Guile and fibers ensures that there will be no problems. You do end up having to route database requests to that fiber, usually via messages over channels, but that can be OK -- see https://blog.acolyer.org/2017/12/04/ffwd-delegation-is-much-faster-than-you-think/. Sometimes though you need real thread affinity between some external resource and a fiber. In that case the usual solution is to spawn a thread instead of a fiber, and access the resource only in that thread. You can still use channels to communicate between that thread and other fibers running on your system, if that's what you want. Cheers, Andy