News for hackers. Stuff that matters.
Re:Rob Pike: Go at Google by fauigerzigerk on Saturday October 27, 2012 @09:11AM (#4706063)
That's not true at all. Each goroutine has its own variable sized stack whereas Runnable objects in Java don't have a stack of their own. They use the thread's stack. So as long as a Runnable uses its stack (that is the run() method hasn't finished), the thread cannot be used by other Runnables.

So, in Go you can have thousands active function invocations (i.e tens of thousands of stack frames on thousands of stacks) at the same time and they do not occupy thousands of threads. You can't do that in Java.

Re:Rob Pike: Go at Google by pjmlp on Saturday October 27, 2012 @01:44PM (#4706696)
> Each goroutine has its own variable sized stack whereas Runnable objects in Java don't have a stack of their own.

Which JVM or native Java compiler are you talking about? This is implementation specific.

Re:Rob Pike: Go at Google by fauigerzigerk on Saturday October 27, 2012 @05:49PM (#4707344)
I'm talking about every single Java language implementation that I know of. And I believe (although I'm not completely sure) that the Java language specification requires it at least implicitly.
Re:Rob Pike: Go at Google by Evbn on Saturday October 27, 2012 @03:00PM (#4706893)
Which ones give stacks to each runnable? Does Oracle? Does OpenJDK?
Re:Rob Pike: Go at Google by pjmlp on Saturday October 27, 2012 @03:55PM (#4707049)
Oracle and OpenJDK are just two JVMs.

I know at least the following JVMs

Oracle JVM

OpenJDK JVM

Metro JVM

IBM JVM

Aonix JVM

Cacao VM

Squawk VM

Jikes VM

VMKit

BlueRay VMs

Excelsior JET Java native compiler

GCJ native Java compiler

Aonix Perc Java compiler

... (many many others)

I doubt every single of the above implementations does threading the same way.

Re:Rob Pike: Go at Google by fauigerzigerk on Saturday October 27, 2012 @05:59PM (#4707373)
So have you checked if any of these do what you claim they could do?
Re:Rob Pike: Go at Google by pjmlp on Sunday October 28, 2012 @03:24AM (#4708368)
And you have done it?
Re:Rob Pike: Go at Google by fauigerzigerk on Sunday October 28, 2012 @03:55AM (#4708405)
Why would I? I said none of the implementations I know of do what you say. If you do know an implementation that does, then please tell me which one.
Re:Rob Pike: Go at Google by pjmlp on Sunday October 28, 2012 @04:57AM (#4708477)
No you did not. You stated that is not possible in Java at all regardless of the implementation. I don't see any mention of " none of the implementations I know of" on your comment.

<quote> That's not true at all. Each goroutine has its own variable sized stack whereas Runnable objects in Java don't have a stack of their own. They use the thread's stack. So as long as a Runnable uses its stack (that is the run() method hasn't finished), the thread cannot be used by other Runnables.

So, in Go you can have thousands active function invocations (i.e tens of thousands of stack frames on thousands of stacks) at the same time and they do not occupy thousands of threads. You can't do that in Java. </quote>

Re:Rob Pike: Go at Google by overcyn on Sunday October 28, 2012 @06:09AM (#4708579)
You are being deliberately dense. If no existing JVM gives runnable objects their own stack, then it's impossible for a java developer to create thousands of threads (without creating their own JVM, which is totally unreasonable 99% of the time). It's a practical impossibility. Is that so much worse than a technical one?
Re:Rob Pike: Go at Google by fauigerzigerk on Sunday October 28, 2012 @06:48AM (#4708647)
I said it here: http://news.ycombinator.com/item?id=4707344 12 hours ago in a direct reply to your question.
Re:Rob Pike: Go at Google by pjmlp on Sunday October 28, 2012 @12:48PM (#4709328)
I am really sorry for my reaction and excuse myself for it.

I have missed that and got carried away in Internet discussion style.

Sorry about that, somehow I got it wrong and blindly carried on discussing nonsense without thinking any longer about it.

Re:Rob Pike: Go at Google by fauigerzigerk on Sunday October 28, 2012 @01:09PM (#4709383)
That's OK, it's been a perfectly civilised debate after all. You're making a fair point insisting on a distinction between implementations and the spec. My initial posts were very unclear in that regard.