‹ BackHN Continuity

Thread

Platform-independent SIMD in Go

414 points · 152 comments · yurivish

  1. u8 · · focus · HN ↗
    This is why I love Go. Nobody was asking for this, but they took the time to do it right and continue to Push go as a memory safe, high-level systems language.
    1. __s · · focus · HN ↗
      go data races aren't memory safe
      1. shikck200 · · focus · HN ↗
        That does not make sense to me. Go is memory-safe, but it does not guarantee data-race freedom.

        So whats your point here? Haskell?

        1. simonask · · focus · HN ↗
          There is no memory safety without freedom from data races. One is a prerequisite of the other. This is why languages like C# throw exceptions on unsynchronized concurrent access to some container types, and treat all property accesses as atomic.
          1. shikck200 · · focus · HN ↗
            Are you saying any language that does not promise data-race freedom is memory unsafe? That would rule out almost every programming language.
            1. simonask · · focus · HN ↗
              I am, but you’d be surprised. All of the single-threaded languages are fine, for example. Very few languages are actually low-level enough to allow data races. C# and Java go to great lengths to avoid it.

              Race conditions in general are another matter, and aren’t generally considered a requirement (though you can certainly create nasty bugs).

              1. shikck200 · · focus · HN ↗
                I have not written a line of Java in 15 years. But im pretty sure Java has threads? Once you have threads, you pretty much have data races.

                        Thread a = new Thread(() -> x++);
                        Thread b = new Thread(() -> x++);
                
                        a.start();
                        b.start();
                1. simonask · · focus · HN ↗
                  I don’t know Java or the JVM, but if it’s anything like the CLR/.NET, this would either be compiled to atomic operations, or throw an exception.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.