⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linux 进程管理 linuxsir_org.htm

📁 linuxSir 网站的精华文章
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0040)http://www.linuxsir.org/main/?q=node/210 -->
<HTML lang=zh-hans xml:lang="zh-hans" 
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Linux 进程管理 | LinuxSir.Org</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css media=all>@import url( misc/drupal.css );
</STYLE>

<STYLE type=text/css media=all>@import url( modules/taxonomy_context/taxonomy_context.css );
</STYLE>
<LINK media=screen href="Linux 进程管理  LinuxSir_Org.files/menuExpandable3.css" 
type=text/css rel=stylesheet>
<SCRIPT src="Linux 进程管理  LinuxSir_Org.files/menuExpandable3.js" 
type=text/javascript></SCRIPT>
<LINK href="Linux 进程管理  LinuxSir_Org.files/common.css" type=text/css 
rel=stylesheet>
<STYLE type=text/css media=all>@import url( themes/chameleon/marvin/style.css );
</STYLE>

<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV id=header><A title=Home href="http://www.linuxsir.org/main/"><IMG alt=Home 
src="Linux 进程管理  LinuxSir_Org.files/logo.jpg"></A></DIV>
<DIV class=navlinks>
<DIV class=primary><A href="http://www.linuxsir.org/main/?q"><FONT 
color=white>首页</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/34"><FONT 
color=white>事件</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/1/25/"><FONT 
color=white>文档</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/35/48/"><FONT 
color=white>资源</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=search"><FONT color=white>搜索</FONT></A> | 
<A href="http://www.linuxsir.org/bbs"><FONT color=white>论坛</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=taxonomy/term/38"><FONT 
color=white>贡献者</FONT></A> | <A 
href="http://www.linuxsir.org/main/?q=node/3"><FONT color=white>关于</FONT></A> | 
<A href="http://www.linuxsir.org/main/?q=user"><FONT 
color=white>注册/登录</FONT></A></DIV></DIV>
<TABLE id=content>
  <TBODY>
  <TR>
    <TD id=sidebar-left>
      <DIV class="block block-block" id=block-block-1>
      <H2 class=title>子站索引</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://fedora.linuxsir.org/" target?_blank?>Fedora中文</A> 
        <LI><A href="http://debian.linuxsir.org/" target?_blank?>Debian中文</A> 
        <LI><A href="http://lfs.linuxsir.org/" target?_blank?>LFS 中文</A> 
        <LI><A href="http://slack.linuxsir.org/">Slackware</A> 
        <LI><A href="http://gentoo.linuxsir.org/">Gentoo中文</A> 
        <LI><A href="http://arch.linuxsir.org/">Arch 中文</A> </LI></UL></DIV></DIV>
      <DIV class="block block-block" id=block-block-3>
      <H2 class=title>重要资讯</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/36">本站公告</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/34">新闻事件</A> 
        <LI><A href="http://www.linuxsir.org/bbs" target=_blank>本站论坛</A> 
        <LI><A href="http://www.linuxsir.org/main/?q=taxonomy/term/38">贡 献 者</A> 
        </LI></UL></DIV></DIV>
      <DIV class="block block-block" id=block-block-7>
      <H2 class=title>项目索引</H2>
      <DIV class=content>
      <UL>
        <LI><A href="http://www.fcitx.org/" target=_blank>小企鹅输入法</A> 
        <LI><A href="http://lumaqq.linuxsir.org/" target=_blank>LumaQQ</A> 
        <LI><A href="http://openq.linuxsir.org/" target=_blank>OpenQ</A> 
        <LI><A href="http://www.relaxbsd.org/" target=_blank>RelaxBSD</A> 
      </LI></UL></DIV></DIV>
      <DIV class="block block-user" id=block-user-1>
      <H2 class=title>站点导航</H2>
      <DIV class=content>
      <DIV class=menu>
      <UL>
        <LI class=leaf><A title=注册/登录 
        href="http://www.linuxsir.org/main/?q=user">注册/登录</A> 
        <LI class=collapsed><A 
        href="http://www.linuxsir.org/main/?q=aggregator">新闻聚合</A> 
      </LI></UL></DIV></DIV></DIV>
      <DIV class="block block-aggregator" id=block-aggregator-feed-2>
      <H2 class=title>LinuxSir.Org 论坛</H2>
      <DIV class=content>
      <DIV class=item-list>
      <UL>
        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266922&amp;goto=newpost">如何在FvwmButtons中使用系统托盘?</A> 

        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266921&amp;goto=newpost">FC5 
        root 的垃圾箱被彻底删掉了,怎么恢复?</A> 
        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266920&amp;goto=newpost">我想做一个mini 
        linux 该怎么下手呢~</A> 
        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266919&amp;goto=newpost">FC5体验之影音篇</A> 

        <LI><A 
        href="http://www.linuxsir.org/bbs/showthread.php?t=266918&amp;goto=newpost">请教高手:FEDORA 
        4 安装问题</A> </LI></UL></DIV>
      <DIV class=more-link><A title=查看此feed的最新消息 
      href="http://www.linuxsir.org/main/?q=aggregator/sources/2">更多</A></DIV></DIV></DIV>
      <DIV class="block block-user" id=block-user-2>
      <H2 class=title>最新注册</H2>
      <DIV class=content>
      <DIV class=item-list>
      <UL>
        <LI>horiwa
        <LI>jiechu
        <LI>emiss
        <LI>ismart
        <LI>mynamewsy</LI></UL></DIV></DIV></DIV>
      <DIV class="block block-user" id=block-user-3>
      <H2 class=title>当前在线</H2>
      <DIV class=content>0 users 和 69 游客 在线</DIV></DIV></TD>
    <TD id=main>
      <DIV class=breadcrumb><A href="http://www.linuxsir.org/main/?q=">首页</A> » 
      <A href="http://www.linuxsir.org/main/?q=taxonomy/term/1">Linux</A></DIV>
      <H2>Linux 进程管理</H2><!-- begin content -->
      <DIV class=node>
      <DIV class=content>
      <P><B>作者:</B>北南南北<BR><B>来自:</B>LinuxSir.Org<BR><B>摘要:</B>本文讲述的时进程管理的基本概念和进程管理工具介绍;文中的重点对进程管理工具的分类介绍及应用举例,包括 
      ps、pgrep、top 、kill、pkill、killall、nice和renice 等工具。</P>
      <P><FONT size=4><B>目录</B></FONT></P>
      <UL><A href="http://www.linuxsir.org/main/?q=node/210#1">1、程序和进程;</A>
        <P></P>
        <UL><A href="http://www.linuxsir.org/main/?q=node/210#1.1">1.1 
          进程分类;</A><BR><A 
          href="http://www.linuxsir.org/main/?q=node/210#1.2">1.2 
          进程的属性;</A><BR><A 
          href="http://www.linuxsir.org/main/?q=node/210#1.3">1.3 父进程和子进程;</A> 
        </UL>
        <P><A href="http://www.linuxsir.org/main/?q=node/210#2">2、进程管理;</A></P>
        <UL><A href="http://www.linuxsir.org/main/?q=node/210#2.1">2.1 ps 
          监视进程工具;</A>
          <P></P>
          <UL><A href="http://www.linuxsir.org/main/?q=node/210#2.1.1">2.1.1 
            ps参数说明;</A><BR><A 
            href="http://www.linuxsir.org/main/?q=node/210#2.1.2">2.1.2 ps 
            应用举例;</A> </UL>
          <P><A href="http://www.linuxsir.org/main/?q=node/210#2.2">2.2 pgrep 
          </A></P></UL>
        <P><A href="http://www.linuxsir.org/main/?q=node/210#3">3、终止进程的工具 kill 
        、killall、pkill、xkill;</A></P>
        <UL><A href="http://www.linuxsir.org/main/?q=node/210#3.1">3.1 kill 
          </A><BR><A href="http://www.linuxsir.org/main/?q=node/210#3.2">3.2 
          killall </A><BR><A 
          href="http://www.linuxsir.org/main/?q=node/210#3.3">3.3 pkill 
          </A><BR><A href="http://www.linuxsir.org/main/?q=node/210#3.4">3.4 
          xkill </A></UL>
        <P><A href="http://www.linuxsir.org/main/?q=node/210#4">4、top 
        监视系统任务的工具;</A></P>
        <UL><A href="http://www.linuxsir.org/main/?q=node/210#4.1">4.1 top 
          命令用法及参数;</A><BR><A 
          href="http://www.linuxsir.org/main/?q=node/210#4.2">4.2 top 应用举例;</A> 
        </UL>
        <P><A href="http://www.linuxsir.org/main/?q=node/210#5">5、进程的优先级: 
        nice和renice;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/210#6">6、关于本文;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/210#7">7、后记;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/210#8">8、参考文档;</A><BR><A 
        href="http://www.linuxsir.org/main/?q=node/210#9">9、相关文档;</A> </P></UL>
      <P><FONT 
      color=blue><B><BR>++++++++++++++++++++++++++++++++++++++<BR>正文<BR>++++++++++++++++++++++++++++++++++++++<BR></B></FONT></P>
      <P><FONT id=1 size=4><B><BR>1、程序和进程;<BR></B></FONT></P>
      <P>程序是为了完成某种任务而设计的软件,比如OpenOffice是程序。什么是进程呢?进程就是运行中的程序。</P>
      <P>一个运行着的程序,可能有多个进程。 比如 LinuxSir.Org 
      所用的WWW服务器是apache服务器,当管理员启动服务后,可能会有好多人来访问,也就是说许多用户来同时请求httpd服务,apache服务器将会创建有多个httpd进程来对其进行服务。</P>
      <P><FONT id=1.1 size=3><B><BR>1.1 进程分类;<BR></B></FONT></P>
      <P>进程一般分为交互进程、批处理进程和守护进程三类。</P>
      <P>值得一提的是守护进程总是活跃的,一般是后台运行,守护进程一般是由系统在开机时通过脚本自动激活启动或超级管理用户root来启动。比如在Fedora或Redhat中,我们可以定义httpd 
      服务器的启动脚本的运行级别,此文件位于/etc/init.d目录下,文件名是httpd,/etc/init.d/httpd 
      就是httpd服务器的守护程序,当把它的运行级别设置为3和5时,当系统启动时,它会跟着启动。</P>
      <P>
      <DIV class=codeblock><CODE>[root@localhost ~]# chkconfig --level 35 httpd 
      on</CODE></DIV>
      <P></P>
      <P>由于守护进程是一直运行着的,所以它所处的状态是等待请求处理任务。比如,我们是不是访问 LinuxSir.Org ,LinuxSir.Org 
      的httpd服务器都在运行,等待着用户来访问,也就是等待着任务处理。</P>
      <P><FONT id=1.2 size=4><B><BR>1.2 进程的属性;<BR></B></FONT></P>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -