4 ms·
Go's channels are simplistically a mutex in front of a queue. Java has many existing objects that can do the same, it's just that's not idiomatic best choice to
by adra 4y ago
Go's channels are simplistically a mutex in front of a queue. Java has many existing objects that can do the same, it's just that's not idiomatic best choice to do the same. Since green threads should wake up from Object.notify(), any threads blocking on the monitor should wake/consume. I'm curious how scalable/performance a green thread ConcurrentDequeue would stand up to go's channel.
- Matthias247 4y agoYou are right. But Go Channels come also with the superpower of „select“, which allows to wait for multiple objects to become ready and atomic execution of actions. I don’t think this part can be retrofitted on top of simple BlockingQueues.
- sdfgdfgbsdfg 4y agopron talks about this on https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part2.html#channels https://cr.openjdk.java.net/~rpressler/loom/loom/sol1_part2....