Parallel coding Vs Multithreading (one processor)

can we use the interchangeable "parallel coding" and "copying multithreading" on the same processor?

I have little experience in both, but I want to change the coding style to any of the above.

As I already found a few days, many one-time applications are out of date, which would be better for future software as a career prospect?

+8
multithreading parallel-processing
Jul 02 '09 at 8:06
source share
6 answers

There is a definite match between multi-threaded and parallel coding / computation with the main differences in the architecture of the target processing.

Multithreading was used to take advantage of concurrency within a single process on a single processor with shared memory. Running the same programs on a computer with multiple processors can lead to significant acceleration, but it is often a bonus rather than implied (until recently). Many operating systems have stream models (e.g. pthreads ) that benefit but do not require multiple processors.

Multiprocessor - a standard model for parallel programming, oriented to several processors, from the early SMP machines with many processors on a large machine, then for cluster computing on many machines and now return to many processors / cores on a single computer. MPI is a standard that can work in many different architectures.

Of course, you can program a parallel design using streams with language frames such as OpenMP . I have heard of multicomponent GUIs / applications that rely on separate processing that can theoretically be executed anywhere. Practically there is more of the first than the last.

Probably the main difference is that the program runs on several computers, where it is not practical to use multithreading, and existing applications that share memory will not work.

+12
Jul 02 '09 at 9:02
source share

The question is a bit confusing since you can perform parallel operations on multiple threads, but all multi-threaded applications do not use parallel computing. In parallel code, you usually have many “workers” that consume a data set to return results asynchronously. But multithreading is used in a wider area, for example, in the graphical interface, blocking I / O and the network.

On one or more processors, much does not change, since management depends on how your OS can handle threads and processes.

Multithreading will be useful everywhere, a parallel is not an everyday computer paradigm, so it can be a “niche” in a career perspective.

+2
Jul 02 '09 at 8:18
source share

Some of the demos I saw in .NET 4.0, Parallel code changes seem easier than threading. There is a new syntax for "For Loops" and other features to support parallel processing. So there is a difference.

I think that in the future you will do both, but I think that Parallel support will be better and easier. You still need threads for background operations and other things.

+2
Jul 02 '09 at 8:20
source share

The fact is that you cannot achieve "real" parallelism on one CPU. There are several libraries (e.g. C MPI) that help a little in this area. But the concept of parallelism is not something that was used among developers working on popular solutions.

Multithreading is common today due to the introduction of several cores on one processor, it is simple and almost transparent for implementation in each language thanks to stream libraries and stream types, methods, classes, etc. This way you can simulate parallelism.

In any case, if you start with this, start by reading about concurrency and the topic of threads. And of course, + parallelism threads work well together.

+1
Jul 02 '09 at 8:37
source share

I’m not sure that, in your opinion, “Parallel Encoding” is parallel encoding, because I understand that this refers to creating code that runs parallel to the processor, and therefore multi-threaded code gets inside this description.

So, obviously, you can use them interchangeably (as one gets inside the other).

However, I suggest you take it slowly and start learning the basics. Understand why multithreading becomes important, what is the difference between processes, threads and fibers, how you synchronize them, etc.

Keep in mind that parallel coding, as you call it, is quite difficult, especially compared to serial coding, so be prepared. And don't just rush into it. Just because you use 3 threads instead of one, you won’t be able to make your program faster, but even slow it down. You need to understand how and whose. Not everything can be made parallel, but not everything that can, should.

0
Jul 02 '09 at 8:16
source share

in a simple language, multithreading is available in CPu by itself and parallel programming is an explicit task performed by the compiler or my constructions written by the #pragma programmers

0
Aug 17 '13 at 8:53 on
source share



All Articles