Category:Romanian business lawTraining for beginners
The world of parallel programming and concurrency is dominated by C, C++ and Java. The challenge for beginners is to get a full understanding of the technologies, its concepts and its language and then to apply it. Therefore, I start with C.
The C language
The C language is powerful, but the complexity of the language is immediately evident. The C language is therefore often put to one side and seen as a language that requires a lot of learning. This is true, but this is a view limited to university students. For the large number of people who want to get started with programming and/or develop software for embedded systems, the C language and its constructs is a useful and powerful language. In this regard, it is particularly interesting to learn how to do simple serial programming and then to transition to the parallel world.
The serial programming problem
An important part of the process is learning the difficulties of serial programming and the best approach to addressing the problems that arise. The fundamental principle in the construction of embedded systems is that of the “controller first” model. In other words, the controller must always be completed before the rest of the program is started. It is therefore important to know the solution to the problem first and to work with that solution. If you do not know how to solve the problem, then you will not be able to explain it to the computer engineer.
The code below shows a controller that reads the temperature and humidity levels from a humidity sensor and prints them to the serial console. The other variables are defined as global. The first line in the function set_serial is the only line of code that is not directly connected to the hardware. All the other code is directly connected to the sensor hardware.
Notice that the function set_serial does not have any return value. If there is no error, then the temperature and humidity levels are printed. However, if an error occurs, then the program is interrupted with an error code.
With this model, all the information that is important for the control logic is in the controller itself. The rest of the code is then connected to the controller, and the user can develop the software that is used by the controller.
Coding the parallel programming problem
Parallel programming is not as simple as serial programming. It is easier to do parallel programming in C than it is in Java or C++. However, 0b46394aab