zoukankan      html  css  js  c++  java
  • 【Ubuntu 笔记】翻译 32.1 Job Control

    一、前

      对后面的内容更感兴趣,直接跳这里看,中间的是一些shell操作什么的。

      23章 Job Control

      估计从这篇开始就有很多我没概念的名词出现了,边读边记为知识点,读完一边回来看看。

    二、原文

      http://docstore.mik.ua/orelly/unix3/upt/ch23_01.htm#sect1

    三、something摘要

      multiprocessing

      init进程

      getty

      daemon  守护进程

    四、译文

      再次重申,Unix是一个多重处理的系统(multiprocessing system).不像历史上其他的系统(如MS-DOS),所有基于Unix的系统在某时都运行了不止一个进程。事实上,当Unix启动的时候,第一个启动的程序叫做init,这个init进程是其后所有进程的祖先。init直接创建了供其他程序运行的进程,如getty,以及各样的rc setup 文件。一定程度上可以说,用户登陆系统时,getty程序为这个seesion创建了一个新的shell。就算系统在单一用户模式,Unix还是可以支持多处理,在Unix中多处理是无孔不入的。

      多重处理不仅针对于系统守护进程,它也使得你的交互式shell更高效。很多时候,你要运行一个会耗时很久的程序。比如,你要从FTP,Lynx上下载一个文件。我们就可以把下载放到后台中去继续完成,同时输入新命令执行。当程序在你的屏幕上显示或者在等待接受输入时,我们说进程在前台运行。 用桌面类比,前台进程就是在你面前的那堆工作,一个时间点上桌面上只能运行一个工作。把进程放到后台就是把工作栈放到地板上。如果你的桌子跟我的一样,那么你马上就会发现你被成堆的工作包围了。跟真实世界不同的是,Unix可以把在后台完成工作。前台进程和后台进程的管理和调度被称为job control作业控制。理解了作业控制之后,你就可以更好的利用你的Unix系统了。

      作业控制上的一个谨慎的忠告:天下没有白吃的午餐。(There is no such thing as a free lunch)。换言之,Unix随你高兴将进程放入后台,但他们依然要占用CPU,RAM和硬件驱动资源。如果某个进程掌控了其他的资源,那么那些被掌控了资源的进程放在后台运行不会比你在前台一个一个运行快。所以如果你在运行一个很占用CPU的进程,那么在那台机子上再怎么前台后台运行别的程序都没有意义。

      从大型主机用卡片提交任务开始,就有’job control‘的概念了。下面的表格某种程度上展示了shell的job control特性。对于那些对job control概念很熟的人来说,这是第32版的“job contol is Nutshell"

    Summary Box

    Unless otherwise noted, these commands apply only to the C shell, Korn shell, and bash:


    command & (Section 23.3)
    Run command in the background. You can continue to execute jobs in the foreground. This is the most common way to put processes in the background.

    CTRL-c (Section 24.11)
    Kill the current foreground job by sending the INTR signal (Section 24.10).

    CTRL-z (Section 23.3, Section 23.6)
    Suspend the current foreground job by sending the TSTP signal (Section 24.10).

    suspend
    Suspend a shell with the suspend command.

    stop
    Suspend a background job with the stop command or an alias that does the same thing (Section 23.7).

    bg %num (Section 23.3)
    Let a stopped job (by job number num) continue in the background.

    fg %num (Section 23.3)
    Put a background job or a stopped job (by job number num) into the foreground.

    kill %num (Section 23.3)
    Kill an arbitrary background job (by job number num).

    kill pid (Section 24.12)
    Kill an arbitrary job (by process ID number num).

    jobs (Section 23.3)
    List background and stopped jobs and their job numbers.

    set notify (Section 23.8)
    Immediate job-state change notices.

    stty tostop (Section 23.9)
    Automatically stop background processes if they try writing to the screen.

      有些系统,如linux将kill扩展为kill进程,Section 24.15介绍了killall

    --ML and JJ

  • 相关阅读:
    Jmeter_完成文件批量下载
    Jmeter_文件的下载
    Jmeter_针对一个账户批量上传文件
    Jmeter上传文件操作
    Jmeter_获取结果写到excel
    Jmeter_接口串联自动化测试_登录后充值获取cookie
    JS 对象(Object)和字符串(String)互转
    全国图书馆参考咨询联盟关闭文献传递功能解决办法
    Geodesic Distance:两点间的最短距离之法截弧/等角航线/测地线
    空间数据库基础理论 GIS空间数据处理分析涉及的基本概念
  • 原文地址:https://www.cnblogs.com/hundan/p/2246049.html
Copyright © 2011-2022 走看看