线程池处理多线程任务注意点_多程序,多任务,多处理和多线程之间的区别

本文介绍了多编程、多任务、多处理和多线程的区别,并重点讨论了多线程及线程池在处理任务时的要点。多任务是指操作系统在单处理器上看似同时执行多个任务,而多处理则涉及多CPU同时运行进程。多线程允许程序的多个部分并行执行,线程池则有效管理这些并发线程,提高系统效率。

线程池处理多线程任务注意点

In this tutorial you will learn about difference between multiprogramming, multitasking, multiprocessing and multithreading.

在本教程中,您将了解多编程,多任务,多处理和多线程之间的区别。

Although these terms seems similar but there are some differences between them which are given below.

尽管这些术语看起来很相似,但是它们之间有一些区别,如下所示。

多程序 (Multiprogramming)

Multiprogramming is also the ability of an operating system to execute more than one program on a single processor machine. More than one task/program/job/process can reside into the main memory at one point of time. A computer running excel and firefox browser simultaneously is an example of multiprogramming.
多程序编程也是操作系统在单处理器计算机上执行多个程序的能力。 一个时间点可以将多个任务/程序/作业/过程驻留到主存储器中。 同时运行excel和firefox浏览器的计算机是多程序编程的示例。
Multiprogramming
Memory layout for Multiprogramming System
多程序系统的内存布局

多任务 (Multitasking)

Multitasking is the ability of an operating system to execute more than one task simultaneously on a single processor machine. Though we say so but in reality no two tasks on a single processor machine can be executed at the same time. Actually CPU switches from one task to the next task so quickly that appears as if all the tasks are executing at the same time. More than one task/program/job/process can reside into the same CPU at one point of time.

多任务是操作系统在单处理器计算机上同时执行多个任务的能力。 尽管我们这么说,但实际上在同一处理器计算机上不能同时执行两个任务。 实际上,CPU从一个任务切换到下一个任务的速度如此之快,似乎所有任务都在同时执行。 同一时刻同一CPU可以驻留多个任务/程序/作业/进程。

Multitasking
Multitasking System
多任务处理系统

多处理 (Multiprocessing)

Multiprocessing is the ability of an operating system to execute more than one process simultaneously on a multi processor machine. In this, a computer uses more than one CPU at a time.

多处理是操作系统在多处理器计算机上同时执行多个进程的能力。 在这种情况下,一台计算机一次使用多个CPU。

Multiprocessing
Multiprocessing System
多处理系统

多线程 (Multithreading)

Multithreading is the ability of an operating system to execute the different parts of a program called threads at the same time. Threads are the light wait processes which are independent part of a process or program. In multithreading system, more than one threads are executed parallely on a single CPU.

多线程是操作系统同时执行称为线程的程序的不同部分的能力。 线程是轻等待进程,它们是进程或程序的独立部分。 在多线程系统中,在单个CPU上并行执行多个线程。

Image Credits: TutorialsPoint, National Instruments

图片来源: TutorialsPointNational Instruments

翻译自: https://www.thecrazyprogrammer.com/2014/12/difference-between-multiprogramming-multitasking-multiprocessing-multithreading.html

线程池处理多线程任务注意点

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值