[concurrency-interest] Multi-core testing, help with findings

David Harrigan dharrigan at gmail.com
Tue Dec 12 01:57:02 EST 2006


Hi,

I completely forgot to mention that platform is Linux (Ubuntu 6.10).

Just scanning thru the mail, will read when I get to work...

-=david=-

On 12/12/06, Gregg Wonderly <gregg at cytetech.com> wrote:
>
>
>
> David Holmes wrote:
> > I've assumed the platform is Windows, but if it is linux then that opens
> > other possibilities. The problem can be explained if the busy-wait
> thread
> > doesn't get descheduled (which is easy to test by changing it to not be
> a
> > busy-wait). The issue as to why it doesn't get descheduled is then the
> > interesting part. I suspect an OS scheduling quirk on multi-core, but
> need
> > more information.
>
> >>>>>    private long doIt() {
> >>>>>        long startTime = System.currentTimeMillis();
> >>>>>        for(int i = 0; i < howMany; i++) {
> >>>>>            new Thread(new Worker()).start();
> >>>>>        }
> >>>>>        while(!finished);
> >>>>>        long endTime = System.currentTimeMillis();
> >>>>>        return (endTime - startTime);
> >>>>>
> >>>>>    }
>
> Historically, I've found that busy waits like the above are
> problematic.  I'd go
> along with David's comment/thought and try
>
>         while(!finished) Thread.yield();
>
> or something else to cause it to get descheduled for a whole quanta for
> each
> check rather than busy waiting for a whole quanta which will keep at least
> one
> CPU busy doing nothing productive.
>
> Gregg Wonderly
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20061212/21459caa/attachment.html 


More information about the Concurrency-interest mailing list