S
S
sugadu2016-08-06 15:38:59
Programming
sugadu, 2016-08-06 15:38:59

What is the difference between multithreading, multitasking and multiprocessing?

Can anyone explain the differences between these concepts in an accessible language, or give a link where it is explained?
upd
Interested in programming, not administration. Those. which means "the program runs in multiple threads", "the program can create new processes".

Answer the question

In order to leave comments, you need to log in

4 answer(s)
X
xfg, 2016-08-06
@sugadu

There can be many threads in one process, but there is always at least one. Threads within the same process share a common memory, data changes in one thread will be visible in all the others.
At the same time, one program can spawn many processes; processes, unlike threads, do not share a common memory.
And multitasking is a property of the OS to calculate simultaneously (*relatively speaking) many tasks (processes and threads) or, more simply, programs. This gives you the ability to play the game and listen to music on your computer at the same time.
* in fact, the processor works in sequential mode and, accordingly, in fact, cannot simultaneously calculate more than 1 process or thread, but since it is able to calculate a huge number of operations per unit time and quickly switches from one process / thread to another and back, then often speak at the same time. But even here it is worth making a reservation that multi-core processors really allow computing several processes / threads in parallel, where each processor core can take on the calculation of 1 thread or process per unit of time.
Conclusion. If you have a 4-core processor, and your program runs in one process with one thread, then your program will be calculated on only 1 core. Therefore, you can create 4 threads in one process or 4 processes with 1 thread in each, and then your program will map to all processor cores and take up all its possible capacities. At the same time, creating more than 4 threads or 4 processes will not make much sense, since you can only compute a maximum of 4 of them in parallel anyway.
When any process is created, at least 1 thread is automatically created inside it. But you can also create more than 1 thread yourself if you need to.

A
Alexander Mineev, 2016-08-06
@itvsem

And there is no difference between them, since they are not directly related to each other.
Multithreading is a property of the platform to solve one task in parallel, to increase speed, that is, it depends on the application.
Multitasking is a property of the OS to provide the ability to work in parallel to solve problems.
Multiprocessing is the use of two or more physical processors in one device.
If you generalize for a simple understanding:
1. You create an application that needs to do tasks in parallel for speed
2. You write this application for a specific OS, which must support work with the task in parallel
3. There must be hardware that will pull all this.

D
Dimonchik, 2016-08-06
@dimonchik2013

https://www.youtube.com/watch?v=AWX4JnAnjBE

R
Rou1997, 2016-08-06
@Rou1997

For the first time I hear the term "multiprocessing", one application can have several processes (in the task manager), for example, in any modern browser, if several pages are open at the same time, then each has its own process, the OS tries to execute processes simultaneously, first the first instruction of the first process, then the first - the second, then the second - the first, etc., if possible, each process is completely occupied by a separate processor core (separate logical processor), all this increases performance and allows you to implement algorithms such as message processing loops, infinite loops do not "hang" the entire OS.
Threads are the same as processes, only inside a process, like folders and files.
Tasks are threads and processes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question