<br><br><div class="gmail_quote">On Mon, Sep 21, 2009 at 2:55 PM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
2009/9/21 John M McIntosh <<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>>:<br>
<div class="im">><br>
> Er, did we reach a consensus about what to do?<br>
><br>
> My problem is determining what is best based on some the code concepts given<br>
> (which people pointed out flaws in, or confusion about).<br>
> and the premise they work all the same on different hardware platforms<br>
> intel, powerpc, arm, which I'm not sure about.<br>
><br>
> Perhaps a more heavy weight, platform dependent solution using the generic<br>
> acceptable locking logic is required.<br>
><br>
</div>+1. As i mentioned before, it would be nice to extend the platform<br>
API, which VM could use<br>
to deal with multithreading.<br>
And platforms which have no threading support could simply do nothing<br>
in these functions.<br>
<div class="im"><br>
> Er like<br>
> acquireTheHostPlatformIndexedSemaphoreLock()<br>
> {Do what ever is required to remember the semaphore index so that<br>
> checkForInterrupts can find it, a queue perhaps?<br>
> releaseTheHostPlatformIndexSemaphoreLock()<br>
><br>
> I'd keep in mind<br>
><br>
> (a) How many times do we execute the signalExternalSemaphore logic per<br>
> seconds, and<br>
> (b) if someone want to do this a million times a second I think they can do<br>
> their own "exotic" solution via overriding<br>
> acquireTheHostPlatformIndexedSemaphoreLock &<br>
> releaseTheHostPlatformIndexSemaphoreLock<br>
> (c) keep it simple so I don't have to worry how it works on powerpc, intel,<br>
> and arm.<br>
><br>
> acquireTheHostPlatformIndexedSemaphoreLock/releaseTheHostPlatformIndexSemaphoreLock<br>
> Obviously I'd just throw myself on the evil pthread solution.<br>
><br>
><br>
> Would we do a linked list, or queue for the semaphores, versus that fixed<br>
> size list? A size I picked based on exploring network interrupt value rates<br>
> on a mind numbling 200Mhz powerpc machine?<br>
><br>
<br>
</div>My own experience is following:<br>
- i implemented a shared queue to use in Hydra based on atomic xchg<br>
available on Intel<br>
platforms. It worked well, until i had chance to run Hydra on a<br>
multicore PC, where it failed<br>
just after a few seconds of running the VM, causing VM to freeze infinitely.<br>
Obviously, because implementation was wrong :)<br>
The moral of it that, its not a question, how often we need the<br>
synchronization between threads,<br>
but how correct it is :)<br></blockquote><div><br></div><div>The correct use of mfence & sfence around the XCHGs are essential for it to work on multi-core.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
><br>
> On 2009-09-20, at 7:00 PM, Igor Stasenko wrote:<br>
>><br>
><br>
> --<br>
> ===========================================================================<br>
> John M. McIntosh <<a href="mailto:johnmci@smalltalkconsulting.com">johnmci@smalltalkconsulting.com</a>> Twitter: squeaker68882<br>
> Corporate Smalltalk Consulting Ltd. <a href="http://www.smalltalkconsulting.com" target="_blank">http://www.smalltalkconsulting.com</a><br>
> ===========================================================================<br>
><br>
><br>
><br>
><br>
><br>
<br>
<br>
<br>
</div>--<br>
<div><div></div><div class="h5">Best regards,<br>
Igor Stasenko AKA sig.<br>
</div></div></blockquote></div><br>