2014-05-24 17:23 GMT-04:00 DV <
dimiter....@gmail.com>:
> C/C++ are still 10 years behind "the curve", IMO, when it comes to
> implementing concurrency and I believe that manual memory management is one
> of the main reasons for that.
It is very much possible to design proper concurrent systems in C, a
la
concurrencykit.org. I think the main reason is lack of
understanding of (wait|lock)-free data structures and algorithms,
modern processor implementation, cache coherency protocols, and safe
memory reclamation algorithms. Reference counting, proxy collectors,
quiescent state-based reclamation (including epoch reclamation),
hazard pointers, and RCU are all successful ways that C programmers
deal with memory reclamation in systems with hundreds or thousands of
concurrent processes. Any "behind the curve" status really lies with
the implementor.
Certainly various languages attempt to make this easier, but you still
have to prove the correctness of the implementation regardless of the
language. And when dealing with concurrency, the correctness of your
implementation can be very dependent on the underlying hardware
(memory ordering semantics, cache coherency protocols, out-of-order
execution, atomic instruction implementation, etc). Right now, Go
abstracts this away from you -- but a significant chunk of the
concurrency primitives in Go are implemented in C and / or assembler.
So in some respect, one could say that Go is "behind the curve" for
implementing concurrency in the sense that it provides neither
lock-free nor wait-free guarantees on its concurrent data structures.
When one is concerned about latency, this is problematic -- even
without considering a garbage collector. From this perspective, you
absolutely cannot implement a latency-sensitive system in Go. That's
fine, I don't think that's a current goal for the language.
I'm very much a fan of Go (although I haven't contributed to it
materially in some time), so I hope people don't take this as a
criticism of the language or the implementation. I guess this is just
a tangential reply because this statement oversimplifies memory
management in concurrent systems. Someone has to keep track of the
memory, it just depends on whether that's the programmer or the
runtime. If it's the runtime, it's good to have some guarantees about
correctness. It's not fair to state the language used to implement the
concurrency primitives provided by the touted language is "behind the
times".
--dho
>> I was just wandering, Go been the best language for almost everything
>> except Real time applications,
>> how hard would have been to add a switch turning garbage collection on or
>> off.
>> That would had elliminated the need for using C/C++, and would have made
>> the language
>> more popular. Just a thought.
>>
>> Mike.
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
golang-nuts...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.