<br><br><div class="gmail_quote">On Tue, Jun 28, 2011 at 9:41 AM, Andrew Brunner <span dir="ltr"><<a href="mailto:andrew.t.brunner@gmail.com">andrew.t.brunner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2011/6/27 Malcom Haak <<a href="mailto:insanemal@gmail.com">insanemal@gmail.com</a>>:<br>
<div class="im">> Tell me then why any of what you have said is relevant. In fact in cases<br>
> this this the use of CriticalSections would be sensible and would not cause<br>
> 'tons of wait' as you have all your worker threads off doing things 99% of<br>
> the time.<br>
<br></div></blockquote><div>Firstly, I was referring to my example</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">
</div>Thread 1:<br>
a=b+c<br>
a2=a+c2<br>
SignalEvent(E1)<br>
<br></blockquote><div>This will run in 1 thread.. if you use local variables this is fine. if you were using global variables you are an idiot.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thread 2:<br>
repeat<br>
WaitForEvent(E1,120);<br>
We can read anything now<br>
until terminated or complete<br> </blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
This the prime example. On a 6 core system a looks like one value to<br>
one core than it does to another core. It's that simple. No getting<br>
around this issue.<br>
<br></blockquote><div>OF WHAT? bad code? It would only look different if you are looking at different parts of memory.. or you hadn't finished writing. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
While spinlocks can block a entrance - it cannot guarantee memory<br>
order / code execution order. Therefore it is good practice to adopt<br>
interlocked assignments to guarantee memory is what it is.<br>
<br></blockquote><div>Also what the hell are you on about? You could use CriticalSections in your example and it would work fine. The fact you have one Thread doing nothing for ever is a tad silly and to me shows you have no idea what you are doing.. but that could be just because of the exceedingly limited scope of the example.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Core X computes a=b+c<br>
Core X+Y computes a2<br>
<br></blockquote><div>Why would you spilt this into different threads??</div><div>If it is the same thread it does not matter if it moves CPU... </div><div>Your example is lacking in sanity. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
This is relatively new theory which required low-level CPU code to<br>
perform such locks. This was never needed until the introduction of<br>
multi-core systems. Of which I did extensive tests on AMD via<br>
FPC/Lazarus.<br>
<div><div></div><div class="h5"><br></div></div></blockquote><div>Yeah your just sounding silly here. As per Reimar Grabowski's comment, whats the difference between multi-core and Multi-processor?</div><div>I'll tell you... accessibility to people who don't know what they are on about. </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div class="h5">
--<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a><br>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</div></div></blockquote></div><br>