Forum: Ruby Copy-on-write

50693e54d5961e805d2fcec1d2ac3677?d=identicon&s=25 Ken Paul (kenfc)
on 2013-03-18 16:43
Hi,

If a process is forked on Linux, which version of ruby is implemented
with the copy-on-write technique?
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (robert_k78)
on 2013-03-18 17:04
(Received via mailing list)
On Mon, Mar 18, 2013 at 4:43 PM, Ken Paul <lists@ruby-forum.com> wrote:
> If a process is forked on Linux, which version of ruby is implemented
> with the copy-on-write technique?

It sounds as if you were mixing OS and Ruby features.  If the OS
implements this *all* processes benefit from it - regardless of
implementation.

Kind regards

robert
0dfd10ad198ae5a87640da046a77a90a?d=identicon&s=25 Robert Jackson (Guest)
on 2013-03-18 18:13
(Received via mailing list)
On Mar 18, 2013, at 12:03 PM, Robert Klemme <shortcutter@googlemail.com>
wrote:

> It sounds as if you were mixing OS and Ruby features.  If the OS
> implements this *all* processes benefit from it - regardless of
> implementation.

True, but ruby's garbage collector up until 2.0.0-p0 used a mark and
sweep algorithm that completely obviated the capability of COW friendly
OS's (because every object was 'written' during each GC run).

In 2.0.0-p0 the garbage collector is implemented in such a way as to
allow copy on write.

Links:

*
http://patshaughnessy.net/2012/3/23/why-you-should...
* http://benhoskin.gs/2013/02/24/getting-to-know-ruby-2-0
*
https://blog.heroku.com/archives/2013/3/6/matz_hig...
E0d864d9677f3c1482a20152b7cac0e2?d=identicon&s=25 Robert Klemme (robert_k78)
on 2013-03-18 18:33
(Received via mailing list)
On Mon, Mar 18, 2013 at 6:13 PM, Robert Jackson
<robert.w.jackson@me.com> wrote:
>
> On Mar 18, 2013, at 12:03 PM, Robert Klemme <shortcutter@googlemail.com> wrote:
>
>> It sounds as if you were mixing OS and Ruby features.  If the OS
>> implements this *all* processes benefit from it - regardless of
>> implementation.
>
> True, but ruby's garbage collector up until 2.0.0-p0 used a mark and sweep
algorithm that completely obviated the capability of COW friendly OS's (because
every object was 'written' during each GC run).

Good point!  Maybe Ken was actually wondering about copy on write
friendly Ruby implementations even though the question sounded
different.

> In 2.0.0-p0 the garbage collector is implemented in such a way as to allow copy
on write.

Well, pre 2.0 GC does not prevent copy on write - actually it makes
heavy use of copy on write. :-)  I'd rather say that 2.0 GC is "copy
on write friendly" by reducing the amount of memory written during GC
runs.

> Links:
>
> *
http://patshaughnessy.net/2012/3/23/why-you-should...
> * http://benhoskin.gs/2013/02/24/getting-to-know-ruby-2-0
> * https://blog.heroku.com/archives/2013/3/6/matz_hig...

Thanks for those links (especially the first one), Robert!

Kind regards

robert
87e61e351b823e19b4a62a896d2af0d4?d=identicon&s=25 Henry Maddocks (Guest)
on 2013-03-18 22:03
(Received via mailing list)
On 19/03/2013, at 4:43 AM, Ken Paul <lists@ruby-forum.com> wrote:

> Hi,
>
> If a process is forked on Linux, which version of ruby is implemented
> with the copy-on-write technique?

2.0
1.8.6 REE
1.8.7 REE

Henry
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.