Hi,

I think you are expecting outputs from distinct places to show in order.
There is no such guarantee.

You code guarantees that Console.OUT.println(...) in phase A at place 1
will happen before Console.OUT.printn(...) in phase B at place 0.
But the messages may appear on the console in a different order (as they
take time to travel across places).

Olivier



From:   Andreas Zwinkau <zwin...@kit.edu>
To:     x10-users@lists.sourceforge.net,
Date:   05/04/2012 03:07 AM
Subject:        [X10-users] Clock bug?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The following program is not synchronized as I expect it to be:

public class Clockbug {
  public static def main(args: Array[String]) {
    val runs = 7;
    clocked finish {
      for (place in Place.places())  at (place) {
        clocked async  {
          for (var i : Int = 0; i < runs; i++) {
            atomic Console.OUT.println("Run "+i+" phase A at place " +
here.id);
            Clock.advanceAll();
            atomic Console.OUT.println("Run "+i+" phase B at place " +
here.id);
            Clock.advanceAll();
}}}}}}

For each iteration i, the "phase A" output should appear before the
"phase B" output. However, I also observe output like this:

$ X10_NPLACES=4 ./a.out
Run 0 phase A at place 2
Run 0 phase A at place 0
Run 0 phase A at place 1
Run 0 phase A at place 3
Run 0 phase B at place 0
Run 0 phase B at place 2
Run 0 phase B at place 1
Run 1 phase A at place 2
Run 0 phase B at place 3
Run 1 phase A at place 0
Run 1 phase A at place 1
Run 1 phase A at place 3
Run 1 phase B at place 2
Run 1 phase B at place 0
Run 1 phase B at place 1
Run 1 phase B at place 3

Apparently, the iterations get mixed up. Is that a bug in Clock?

- --
Andreas Zwinkau

 Karlsruhe Institute of Technology (KIT)
 Institut für Programmstrukturen und Datenorganisation (IPD)
 Lehrstuhl Prof. Snelting
 Adenauerring 20a
 76131 Karlsruhe

 Phone:  +49 721 608 48351
 Fax:    +49 721 608 48457
 Email:  zwin...@kit.edu
 Web:    http://pp.info.uni-karlsruhe.de/person.php?id=107

 KIT – University of the State of Baden-Wuerttemberg and
 National Research Center of the Helmholtz Association
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPo4AhAAoJEKm3M8a3pi2iP34H/2/qS2QQ7Xdy3iF1PZVNZ83/
yMKg8K+YZARSiGz+EvN/MWAyHMh10qChWfcoZwhzgTrf9xvGeeN/b2eSCYv0ArcM
k6WdZ+IlWTz1qSZeuLAy5PdmNHpqSb2MO7D7YPK3G+eisq4YOg2KK0gqZsSRvIeI
xaDhTUNEXAX6TwI4cevcDTRrKaFYIbFUdiEslUBBKAlJ33/pjCI0C8UKzGXYXeAQ
IK2CdJIgOsjGuSIHZUFi7iil8TgT3VC+TaBhFTwdpHifuWDHQKsTnL17E+bQhUpr
XG9uD3SOE1nC0J1saJNhYmdTOpX3Lh/LfR244dVnjvqEQeayHhlxszf7IwcFdyc=
=qufe
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------

Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

<<inline: graycol.gif>>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to