How Erlang is better than other language in doing concurrency? [closed] - concurrency

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I don't understand why erlang itself is great with concurrency
Is there anyway other language such as C# could be as great as erlang if we do some trick?
Or it is the very specific language feature of erlang that most language don't have?
Could we write C to be like erlang?

One Major property of Erlang is that it was built from the ground up to be a concurrent language. Erlang supports hundreds of thousands of lightweight processes in a single virtual machine. Because Erlang's processes are completely independent of OS processes they are very lightweight, with low overhead per-process. Thus when using Erlang for concurrent oriented programming you get alot of advantages out of the box.
Fast process creation/destruction
Ability to support millions of concurrent processes with largely unchanged characteristics.
Fast asynchronous message passing.
Copying message-passing semantics (share-nothing concurrency).
Process monitoring.
Selective message reception.
This Erlang style concurrency is not impossible to do in C, but it would be hard to do it. Read this blog for more information on Erlang style concurrency

Related

Different task running at the same time on a C++ program [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm a industrial engeneering student and I have in mind a pretty cool application using ROS. I know that this is not an specific forum about ROS, but as I am programming in C++ and the question is more related to C++ than ROS, I believe that this is a very good place to ask my question.
My problem is that I have a ROS node that must do three different task. These three tasks are equally important so it must be run at the same time. I'm not newer in C++ programming but I've never worked with this kind of problems. I've made a little researh through the internet about
multi-threading and parallel programming and I still don't know the difference between each other.
Which are the differences between multi-threading and parallel programming?
Which might be the best option for the C++ program?
How can I implement these methods on a C++ program?
Is there any guide for people who are getting started with this topic?
Thanks in advance for any help!
Multi-threading describes the concept of having multiple tasks running in parallel for one single program.
Parallel programming is using one parallel concept (might be multi-threading) in your code.
Your questions 2 can not be answered since one uses the other.
A good guide on how to use parallel programming to improve the performance of your code can be found here
"Parallelism" or "parallel computing" refers to any technique that exploits the resources of computing hardware that is capable of doing more things at the same time than a traditional, single-CPU computer can do. It's a broad topic, that covers everything from modern multi-CPU desktop, server, and mobile platforms to GPU programming to esoteric things like systolic array processors and connection machines that have not yet escaped from their university laboratories.
"Multi-threading" is one of several popular techniques that extend the capabilities of a conventional procedural programming language to let us have multiple different activities to happen concurrently within a single process. Parallelism is a subset of concurrency. Any activities that are able to happen concurrently within a single process potentially can happen in parallel if you have the right hardware and operating system.
How can I implement these methods on a C++ program?
Use the threading features in the standard C++ library.

What design pattern or programming technique to use to separate data flow from control flow? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
In a distributed system there is one management instance and multiple processing instances. The management instance sends commands to the different processing instances. So the processing nodes need to have some command parsing logic and more logic to act on these commands.
Throughput is important for the processing instances so the actual data flow should be impacted as little as possible.
Is there a design pattern or programming technique I can use to clearly separate data and control flow in the processing instances while keeping performance of the data flow as high as possible?
Edit:
The general implementation as of now is like follows: There are N processing threads, pooled, and a single control thread. At least virtually, they all have their own private data structures. What the control thread can do is change the actual thread function. I see design patterns as general, high level designs which I don't have to follow closely, but still I am interested if there is such a high level design that minimizes the disturbance of the processing threads.
I'm targeting C++17, if that should be of any concern.

Use clojure to develop game server [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm developing a server for a game. You kown in games,many data structures should be mutable. But Clojure's data structures is immutable. Is there some good idea to
do this? Should i use clojure for it?
Mutating data structures allows you to squeeze the last ounces of performance out of your code, but given that you're writing a server, network latency probably has a much greater impact than memory allocations. Clojure should be suitable, certainly as a starting point.
While Clojure's data structures are immutable, application state can be managed via atoms, refs, core.async loop state, and data pipelines. A Clojure application is hardly static just because its data structures are.
The biggest risk you face right now is figuring out what to build, and Clojure's live development model will accelerate the learning loop. You can redefine functions while the server is running and see their effects immediately.
I suggest you prototype your server in Clojure, then, if performance gains need to be made, profile the code. If necessary, you can introduce transients and volatiles, and port performance critical sections to Java.

Advantages of Service Oriented Architecutre [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I searched on Google, but didn't get straight answers that what are the advantages of Service Oriented Architecture?
Can someone please highlight some of the benefits of SOA?
The two most important (at least in a practical sense) are:
Small, manageable (i.e. maintainable) components.
Services can be distributed across different machines. This makes
the system highly scalable.
In other words: SOA is a good fit into the modern software development landscape with distributed teams and ever-changing requirements, be it functional or non-functional.
It gives great deal of re usability to your code and enormous power to the business as well.
Lets say you start creating an application for banking, now you need to create a mobile app for the same, and if that's not it you have to expose methods from your service to Master /Visa for transaction.
Now in the above scenario if application has been designed with SOA in mind, then lot of code is reused with added advantage of centralized deployment.

Is the Go programming language replacing C++? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have read on some blogs that Go is a better system programming language and is going to replace C/C++. I am currently learning C++. So, I was wondering whether I should continue learning C++ or move to Go?
Go is designed for reliable, fast online services. It's the recommended language of Google App Engine. It does have general feature parity with C, plus additional scalability features. Perhaps, one day, it will be adopted for embedded programming and client-side applications, but that has yet to happen.
C is used in many, many application domains. No other language approaches its breadth of use. As a first language, though, it won't help you develop good habits.
C++ is a multi-paradigm language. It supports deep, generic metaprogramming. Many users of C++ are really using "embedded domain-specific languages" (EDSLs) where a library provides functionality defined within the C++ grammar. Go does not attempt to provide this depth, which is a Pandora's box of complexity.