Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #31320

Re: VERY PECULIAR PROBLEM

From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: VERY PECULIAR PROBLEM
Date 2015-03-13 21:40 +0100
Message-ID <cmh09tFt05oU1@mid.individual.net> (permalink)
References <f9da1c67-a91e-4ec6-8199-137af1736453@googlegroups.com> <cmfpdgFircbU1@mid.individual.net> <mdud5d$24m$1@dont-email.me>

Show all headers | View raw


On 13.03.2015 11:12, Robbie Brown wrote:
> On 13/03/15 09:36, Nigel Wade wrote:
>> My guess, and it has to be a guess because of the total lack of
>> information as others have highlighted, is that your code (the *other*
>> code, which you don't show) "doesn't count time" because it's running in
>> another thread which isn't synchronized properly. The code you've shown
>> is a tight, CPU bound, loop so I guess the other thread is starved of
>> CPU cycles. Add your System.out and the tight loop becomes I/O bound,
>> allowing the other thread to gain CPU cycles.
>>
>> All complete conjecture based on a complete lack of information.
>
> This sounds highly plausible.

CPU starvation is not so likely on modern hardware and OS.  I think it 
more plausible that, since writing to the stream is missing (which is 
synchronized!), there is no memory barrier and updates on non volatile 
variables in the measurement thread are not visible to whatever other 
thread tries to get at the timing measurement.

> OP why don't you paste-bin your code and let the boffins (and us that
> are less than perfect) have a look.

Amen.  There is really far too little information.

Cheer

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

VERY PECULIAR PROBLEM Doug Mika <dougmmika@gmail.com> - 2015-03-12 11:38 -0700
  Re: VERY PECULIAR PROBLEM Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-03-12 14:57 -0400
  Re: VERY PECULIAR PROBLEM Robbie Brown <rob@example.com> - 2015-03-12 19:29 +0000
  Re: VERY PECULIAR PROBLEM Joshua Cranmer 🐧 <Pidgeot18@verizon.invalid> - 2015-03-12 22:52 -0500
  Re: VERY PECULIAR PROBLEM Nigel Wade <nmw@ion.le.ac.uk> - 2015-03-13 09:36 +0000
    Re: VERY PECULIAR PROBLEM Robbie Brown <rob@example.com> - 2015-03-13 10:12 +0000
      Re: VERY PECULIAR PROBLEM Robert Klemme <shortcutter@googlemail.com> - 2015-03-13 21:40 +0100

csiph-web