Last week, I went to Shanghai intel to attend a technical training on multi-core programming. In general, the special technical training of large companies has been carefully designed, the system is relatively complete, the Knowledge coverage is relatively complete, emphasizing the experiment and hands-on links. The same is true for Intel's multi-core technology training. The system from the basic thread knowledge to the multi-thread programming method model, from OpenMP to the vtune tool, is still complete, and the test link is well designed, PPT is very attentive. Of course, because the time is only two days after all, it is impossible to go deep. However, in general, I am very satisfied with the quality of this training. After all, the master is leading the door and practice is on the individual. The deep learning depends on the individual.
Unlike many other technologies, the topic of multi-threaded programming requires special attacks, and general practices alone cannot solve the fundamental problem. Many people may be able to write programs for many years without knowing this field clearly. As soon as they encounter multithreading, they may crash, or think they are OK. In fact, there are a lot of coding problems. The solution is to take some time to study the Theories, Methods, and tools in this field, get started at one time, and then sharpen them in practice. The purpose of the training is to bring people into this door. You can also learn by yourself. In fact, there are a lot of related materials and books, and it is not difficult to learn by yourself. However, the biggest problem of self-study is that you don't know what to learn and the progress is not easy to grasp. Some people are too slow to learn. After all, their spare time is limited, so they will soon be exhausted and the knowledge system is not completely covered. Some people learn it too quickly and forget it later. More people do not know the full picture of the knowledge system, so the force is not balanced, and it takes a lot of work on some points to learn deeply, but it is hardly involved in other important issues, in practice, problems are inevitable.
Although I cannot disclose the course content of Intel, the overall architecture of this course system is not a secret. I want to announce it here. It is helpful for anyone who wants to learn multi-core programming independently. At least you should know that it is complete to cover those points to learn this topic.
1. Basic knowledge about threads and processes. Needless to say. But we need to figure out the relationship between multithreading and multi-core. Generally, to make good use of the power of multiple cores, We Need To Write multi-threaded programs. However, the multi-threading on multiple cores is different from the single-core multithreading. Therefore, the technical means are different. This should be clarified.
2. Popular threading APIs. It should be said that there are two systems: Win32 and pthread. Generally, you can understand one. This focuses on a series of synchronization mechanisms. For Win32 (I have almost no idea about pthread), critical section, mutex, semaphore, and event should be clear in their respective application scenarios. A more basic capability is to identify which variables need to be protected, where they need to be protected, and how to minimize the impact on performance.
3. OpenMP. OpenMP is a parallel computing library dedicated to parallel Computers in the shared address space. It is supported by # pragma in Intel C ++ and Visual C ++ 8.0. With OpenMP, you do not have to write thread Management Code such as createthread. multi-threaded programs are relatively simple to write. In addition, OpenMP provides a wide range of commands, which provide effective support for tasks such as synchronizing shared variables and rationally allocating loads. It is worth learning. However, this is easy to use and can lead to stupid mistakes with a slight negligence, so it must be used frequently to control the problem. When using it, mistakes are inevitable. Some people in the training class said that it is better to use the crude Win32 API to do this. At least they are highly nervous and will not make stupid mistakes. Although it is a joke, it is still reasonable. However, in the long run, the advantages of OpenMP are obvious.
4. Design Theories and Methods of multi-threaded programs. This includes the rational division of tasks, several basic models for dynamic division, and theoretical and measurement standards for performance improvement. Someone from Intel summed up a multi-threaded programming methodology and taught you how to change from a single thread to a high-performance multi-thread step by step. I didn't talk about it in class. I should be able to find a document on the Internet. Interested people can search for it on Intel's website.
5. Use of tools. This part is of course linked to Intel's own software tools, mainly vtune/thread checker/thread profiler. Now the next two tools are integrated into vtune, so there is only one vtune in terms of products. In all fairness, vtune is indeed a very good optimization tool. If you really want to develop products, you may not need such tools. No matter how powerful a programmer you are, writing things always needs to be tested in practice, so tuning tools are indispensable. The combination of vtune and thread checker/thread profiler far exceeds the tuning tool. For multi-core program development, this tool is too significant.
This is generally the case.