There are only two hard things in Computer Science: cache invalidation and naming things (计算科学中只有两件事最难:命名和缓存失效)    —— Phil Karlton

本文就是讨论一个命名的问题。作为开发者,我们经常看到Task和Job这两个词,而他们的中文翻译都是“任务”,很难分清这两者的区别,所以作者针对这两个概念搜集了一些资料,然后结合个人的一些经验,尝试来探讨这个话题。

英汉词典解释

首先看看两者的英文解释(Mac上的英汉・汉英词典,只看两者的名词解释)

task

task |tɑːsk, American tæsk|.noun
任务 rènwu
to perform or carry out a task执行任务
a thankless task费力不讨好的差事
a Herculean task艰苦卓绝的任务
to take or hold [somebody] to task (about or for or over [something])(因某事)训斥某人

job(由于job的解释过多,对例子进行了删减)

job |dʒɒb|A.noun
①(post)工作 gōngzuò
to have a job 有工作
②(piece of work)活儿 huórto have a job for [somebody] (to do) 有活儿给某人(做)
③(matter)事情 shìqing
the job in hand 手头的事情
④(assignment)任务 rènwu to have the job of doing [something]
⑤(result of work)成果 chéngguǒ
a good/poor/lovely job干得不错/干得很糟/招人喜欢的活儿
⑥(duty)职责 zhízé
it's [somebody's] job to do [something] 该由某人负责做某事
⑦(function)作用 zuòyòng
to have the job of doing [something] 具有做某事的作用
⑧colloquial (situation)情况 qíngkuàng
it's a good job (that) ... especially British 幸好…
⑨(difficult activity)难做的事 nán zuò de shì
a real job 很费力的事情
⑩colloquial (object)东西 dōngxi
the car was a fast-looking job 那辆车看上去跑得很快
⑪colloquial (crime)犯罪行为 fànzuì xíngwéi [尤指盗窃或抢劫]
to do a job 行窃
⑫Computing [作为单元处理的] 作业 zuòyè
you need to cancel all pending print jobs 你得取消所有待打印任务

可以看出,job的使用范围远远大于task,但是没有任务的解释。好吧,那我们看看中文任务的解释(Mac汉语词典)。

任务 rènwù
名 受委派担负的工作或责任。

任务=工作/责任 ???

所以在日常生活中,job是可以替代task的,task可以部分替代job,但是这并没有回答我们的疑问,那么task和job的区别到底是什么呢。

维基百科解释

我们去维基百科看看怎么说。首先是task

In computing, a task is a unit of execution or a unit of work. The term is ambiguous; precise alternative terms include process, light-weight process, thread (for execution), step, request, or query (for work). In the adjacent diagram, there are queues of incoming work to do and outgoing completed work, and a thread pool of threads to perform this work. Either the work units themselves or the threads that perform the work can be referred to as “tasks”, and these can be referred to respectively as requests/responses/threads, incoming tasks/completed tasks/threads (as illustrated), or requests/responses/tasks.

这里直接了当的说明了task的含义比较模糊,它有很多近义词,比如进程、线程、步骤、请求、查询等等。

然后我们来看看Job的解释

In computing, a job is a unit of work or unit of execution (that performs said work). A component of a job (as a unit of work) is called a task or a step (if sequential, as in a job stream). As a unit of execution, a job may be concretely identified with a single process, which may in turn have subprocesses (child processes; the process corresponding to the job being the parent process) which perform the tasks or steps that comprise the work of the job; or with a process group; or with an abstract reference to a process or process group, as in Unix job control.

Jobs can be started interactively, such as from a command line, or scheduled for non-interactive execution by a job scheduler, and then controlled via automatic or manual job control. Jobs that have finite input can complete, successfully or unsuccessfully, or fail to complete and eventually be terminated. By contrast, online processing such as by servers has open-ended input (they service requests as long as they run), and thus never complete, only stopping when terminated (sometimes called “canceled”): a server’s job is never done.

第一句几乎和task解释一模一样,这里提到job的一个组件称之为task或者step。另外提到一点是job一般会有一个最终状态,包括完成(成功或者失败)、未完成、被终止等等。

从维基百科的解释来看,我们基本上可以认为task更多的侧重运行状态,而job则是一个目标,更侧重于完成状态。一个job通常包括多个task。

techtarget解释

后来我google了一下,techtarget也有两者的一些解释,摘录一部分如下

task的解释

In computer programming, a task is a basic unit of programming that an operating system controls. Depending on how the operating system defines a task in its design, this unit of programming may be an entire program or each successive invocation of a program. Since one program may make requests of other utility programs, the utility programs may also be considered tasks (or subtasks). All of today’s widely-used operating systems support multitasking , which allows multiple tasks to run concurrently, taking turns using the resources of the computer.

这个解释基本上把task等同于进程/线程了。

job的解释

In certain computer operating systems, a job is the unit of work that a computer operator (or a program called a job scheduler) gives to the operating system. For example, a job could be the running of an application program such as a weekly payroll program. A job is usually said to be run in batch (rather than interactive) mode. The operator or job scheduler gives the operating system a “batch” of jobs to do (payroll, cost analysis, employee file updating, and so forth) and these are performed in the background when time-sensitive interactive work is not being done. In IBM mainframe operating systems (MVS, OS/390, and successors) a job is described with job control language (JCL). Jobs are broken down into job steps. An example of a job step might be to make sure that a particular data set or database needed in the job is made accessible.

这里job的解释主要是针对操作系统领域的,而且还简单归纳了两者的相似之处。(task通常表示交互式的任务,job表示后台自动化任务)

A similar term is task, a concept usually applied to interactive work. A multitasking operating system serving one or more interactive users can at the same time perform batch jobs in the background.

实际案例&总结

为了更好的理解这两个概念的区别,那我们找几个计算机领域的例子看一看。

首先是task,它用在哪些地方呢

然后是job(通过搜索可以发现计算机领域的job使用频率远远低于task,和日常使用刚好相反)

通过之前词典的解释和这些案例,可以得到下面这些结论。

参考资料

计算机领域中Task和Job的区别相关推荐

  1. 自动取款机属于计算机领域中的,《计算机知识》真题库290题

    <计算机知识>考点特训题库6 (1)(单选题)下列软件中不属于数据库管理系统的是(   ). A.Access B.Oracle C.Java D.SqlServer [参考答案]C. ( ...

  2. 计算机领域中信息经转化,统考计算机应用基础06091002真题

    <统考计算机应用基础06091002真题>由会员分享,可在线阅读,更多相关<统考计算机应用基础06091002真题(3页珍藏版)>请在人人文库网上搜索. 1.计算机应用基础2( ...

  3. 当前计算机领域中 有关计算机的性能指标,计算机文化基础真题(十七)

    1.有关信息与数据之间的联系,下列说法错误的是(B) A.信息是数据的内涵,是对数据语义的解释. B.数据是有用的信息,信息是数据的表现形式. C.从计算机的角度看,数据泛指那些可以被计算机接受并能够 ...

  4. 计算机领域中,增量是什么意思?

    计算机领域中,增量是什么意思?   增量一词在计算机行业中的很多领域都有使用.在不同的领域中,增量一词的具体含义需要结合那个领域的相关知识来解释,抽象出来的增量一词的含义可以概括如下.   增量是相对 ...

  5. 计算机用英语表示方法有哪些,在计算机领域中,通常用英文单词“bit”来表示( )...

    答案 查看答案 解析: [解析题]现代计算机系统由硬件系统和软件系统组成.人类直接操控硬件系统太复杂了,所以,将硬件的功能进行封装,只提供一个接口给人类使用,这个接口就是操作系统. [解析题]计算机网 ...

  6. 在计算机领域中 ascii码,在计算机领域中,ascii码用一个字节来干什么

    在计算机领域中,ASCII码用一个字节来表示一个字符,存入1024个字符需要的字节数是1KB.字节通常简写为"B",1KB等于1024B:一个字节来表示一个字符,存入1024个字符 ...

  7. 在计算机领域中英文单词byte表示,1在计算机领域中通常用英文单词byte来表示.doc...

    1.在计算机领域中,通常用英文单词"byte"来表示_. A. 字 B. 字长 C. 字节 D. 二进制位 2.在Windows中,同时显示多个应用程序窗口的正确方法是_. A. ...

  8. 在计算机领域中通常用英语单词bit来表示,1在计算机领域中,通常用英文单词“byte”来表示_。...

    1.在计算机领域中,通常用英文单词"byte"来表示_. A. 字 B. 字长 C. 字节 D. 二进制位 2.在Windows中,同时显示多个应用程序窗口的正确方法是_. A. ...

  9. 在计算机领域中通常用英语单词bit来表示,1在计算机领域中,通常用英文单词byte来表示资料...

    1在计算机领域中,通常用英文单词byte来表示资料 (3页) 本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦! 9.90 积分 1.在计算机领域中,通常用英文单词 ...

最新文章

  1. 聚类(Clustering)定义、聚类思想及形式、距离的度量
  2. Geoffrey Hinton专访:如何解释神经网络的变迁
  3. 用于阴影检测的 DSC 特征
  4. python下载文件到指定目录-Python获取指定文件夹下的文件名的方法
  5. 联想正遭遇第四道坎 柳传志对症下药
  6. java c语言union转换_C语言联合体(union)的使用方法及其本质-union
  7. Geoserver中切割离线瓦片TileLayer选项中没有900913选项(图层和图层组怎样配置TileLayers的切割选项)
  8. Java学习之Iterator(迭代器)的一般用法(转)
  9. Rocketmq基于docker部署并在Springboot中接入
  10. TensorFlow11CNN和全卷积神经网络
  11. spring mvc: xml练习
  12. 190225每日一句
  13. java过滤空号了停机号_手机空号、停机、注销,空号检测为你去除无效号码
  14. RDMA 、InfiniBand、IB卡、IB驱动 之间的关系!
  15. 【数据结构】【王道】【线性表】单链表的实现及基本操作(带头结点)(可直接运行)
  16. 科普:一片晶圆可以切多少个芯片?
  17. 农业技术:从能量的角度看农业革命(垄耕种植法)
  18. 共识算法POW原理及实现
  19. 电磁原理---电磁炉
  20. 查询国际学术会议的信息

热门文章

  1. MYSQL数据库连接字符串(connectionString)配置参数大全详解
  2. Arduino + SI5351 方波发生器
  3. 2021nhoi挖矿
  4. 焊工考试多少分及格?焊工考试答题技巧分享
  5. 常用Date日期方法
  6. [考研经验]2018北京理工大学计算机专硕 初试复试全程复习回顾
  7. 断点续传 文件服务器,文件服务器 断点续传
  8. pdf阅读器绿色版轻快PDF阅读器
  9. java栈实现--顺序栈
  10. JAVAWEB开发模式之JSP的几种开发模式、处理Cookie中文乱码