News for hackers. Stuff that matters.
Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @04:26AM (#20188946)
Modern security exploits and application crashes due to state corruption have proven that while threads were an enticing idea, they aren't something that we should keep around if we care about security and application stability.

This applies to all programming languages, not only OCaml, hence why everyone is moving away into other concurrency models anyway.

Re:OCaml 4.08 by newen on Saturday June 15, 2019 @07:55AM (#20189573)
You have two matrices, with allocated memory A and B, that you want to multiply and store to allocated memory C, as efficiently as possible using 8 cores. How do you do this without threads exactly?
Re:OCaml 4.08 by ernst_klim on Saturday June 15, 2019 @02:04PM (#20191244)
>You have two matrices, with allocated memory A and B, that you want to multiply and store to allocated memory C, as efficiently as possible

If matrices are small, 1 core would be more efficient. If matrices are big, GPU would be more efficient.

Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @08:32AM (#20189703)
Vector instructions or GPGPU.
Re:OCaml 4.08 by newen on Saturday June 15, 2019 @09:12AM (#20189869)
Assume no GPU. Vector instructions will only use one core at a time.
Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @10:01AM (#20190057)
We are in 2019, even low level microcontrollers have dumbed down GPUs.

Plus I already answered your questions, not moving goal posts here.

Re:OCaml 4.08 by newen on Saturday June 15, 2019 @10:29AM (#20190163)
I wanted an efficient no threads solution to a very common problem of matrix multiplication using multiprocessor CPUs. You gave me nonsense answers like vector operations (uses only one CPU at a time) and GPUs (memory transfer bottleneck, need to copy arrays, significantly less RAM compared to CPU RAM, and GPUs make it a completely different game). So no, I'm not moving goalposts.
Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @04:35PM (#20191985)
You did not define what efficient means.

For example, a SIMD implementation will outperform a multithreaded implementation on a CPU without support for hardware threads.

My nonsense answer just happens to be what HPC is moving into, and when HPC wants to scale it uses MPI coupled GPUs, not plain old threads.

Re:OCaml 4.08 by detaro on Saturday June 15, 2019 @10:07AM (#20190076)
And will spend more time shuffling data through their horribly bottle-necked memory interfaces than the CPU would take handling the matrix operation, especially if the GPU is already used for graphics.

Multi-core systems and tools that can use them are valuable and very much reality right now.

Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @10:09AM (#20190086)
Yep, CUDA and Vulkan Compute are such a waste in HPC, thankfully ML research is doubling down on threads.
Re:OCaml 4.08 by detaro on Saturday June 15, 2019 @10:10AM (#20190087)
You were the one who introduced GPUs on low-end embedded chips as an argument. HPC is a slightly different world.
Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @10:12AM (#20190090)
Nah, you are the one that moved the goal posts after my first answer.
Re:OCaml 4.08 by detaro on Saturday June 15, 2019 @10:12AM (#20190094)
That was my first reply to you today...

As much as I often appreciate your no-nonsense perspective on things and you posting it, things like this don't really do you a favor.

EDIT: tweaked last line to be a bit less snippy

Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @04:30PM (#20191955)
I don't always look at nicks.
Re:OCaml 4.08 by amelius on Saturday June 15, 2019 @05:44AM (#20189173)
There are many applications where these kind of security issues don't apply.
Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @06:42AM (#20189349)
Such as?

Every application should strive for proper quality, just like in other industries.

Re:OCaml 4.08 by amelius on Saturday June 15, 2019 @09:41AM (#20189989)
For example: embedded applications, or when I'm the only one running trusted code on my computer. Think also of scientific computing.

If you insist on networked solutions: database servers.

Also: "multicore + purely functional style" is just as clean as "multiprocess + purely functional style", but ... the latter is less efficient because of communication overhead.

Re:OCaml 4.08 by pjmlp on Saturday June 15, 2019 @09:59AM (#20190050)
Unless you manage to do any kind of work without IO, there is always a security risk.

And if that is irrelevant to you, there is still the application stability and memory consistency to ensure data is being handled in a memory consistent state.

Fortran is a good example on how to do scientific computing without low level threads.

Re:OCaml 4.08 by amelius on Saturday June 15, 2019 @10:28AM (#20190157)
Yes threads should be used with extreme caution, that's why I advocate using a functional programming style. But you still want the performance of multicore. It's not one or the other (but with OCaml it unfortunately is).