计算机操作系统_第1页
计算机操作系统_第2页
计算机操作系统_第3页
计算机操作系统_第4页
计算机操作系统_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

操操 作作 系系 统统 实实 验验 报报 告告 学号 姓名 班级 实验一 Linux 基础与进程管理 一 实验目的 熟悉 linux 系统 二 实验内容 进入和退出系统 进程查看 主要介绍几个常用的联机帮助命令 命令行模式 文本输入模式 末行模式 vi 的基本操作 命令模式下功能键简介 Linux 下 C 语言编程基础知识 进程创建等系统调用简介 三 源代码 whowhowho命令命令命令 pspsps命令命令命令 toptoptop命令命令命令 manmanman命令命令命令 helphelphelp命令命令命令 whereiswhereiswhereis命令命令命令 1 1 1 进入文本输入模式进入文本输入模式进入文本输入模式 i i i 插入插入插入 从目前游标所在之处插入所输入之文字 从目前游标所在之处插入所输入之文字 从目前游标所在之处插入所输入之文字 a a a 增加增加增加 目前游标所在之下一个字开始输入文字 目前游标所在之下一个字开始输入文字 目前游标所在之下一个字开始输入文字 o o o 从新的一行行首开始输入文字 从新的一行行首开始输入文字 从新的一行行首开始输入文字 2 2 2 移动游标移动游标移动游标 h h h j j j k k k l l l 分别控制游标左 下 上 右移一格 分别控制游标左 下 上 右移一格 分别控制游标左 下 上 右移一格 b b b 往後一页 往後一页 往後一页 f f f 往前一页 往前一页 往前一页 G G G 移到档案最後 移到档案最後 移到档案最後 0 0 0 移到档案开头 移到档案开头 移到档案开头 3 3 3 删除删除删除 x x x 删除一个字元 删除一个字元 删除一个字元 x x x 例例例 3x3x3x 表删除表删除表删除3 3 3个字元 个字元 个字元 dddddd 删除游标所在之行 删除游标所在之行 删除游标所在之行 dd dd dd 例例例 3dd3dd3dd表删除自游标算起之表删除自游标算起之表删除自游标算起之3 3 3行 行 行 4 4 4 更改更改更改 cwcwcw 更改游标处之字到字尾更改游标处之字到字尾更改游标处之字到字尾 处 处 处 c wc wc w 例例例 c3wc3wc3w 表更改表更改表更改3 3 3个字 个字 个字 5 5 5 取代取代取代 r r r 取代游标处之字元 取代游标处之字元 取代游标处之字元 6 6 6 复制复制复制 ywywyw 拷贝游标处之字到字尾 拷贝游标处之字到字尾 拷贝游标处之字到字尾 yyyyyy 可使光标目前所在位置的行整行复制 可使光标目前所在位置的行整行复制 可使光标目前所在位置的行整行复制 p p p 复制复制复制 put put put 到所要之处 到所要之处 到所要之处 指令指令指令 ywywyw 与与与 p p p 必须搭配使用 必须搭配使用 必须搭配使用 7 7 7 跳至指定之行跳至指定之行跳至指定之行 g g g 列出行号列出行号列出行号 G G G 例例例 44G44G44G 表移动游标至第表移动游标至第表移动游标至第 444444 行行首 行行首 行行首 getpidgetpidgetpid getpid test cgetpid test cgetpid test c include include include 提供函数的定义提供函数的定义提供函数的定义 main main main printf Theprintf Theprintf The currentcurrentcurrent processprocessprocess IDIDID isisis d n getpid d n getpid d n getpid 编译并运行程序编译并运行程序编译并运行程序getpid test cgetpid test cgetpid test c gcc gcc gcc getpid test cgetpid test cgetpid test c o o o getpid testgetpid testgetpid test getpid test getpid test getpid test TheTheThe currentcurrentcurrent processprocessprocess IDIDID is is is 198019801980 forkforkfork fork test cfork test cfork test c include include include inlcude inlcude inlcude main main main pid tpid tpid t pid pid pid 此时仅有一个进程此时仅有一个进程此时仅有一个进程 pid fork pid fork pid fork 此时已经有两个进程在同时运行此时已经有两个进程在同时运行此时已经有两个进程在同时运行 if pid 0 if pid 0 if pid 0 printf errorprintf errorprintf error ininin fork fork fork elseelseelse if pid 0 if pid 0 if pid 0 printf Iprintf Iprintf I amamam thethethe childchildchild process process process mymymy processprocessprocess IDIDID isisis d n getpid d n getpid d n getpid elseelseelse printf Iprintf Iprintf I amamam thethethe parentparentparent process process process mymymy processprocessprocess IDIDID isisis d n getpid d n getpid d n getpid gcc gcc gcc fork test cfork test cfork test c o o o fork testfork testfork test fork test fork test fork test I I I amamam thethethe parentparentparent process process process mymymy processprocessprocess IDIDID isisis 199119911991 I I I amamam thethethe childchildchild process process process mymymy processprocessprocess IDIDID is is is 199219921992 exitexitexit exit test1 cexit test1 cexit test1 c include include include main main main printf thisprintf thisprintf this processprocessprocess willwillwill exit n exit n exit n exit 0 exit 0 exit 0 printf neverprintf neverprintf never bebebe displayed n displayed n displayed n waitwaitwait zombie czombie czombie c include include include include include include main main main pid tpid tpid t pid pid pid pid fork pid fork pid fork if pid 0 if pid 0 if pid 0 如果出错如果出错如果出错 printf errorprintf errorprintf error occurred n occurred n occurred n elseelseelse if pid 0 if pid 0 if pid 0 如果是子进程如果是子进程如果是子进程 exit 0 exit 0 exit

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论