caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Wang <philippe.wang@lip6.fr>
To: Pascal Cuoq <Pascal.Cuoq@cea.fr>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] OC4MC : OCaml for Multicore architectures
Date: Thu, 24 Sep 2009 18:30:56 +0200	[thread overview]
Message-ID: <95394D43-BA68-4BCE-9151-55EC22C42742@lip6.fr> (raw)
In-Reply-To: <5D7DF789-5EE6-4432-92A2-673F2D02FCD7@cea.fr>



On Sep 24, 2009, at 18:02 GMT+02:00, Pascal Cuoq wrote:

> On Sep 24, 2009, at 5:47 PM, Philippe Wang wrote:
>
>>> Is the copy operation parallelized?
>>
>> Nope. When the world is stopped for the collection, everything is  
>> done
>> sequentially until the world is resumed.
>> I don't think it's relevant to parallelize the copy operation (hell  
>> to
>> implement&debug, then I don't think that performance would be very
>> interesting because we would probably need a write mutex on the
>> destination heap)
>
> Well, you could start copying to the bottom of the next heap with
> one thread going up and to the top of it with another going down.
> Assume optimistically that the two threads will not reach the same
> cacheline at the end of the copies, and you don't need any
> synchronisation at all between them, except joining at the end.
>
> After checking, if they have reached the same cacheline,
> you need to reallocate the destination heap anyway.
>
> You still get a single unfragmented free block as a result.
>
> Even better: stop the world just before there remains less that one
> cacheline of free space and you don't need to check if the two  
> threads have
> met. You still need to reallocate the destination heap sometimes  
> though.

A concurrent copy means that there would be bad overhead for single  
core. It also means putting bottleneck to memory bandwidth as memory  
copy operations are clearly quickly limited by this bandwidth, not by  
CPU. It may hopefully become false in a few years, but hardware  
manufacturers don't seem to be excited by that, they seem to prefer  
making the marketing on the number of cores. Look at GPUs : they have  
very fast graphical RAM, but they have a huge number of processing  
units. I don't really see the point in that (i.e. having a huge number  
of PU) anyway (except "marketing").

Ok, back to GC stuff. A stop&copy algorithm needs to have a set of  
roots to make the copy of living values.
Each thread has its stack, so it has its subset of roots. Then what ?  
Parallelize the copy from each thread ? Ok we have to determine the  
best number of threads according to number of cores but more  
importantly according to memory bandwidth given per core. (what a  
nightmare!)
Then there are shared values (in the shared heap for instance, but  
what if there are lateral pointers due to mutable values?). (We are  
leaving the nightmare for hell! but some people have been there.)  
Copying a living value means that if later you encounter something  
pointing to its old address, you have to know the new one. This means  
writing at the old address. I don't see how we can make *today*  
something very interesting in concurrent with a stop&copy algorithm. I  
believe (but I'm *not* a GC expert at all) concurrent GCs are not  
based on stop&copy algorithm but rather some mark&{do-some-stuff-such- 
as-"sweep"}.


> Oh, and I meant to say, but everyone else was faster than me:
> well done!

Thank you, and thanks everyone else who appreciate this work. :-)

Philippe Wang


  reply	other threads:[~2009-09-24 16:31 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090924154716.BCD0ABC5A@yquem.inria.fr>
2009-09-24 16:02 ` Pascal Cuoq
2009-09-24 16:30   ` Philippe Wang [this message]
2009-09-22 21:30 Philippe Wang
2009-09-23 10:53 ` [Caml-list] " Goswin von Brederlow
2009-09-23 12:21   ` Jon Harrop
2009-09-23 13:00     ` Jon Harrop
2009-09-23 14:26       ` Philippe Wang
2009-09-24  0:21   ` Jon Harrop
2009-09-23 23:15     ` Philippe Wang
2009-09-24  0:05       ` Jon Harrop
2009-09-24  0:01         ` Philippe Wang
2009-09-24  1:47           ` Jon Harrop
2009-09-24  9:49             ` Richard Jones
2009-09-24 10:00               ` rixed
2009-09-24 10:40               ` Florian Hars
2009-09-24 11:45               ` Jon Harrop
2009-09-24 10:00             ` kcheung
2009-09-24 11:52               ` Jon Harrop
2009-09-24 11:55                 ` Rakotomandimby Mihamina
2009-09-24 12:11                 ` rixed
2009-09-24 15:58                   ` Jon Harrop
2009-09-24 12:39                 ` Stefano Zacchiroli
2009-09-24 13:09                   ` Jon Harrop
2009-09-24 16:49                     ` Richard Jones
2009-09-24 16:56                       ` Philippe Wang
2009-09-24 17:36                         ` Richard Jones
2009-09-24 19:39                         ` rixed
2009-09-24 21:09                       ` Jon Harrop
2009-09-24 21:26                         ` rixed
2009-09-25  4:07                         ` Jacques Garrigue
2009-09-25  7:32                           ` Hugo Ferreira
2009-09-25 10:17                             ` Jon Harrop
2009-09-25 13:04                               ` kcheung
2009-09-25 21:39                             ` Gerd Stolpmann
2009-09-25  9:33                           ` Philippe Wang
2009-09-25 21:39                           ` Jon Harrop
2009-09-26 16:55                             ` Jon Harrop
2009-09-25  8:08                         ` Stéphane Glondu
2009-09-25 15:05                     ` Xavier Leroy
2009-09-25 23:26                       ` Benjamin Canou
2009-09-26  0:45                         ` kcheung
2009-09-26  1:53                           ` Jon Harrop
2009-09-26 13:51                             ` kcheung
2009-09-26 14:46                               ` Jon Harrop
2009-10-10  4:01                         ` Jon Harrop
2009-09-24 13:40                   ` Rakotomandimby Mihamina
2009-09-24 14:22                     ` Philippe Wang
2009-09-24 14:49                     ` Stefano Zacchiroli
2009-09-24 13:55                   ` Mike Lin
2009-09-24 14:52                     ` Stefano Zacchiroli
2009-09-24 15:36                 ` Philippe Wang
2009-09-24 15:50                   ` Jon Harrop
2009-09-24 12:14             ` Philippe Wang
2009-09-24 13:11               ` Jon Harrop
2009-09-24 14:51                 ` Philippe Wang
2009-09-24 14:57       ` Philippe Wang
2009-09-24 14:11 ` Dario Teixeira
2009-09-24 14:38   ` Philippe Wang
2009-09-24 15:20     ` Dario Teixeira
2009-09-24 23:28     ` Jon Harrop
2009-09-24 23:25       ` Philippe Wang
2009-09-25 14:11       ` Philippe Wang
2009-11-08 18:12       ` Jon Harrop
2009-09-24 18:24 ` David Teller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95394D43-BA68-4BCE-9151-55EC22C42742@lip6.fr \
    --to=philippe.wang@lip6.fr \
    --cc=Pascal.Cuoq@cea.fr \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).