News for hackers. Stuff that matters.
Re:James Gosling Interview by Jtsummers on Thursday August 12, 2021 @04:37AM (#28153674)
I'm not sure there's too much debate on what parallelism is (simultaneous execution of 2 or more processes/threads). The broader debate seems to be on what concurrency is. Is it a design feature (in which case coroutines in a single threaded program offer concurrency) or is it an execution model (in which case it intersects with or is the same as the common definition of parallelism).

The other debate is on how parallelism (and concurrency) should be done. Shared-nothing or shared-memory? It'd be foolish to say that only one of them is parallelism, but it would be reasonable to debate the merits of each approach in different systems and circumstances.

Re:James Gosling Interview by capableweb on Thursday August 12, 2021 @04:49AM (#28153758)
Thanks, I agree with you overall. My comment was more focused on the (old and "well-used") adage of "X is not true Y" that gets used over and over again to look down on X, while the definition of anything "true" is most likely just personal opinion and is different depending on who you ask.
Re:James Gosling Interview by vbezhenar on Thursday August 12, 2021 @05:28AM (#28154017)
> The other debate is on how parallelism (and concurrency) should be done. Shared-nothing or shared-memory?

Obviously it should be "shared nothing" as it would allow you to horizontally scale your application and code will be much easier to develop and test. But in reality you inevitably need to have a shared state in one way or another. You could try to move that state into some dedicated service, like database, but it's not always performant enough (or even applicable). So you end up with shared memory because of performance.

Re:James Gosling Interview by vlovich123 on Thursday August 12, 2021 @06:36AM (#28154507)
I think Rust shows the advantages of shared nothing can be mitigated through novel language design.
Re:James Gosling Interview by bullen on Thursday August 12, 2021 @04:48AM (#28153754)
I'm trying to name the version of parallelism that can share memory between threads, and so far I have tried "Joint Parallelism" and now lately "Atomic Parallelism" without much success.

What would you suggest?

Re:James Gosling Interview by Jtsummers on Thursday August 12, 2021 @05:09AM (#28153885)
I'm not sure it needs a special name. It's the default model that almost everyone learns first, shared-memory parallelism/concurrency. It's the whole reason that semaphores and mutexes were developed (to avoid contention for the same resource or resource set from multiple threads of execution).
Re:James Gosling Interview by bullen on Thursday August 12, 2021 @06:31AM (#28154475)
Yes, but I also mean that parallelism to be atomic/non-locking. afaik only Java/C# can do this on a high-level (without going back to atomic arrays in C) but I still can't explain why, the best I found so far is:

"Many lock-free structures offer atomic-free read paths, notably concurrent containers in garbage collected languages, such as ConcurrentHashMap in Java. Languages without garbage collection have fewer straightforward options, mostly because safe memory reclamation is a hard problem..." - Travis Downs https://travisdowns.github.io/blog/2020/07/06/concurrency-co...

But it seems there is also some benefit to have a VM in addition to a GC for this joint/atomic parallelism.

Re:James Gosling Interview by BeeOnRope on Monday August 16, 2021 @11:15PM (#28205790)
I wrote that. The problem I was getting at is that it's fairly easy to write various types of lock-free structures in native langues, but you almost always run into the "memory reclamation" problem.

E.g., you can look up something like a lock-free linked lists, the first of which were described decades ago. They have an algorithm to delete a node from the list, but what often isn't emphasized is that you can't just free that note by calling `free()` on it, because you don't know if any other readers might happen to have a reference to that node, and thus may access the underlying memory. If you free it, they might access freed memory.

In general, this is a hard problem to solve. You can wait, but how long is long enough?

Garbage collected languages solve this more or less automatically: there is no explicit free() but instead the GC determines when there are no more live objects and frees it for you.

This isn't unsolvable in native languages, but none of the solutions are as clean and tradeoff-free as you'd find in a GC'd language.

Re:James Gosling Interview by Jtsummers on Thursday August 12, 2021 @08:59AM (#28155686)
Look up MISD. I think that’s the idea you’re getting at, there really isn’t a lot of hardware support for it which is why for more complicated structures you’re pushed towards higher level languages.
Re:James Gosling Interview by kazinator on Thursday August 12, 2021 @07:14PM (#28162910)
Historically, this is known as "multiprogramming". Multiple programs making forward progress inside the same computer, via interleaved or concurrent execution, the latter being called "multiprocessing".