3 ms·
Channels pretty much are queues. You can do all of this in something like Java with thread pools and BlockingQueues (or Jetlang or Akka), but it's going to get
by pkulak 14y ago
Channels pretty much are queues. You can do all of this in something like Java with thread pools and BlockingQueues (or Jetlang or Akka), but it's going to get really messy really quick. With Go you can wait on multiple channels until any one of them has an item. That's not possible in Java so you end up with one thread per queue even if you don't need them; plus all the synchronization headaches that come with that. There's probably some Java library that lets you do what I'm talking about, but it's not going to be as nice as doing it in a language that has these concepts built right in. Plus, only recently (in Java 7, I think) will the runtime actually use epoll (and I don't think there's kqueue support at all, so you're out of luck on OS X), so no matter what you do you're going to have one thread per network connection.