[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread Marcelo Fukushima
well one could argue that, though im not sure if native threads have such guarantee - in which case, java may only be delegating to native that said, you can try disabling biased locking (starting from java 6 i think) and see if it makes any difference On Tue, Nov 3, 2009 at 5:40 PM, Brent Ryan

[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread Reinier Zwitserloot
Yes, I was indeed saying that java didn't break anything. your app was broken from the start by relying on something that isn't in the spec. Every release of the JVM *breaks* lots of things you shouldn't have relied upon, every time it updates, especially around the topic of threading. double-ch

Re: [Fwd: Re: [The Java Posse] Re: Java thread scheduling bug]

2009-11-03 Thread Marcelo Fukushima
On Tue, Nov 3, 2009 at 7:11 PM, kirk wrote: > > > > Marcelo Fukushima wrote: >> i should probably write in a better way (i guess i cant write in >> english as well as i can read) >> >> what i meant was that os thread could potentially behave like how java >> threads behave: there are not guarant

[Fwd: Re: [The Java Posse] Re: Java thread scheduling bug]

2009-11-03 Thread kirk
Marcelo Fukushima wrote: > i should probably write in a better way (i guess i cant write in > english as well as i can read) > > what i meant was that os thread could potentially behave like how java > threads behave: there are not guarantees that any given thread will be > given its timeslice i

[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread Brent Ryan
Then maybe the spec is where the flaw is... Sent from my iPhone On Nov 3, 2009, at 10:45 AM, Marcelo Fukushima wrote: > > i guess what reinier was trying to say was that your code (as far as > vm spec goes) was broken from the start and (again, from the vm spec > perspective) lucky timing an

[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread Marcelo Fukushima
i guess what reinier was trying to say was that your code (as far as vm spec goes) was broken from the start and (again, from the vm spec perspective) lucky timing and scheduling just made it work correctly On Tue, Nov 3, 2009 at 3:26 PM, Brent wrote: > > I just don't think that it's a good idea

[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread Marcelo Fukushima
i should probably write in a better way (i guess i cant write in english as well as i can read) what i meant was that os thread could potentially behave like how java threads behave: there are not guarantees that any given thread will be given its timeslice in the CPU. In that regard, the jvm spe

[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread kirk
Marcelo Fukushima wrote: > well one could argue that, though im not sure if native threads have > such guarantee - in which case, java may only be delegating to native > > that said, you can try disabling biased locking (starting from java 6 > i think) and see if it makes any difference > I may

[The Java Posse] Re: Java thread scheduling bug

2009-11-03 Thread Brent
I just don't think that it's a good idea to say...Let's break something so that we can optimize the JVM for most cases without providing an option that allows the JVM to execute threads one way vs. another. This used to work in JDK 1.4. Does anyone know how .NET solves this problem with the CLR?

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread Reinier Zwitserloot
Why does java not guarantee gc()? Why does java not do a lot of things? Because it would severely cramp the optimizer. Adding your proposed rule across the board would probably put a serious dent in the optimization work the hotspot compiler can do to your code. Same reason why finalizers aren'

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread Stuart McCulloch
2009/11/3 Stuart McCulloch > 2009/11/2 Brent > >> >> But why does the JVM have to know my intent... It knows that I >> started a thread and it knows that it has some priority. So why can't >> it just stick all of the threads that were started for a particular >> priority on a queue and then it

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread Stuart McCulloch
2009/11/2 Brent > > But why does the JVM have to know my intent... It knows that I > started a thread and it knows that it has some priority. So why can't > it just stick all of the threads that were started for a particular > priority on a queue and then iterate through that queue. It might b

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread kirk
Brent wrote: > But why does the JVM have to know my intent... It knows that I > started a thread and it knows that it has some priority. So why can't > it just stick all of the threads that were started for a particular > priority on a queue and then iterate through that queue. It might be > ea

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread Brent
But why does the JVM have to know my intent... It knows that I started a thread and it knows that it has some priority. So why can't it just stick all of the threads that were started for a particular priority on a queue and then iterate through that queue. It might be easier said then done, bu

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread Phil
I think you're missing the point. The JVM can't know your intent when you started your threads and cannot know that the right thing to do is to 'level' resource usage across your threads. If you need your threads to receive a more equal share of resources then this needs to be expressed in your de

[The Java Posse] Re: Java thread scheduling bug

2009-11-02 Thread Brent
How does that look ok to you? Threads 0 and 1 only executed 23 times while the other threads executed 45/46 times. How can that ever be a good thing? I know what the SUN bug said, but I disagree that it's not a flaw. At the very least, they should have provided a JVM argument that allowed you

[The Java Posse] Re: Java thread scheduling bug

2009-11-01 Thread a.efremov
Hello, yes. synchronized doesn't use fair locking. Hum. I have a doubt about "Stat" thread. The run method doesn't use any kind of synchronization to read shared "stats" array. Is there a guarantee that the values it prints out is not stale? Me. I wouldn't say that. Well. On my Quad Core linux

[The Java Posse] Re: Java thread scheduling bug

2009-11-01 Thread Stuart McCulloch
2009/11/2 Brent > > I was curious... How many people have run into this bug that was > introduced with JDK 5? > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6316090 > > We've recently run into this issue and I was actually a little shocked > to find out that the JVM behaved like this. Ba