From tom@@@k@||ber@ @end|ng |rom gm@||@com  Mon Apr 15 12:12:40 2019
From: tom@@@k@||ber@ @end|ng |rom gm@||@com (Tomas Kalibera)
Date: Mon, 15 Apr 2019 12:12:40 +0200
Subject: [Rd] SUGGESTION: Settings to disable forked processing in R,
 e.g. parallel::mclapply()
In-Reply-To: <CALEXWq0R4Z=Q=BWLiSG-Suag5rYhSVoWfry24_s_ZM-Ahy1CWA@mail.gmail.com>
References: <CAFDcVCSPzMYE9A9V==Gs2yYTuH+YDqWhT_q=WU4AU5JL0WzX=A@mail.gmail.com>
 <CALEXWq3RapiDCTOFUerzxfiawYBu3LFxpCQpYRwmL3MQBh-S4g@mail.gmail.com>
 <CAPLMX9E6rcPNR0MMmaRPRQOBbhopiC43EBDEaHE56tWFGu5ZTQ@mail.gmail.com>
 <CALEXWq2gkuDW48SmGT+YWjn-GmuEjW56bsXj28xTRO=E-tZ48Q@mail.gmail.com>
 <CAPLMX9Fxe1T+npHdkXAzugApuopXN9F+5HgRSk0MyosRngopsw@mail.gmail.com>
 <CAJXgQP1i0EGEmHj2UAqY-H3QnYfspsJ3BkhY8fGE6oOKCb9vnw@mail.gmail.com>
 <CALEXWq2NzM7tLJ4kNTF=D=wKdDFe2xu2nw6mXYbbFJgp9Q1q2g@mail.gmail.com>
 <4a46e1e6-d584-9dc6-1699-973b56c95c98@gmail.com>
 <CALEXWq0R4Z=Q=BWLiSG-Suag5rYhSVoWfry24_s_ZM-Ahy1CWA@mail.gmail.com>
Message-ID: <2a64a85b-97d5-b35e-66e6-3ac2de8b4800@gmail.com>

On 4/15/19 11:02 AM, I?aki Ucar wrote:
> On Mon, 15 Apr 2019 at 08:44, Tomas Kalibera <tomas.kalibera at gmail.com> wrote:
>> On 4/13/19 12:05 PM, I?aki Ucar wrote:
>>> On Sat, 13 Apr 2019 at 03:51, Kevin Ushey <kevinushey at gmail.com> wrote:
>>>> I think it's worth saying that mclapply() works as documented
>>> Mostly, yes. But it says nothing about fork's copy-on-write and memory
>>> overcommitment, and that this means that it may work nicely or fail
>>> spectacularly depending on whether, e.g., you operate on a long
>>> vector.
>> R cannot possibly replicate documentation of the underlying operating
>> systems. It clearly says that fork() is used and readers who may not
>> know what fork() is need to learn it from external sources.
>> Copy-on-write is an elementary property of fork().
> Just to be precise, copy-on-write is an optimization widely deployed
> in most modern *nixes, particularly for the architectures in which R
> usually runs. But it is not an elementary property; it is not even
> possible without an MMU.

Yes, old Unix systems without virtual memory had fork eagerly copying. 
Not relevant today, and certainly not for systems that run R, but indeed 
people interested in OS internals can look elsewhere for more precise 
information.

Tomas



[Rd] SUGGESTION: Settings to disable forked processing in R, e.g. parallel::mclapply()
Tomas Kalibera