tag:blogger.com,1999:blog-2319831394620195922.post385774189998265520..comments2026-04-21T12:55:52.832+01:00Comments on Rational Java: Let's pause for a MicrosecondAnonymoushttp://www.blogger.com/profile/09391434492829452178noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-2319831394620195922.post-38545565120014007702019-03-13T12:59:44.499+00:002019-03-13T12:59:44.499+00:00Get the most updated CompTIA Network+ 2018 exam du...Get the most updated CompTIA Network+ 2018 exam dumps, questions and answers and practice test from myexamcollection. Prepare for Actual N10-007 CompTIA Network+ 2018 exam efficiently and free of charge. Download the valid <a href="https://www.myexamcollection.com/N10-007-vce-questions.htm" rel="nofollow">N10-007 exam questions</a>damionhttps://www.blogger.com/profile/07903889806260277551noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-64131532643355488832017-11-22T07:59:39.272+00:002017-11-22T07:59:39.272+00:00Download auto forward spy here, mate!Download <a href="https://topspying.com/autoforward" rel="nofollow">auto forward spy here</a>, mate!Robert Welainhttps://www.blogger.com/profile/10587031495938313347noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-43435133640503771612015-11-03T14:22:46.397+00:002015-11-03T14:22:46.397+00:00Yes you are correct there will be a difference acr...Yes you are correct there will be a difference across OS and hardware. My timings were on a MBP when connected to the mains (strange things happen when on battery). The point of my article however I do think holds true.Anonymoushttps://www.blogger.com/profile/09391434492829452178noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-78152910841068997972015-11-03T14:15:49.966+00:002015-11-03T14:15:49.966+00:00I always thought Thread.Sleep accurracy was highly...I always thought Thread.Sleep accurracy was highly dependent on the OS and versions of Windows in particular historically (/for instance) could show some wild variation (unless you played with some settings around hr timers). Which OS did you test ? Linux ?Anonymoushttps://www.blogger.com/profile/06381722905422792737noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-64395801051732909722015-11-02T05:17:21.235+00:002015-11-02T05:17:21.235+00:00Thanks, nice postThanks, nice postBinh Nguyenhttps://www.blogger.com/profile/02069417158952884749noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-16209610497441904302015-10-30T12:32:55.578+00:002015-10-30T12:32:55.578+00:00Thread.yield() takes ~0.3us - the equivalent of 7 ...Thread.yield() takes ~0.3us - the equivalent of 7 calls to System.nanoTime().<br />Of course I&#39;m averaging the times for calls in tight loop. A single call to Thread.yield() on unwarmed code took ~15us.Anonymoushttps://www.blogger.com/profile/09391434492829452178noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-62531948919193353052015-10-30T10:53:24.701+00:002015-10-30T10:53:24.701+00:00Ok so it is to implement a rate control then. Make...Ok so it is to implement a rate control then. Make sense now.<br />By the way, how Thread.yield behaves in this regard ? (on linux at least)Jean-Philippe Bempelhttps://www.blogger.com/profile/06767056355047105540noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-36875672261118672812015-10-30T09:30:16.266+00:002015-10-30T09:30:16.266+00:00In this case I want to pause a publishing thread e...In this case I want to pause a publishing thread exactly 1us between sending events.Anonymoushttps://www.blogger.com/profile/09391434492829452178noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-11215960312970145612015-10-30T07:37:51.896+00:002015-10-30T07:37:51.896+00:00Well, my point is: Generally if you want to wait ...Well, my point is: <br />Generally if you want to wait it is to relax the system and let other thread progress. In this regard, LockSupport.parkNanos(1) relax pretty well the system. Using a busy wait will not let other thread progress on the core you are running. You can afford that, but, then, I do not see the point to busy waiting for a time period. Usually you want to spin checking a volatile flag indicating data are ready. So between busy waiting for 10us or a basic spinning it makes no difference on the core execution.<br /><br />CheersJean-Philippe Bempelhttps://www.blogger.com/profile/06767056355047105540noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-30740414676199518382015-10-29T21:02:37.552+00:002015-10-29T21:02:37.552+00:00Thank you for this very interesting post.Thank you for this very interesting post.pveentjerhttps://www.blogger.com/profile/17847641595368096163noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-39800751231592389072015-10-29T10:32:06.059+00:002015-10-29T10:32:06.059+00:00Always nice to hear from you! Thanks for typo - fi...Always nice to hear from you!<br />Thanks for typo - fixed.<br />I have no problem with a basic spin loop to achieve the busy wait for my application. Happy to dedicate a CPU to that.<br />Added comparisons for LockSupport.parkNanos(x). As you can see it&#39;s not really useful if you actually want to wait 1us.<br />CheersAnonymoushttps://www.blogger.com/profile/09391434492829452178noreply@blogger.comtag:blogger.com,1999:blog-2319831394620195922.post-76841201726086623262015-10-29T07:23:00.342+00:002015-10-29T07:23:00.342+00:00It is System.nanoTime, not Sustem.nanoSecond. Wha...It is System.nanoTime, not Sustem.nanoSecond.<br /><br />What&#39;s the point to wait 1us or more by executing code ?<br />Let&#39;s burn the core by spinning this is the same thing. I do not think you relax more the system by calling System.nanoTime compared to a basic spin loop.<br />LockSupport.parkNanos(1) seems more efficient to achieve the goal.<br /><br />CheersJean-Philippe Bempelhttps://www.blogger.com/profile/06767056355047105540noreply@blogger.com