multithreading 多任务、多线程和多处理之间的区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6022629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 01:14:32  来源:igfitidea点击:

Difference between multitasking, multithreading and multiprocessing?

multithreadingoperating-systemmultiprocessingmultitasking

提问by Jaison Varghese

Whats the difference between multitasking, multiprogramming & multiprocessing

多任务、多道程序和多处理之间的区别是什么

This comes regularly for my university OS exams and I can't find a good answer. I know quite a bit about multitasking and multiprogramming, but need to confirm it.

这经常出现在我的大学操作系统考试中,我找不到好的答案。我对多任务和多道程序了解很多,但需要确认一下。

回答by Casey Patton

Paraphrasing wikipedia:

转述维基百科:

Multiprogramming - A computer running more than one program at a time (like running Excel and Firefox simultaneously) http://en.wikipedia.org/wiki/Multiprogramming

多道程序 - 一次运行多个程序的计算机(例如同时运行 Excel 和 Firefox) http://en.wikipedia.org/wiki/Multiprogramming

Multiprocessing - A computer using more than one CPU at a time http://en.wikipedia.org/wiki/Multiprocessing

多处理 - 一次使用多个 CPU 的计算机 http://en.wikipedia.org/wiki/Multiprocessing

Multitasking - Tasks sharing a common resource (like 1 CPU) http://en.wikipedia.org/wiki/Computer_multitasking#Multithreading

多任务 - 共享公共资源(如 1 个 CPU)的任务 http://en.wikipedia.org/wiki/Computer_multitasking#Multithreading

  • Thus, something like multithreading is an extension of multitasking.
  • 因此,像多线程这样的东西是多任务的扩展。

回答by Rajendra Uppal

Multiprogramming:More than one task/program/job/process can reside into the main memoryat one point of time. This ability of the OS is called multiprogramming.

多道程序设计:一个时间点可以有多个任务/程序/作业/进程驻留在主内存中。操作系统的这种能力称为多道程序设计。

Multitasking:More than one task/program/job/process can reside into the same CPUat one point of time. This ability of the OS is called multitasking.

多任务:在一个时间点,多个任务/程序/作业/进程可以驻留在同一个 CPU中。操作系统的这种能力称为多任务处理。

回答by Manas

None of the above answers except Mr Vaibhav Kumar's are clear or not ambiguous. [sorry, no offense]

除了 Vaibhav Kumar 先生的回答之外,以上所有回答都没有明确或不含糊。【抱歉,无意冒犯】

Both multi programming and tasking are same concept of switching task in processor, difference is in the concept and reason of the switching.

多道程序设计和任务处理都是处理器中切换任务的同一个概念,不同之处在于切换的概念和原因。

MProgramming: to not keep processor idle when active task needs longer IO or other non CPU response then, processor loads and works on another task that is not waiting for IO and ready for process.

MProgramming:当活动任务需要更长的 IO 或其他非 CPU 响应时不让处理器空闲,然后处理器加载并处理另一个不等待 IO 并准备好处理的任务。

MTasking: even after MPrograming, to user it may feel like only one task is executing and another is simply waiting to come to cpu. So the active task is also swapped from active CPU and kept aside and another task is brought in CPU for a very small fraction of human time[second], and swapped back to the earlier task again. In this way user will feel both task are alive in CPU at same time. But actually each task is active only once at a given CPU time[in micro or nano second]

MTasking:即使在 MPrograming 之后,用户也可能会觉得只有一个任务在执行,而另一个任务只是在等待进入 CPU。因此,活动任务也从活动 CPU 交换并保留在一边,另一个任务被带到 CPU 中占用很少的人工时间[秒],然后再次交换回较早的任务。通过这种方式,用户会感觉到两个任务同时在 CPU 中处于活动状态。但实际上每个任务在给定的 CPU 时间内仅活动一次 [以微秒或纳秒为单位]

And MProcessing is, like my computer have quad core, so I use 4 processor at a time, means 4 different multiprogramming instances happen in my machine. And these 4 processors does another numerous no of MTasking.

MProcessing 就像我的计算机有四核一样,所以我一次使用 4 个处理器,这意味着我的机器中发生了 4 个不同的多道程序实例。而这 4 个处理器又做了无数次 MTasking。

So MProcessing>MProgramming>Mtasking

所以MProcessing>MProgramming>Mtasking

And MThreading n another breakup of each task. that also to give user a happy life. Here multiple tasks[like word doc and media player] are not coming in picture, rather small subtasks like coloring of text on word and automatic spell check in word are part of same word executable.

和 MThreading n 的每个任务的另一个分解。这也是为了给用户带来幸福的生活。在这里,多个任务[如 word doc 和媒体播放器] 没有出现,而像 word 上的文本着色和 word 中的自动拼写检查这样的小子任务是同一单词可执行文件的一部分。

not sure if I was able to make clear all confusions...

不知道我是否能够澄清所有的困惑......

回答by Palak Jain

Multitasking- It is also called time sharing because multiple tasks(or processes) can be switched regularly, in a particular time, so that the user can get a view that they are operating concurrently.

多任务- 也称为分时,因为可以在特定时间定期切换多个任务(或进程),以便用户可以查看它们正在并发操作。

Multi-threading- To make the user experience richer, the tasks(in a single process) are further divided into sub-tasks. These sub-tasks then can operate in a multi-tasking environment.

多线程- 为了让用户体验更丰富,任务(在单个进程中)被进一步划分为子任务。这些子任务然后可以在多任务环境中运行。

Multiprocessing- It is the process of having multiple processors to run a process(or program), in a given time. It decreases the computation time.

多处理- 它是在给定时间内让多个处理器运行进程(或程序)的过程。它减少了计算时间。

Multi programming- It is used in batch operating systems, generally. Here, the job(or process) gets the full CPU and memory while execution. Multi programming is the system in which many different programs are loaded in computer's main memory, and the first one begins to run. When it finishes its execution(i.e., in running state) and waits for peripheral(i.e., waiting state), the next process begins to run. This is in contrast to multi-tasking, in which case each task is allotted a time slot(also called quantum) for its execution.

多重编程- 一般用于批处理操作系统。在这里,作业(或进程)在执行时获得完整的 CPU 和内存。多路编程是将许多不同的程序加载到计算机的主存储器中,并开始运行第一个程序的系统。当它完成执行(即处于运行状态)并等待外围设备(即等待状态)时,下一个进程开始运行。这与多任务处理形成对比,在这种情况下,每个任务都被分配一个时隙(也称为量子)来执行。

回答by Jay Halani

Multiprogramming- Jobs to be executed are loaded into a pool. Some number of those jobs are loaded into main memory, and one is selected from the pool for execution by the CPU. If at some point the program in progress terminates or requires the services of a peripheral device, the control of the CPU is given to the next job in the pool. As programs terminate, more jobs are loaded into memory for execution, and CPU control is switched to another job in memory. In this way the CPU is always executing some program or some portion thereof, instead of waiting for a printer, tape drive, or console input

多道程序——要执行的作业被加载到一个池中。这些作业中的一些被加载到主内存中,并且从池中选择一个由 CPU 执行。如果在某个时刻正在进行的程序终止或需要外围设备的服务,则 CPU 的控制权将交给池中的下一个作业。随着程序终止,更多的作业被加载到内存中执行,并且 CPU 控制被切换到内存中的另一个作业。通过这种方式,CPU 总是在执行某个程序或其中的某个部分,而不是等待打印机、磁带驱动器或控制台输入

Multiprocessing - the simultaneous execution of two or more programs or instruction sequences by separate CPUs under integrated control

多处理 - 在集成控制下由单独的 CPU 同时执行两个或多个程序或指令序列

multitasking System - the concurrent or interleaved execution of two or more jobs by a single CPU.

多任务系统 - 由单个 CPU 并发或交错执行两个或多个作业。

Multiusers System - a computer system in which multiple terminals connect to a host computer that handles processing tasks.

多用户系统 - 一种计算机系统,其中多个终端连接到处理处理任务的主机。

回答by vaibhav kumar

Multiprogramming and multitasking; both solve different problems, though they use similar method of switching between processes.

多道程序和多任务处理;两者都解决不同的问题,尽管它们使用类似的方法在进程之间切换。

Multiprogramming: It was seen in early days that certain processes at times need to use peripherals (e.g.: I/O), in which cases the CPU remained idle. To use the CPU more efficiently it was thought of having multiple processes in the memory so that if a certain process being executed needs a peripheral, certain other process might use the CPU. This was the idea behind multiprogramming.

多道程序:早期发现某些进程有时需要使用外设(例如:I/O),在这种情况下 CPU 保持空闲。为了更有效地使用 CPU,人们认为内存中有多个进程,以便如果正在执行的某个进程需要外设,则其他某个进程可能会使用 CPU。这就是多道程序背后的想法。

Multitasking: It is required that multiple process should appear to be running at the same time to the end user. So that is mocked by switching between these processes and by making them run on the CPU simultaneously. This is multitasking.

多任务:要求多个进程在最终用户看来是同时运行的。因此,通过在这些进程之间切换并使它们同时在 CPU 上运行来模拟。这是多任务处理。

回答by joash yegon-Kabarak UNiversity

Multiprogramming- A computer running more than one program at a time (like running Excel and Firefox simultaneously)

多道程序- 一次运行多个程序的计算机(如同时运行 Excel 和 Firefox)

Multiprocessing- A computer using more than one CPU at a time

多处理- 一次使用多个 CPU 的计算机

Multiprogramming- More than one task/program/job/process can reside into the main memory at one point of time. This ability of the OS is called multiprogramming.

多道程序设计- 一个时间点可以有多个任务/程序/作业/进程驻留在主内存中。操作系统的这种能力称为多道程序设计。

Multitasking: More than one task/program/job/process can reside into the same CPU at one point of time. This ability of the OS is called multitasking.

多任务处理:一个时间点可以有多个任务/程序/作业/进程驻留在同一个 CPU 中。操作系统的这种能力称为多任务处理。

Multiusers System- a computer system in which multiple terminals connect to a host computer that handles processing tasks.

多用户系统- 一种计算机系统,其中多个终端连接到处理处理任务的主机。

回答by sangita

Multiprogramming: It means running several programs on computer.Here user cannot interact with the system,everything is decided by the OS.

多道程序:是指在计算机上运行多个程序。此时用户无法与系统交互,一切由操作系统决定。

Multitasking: It is a logical extension of multiprogramming.It means running several tasks on computer.Switching between the jobs is so fast that the user can interact with the system.

多任务:它是多道程序的逻辑扩展。它意味着在计算机上运行多个任务。作业之间的切换非常快,用户可以与系统进行交互。

Multithreading: Basically seen when more number of clients access the server.

多线程:当更多的客户端访问服务器时基本上会出现。

回答by sangita

Multitasking - This is basically multiprogramming in the context of a single-user interactive environment, in which the OS switches between several programs in main memory so as to give the illusion that several are running at once. Common scheduling algorithms used for multitasking are: Round-Robin, Priority Scheduling (multiple queues), Shortest-Process-Next.

多任务处理 - 这基本上是单用户交互环境中的多道程序设计,其中操作系统在主内存中的多个程序之间切换,从而产生多个程序同时运行的错觉。用于多任务的常用调度算法有:轮询、优先级调度(多队列)、最短进程-下一个。

MULTIPROCESSING is like the OS handling the different jobs in main memory in such a way that it gives its time to each and every job when other is busy for some task such as I/O operation. So as long as at least one job needs to execute, the cpu never sit idle. and here it is automatically handled by the OS,

MULTIPROCESSING 就像操作系统处理主内存中的不同作业,当其他作业忙于某些任务(例如 I/O 操作)时,它会为每个作业分配时间。因此,只要至少有一项作业需要执行,cpu 就永远不会闲置。在这里它由操作系统自动处理,

回答by VIKASH MAINANWAL

MultithreadingMultithreading extends the idea of multitasking into applications, so you can subdivide specific operations within a single application into individual threads.

线程线程将多任务处理的思想扩展到应用程序中,因此您可以将单个应用程序中的特定操作细分为单独的线程。