操作系统project

操作系统project

ID:39558443

大小:179.50 KB

页数:27页

时间:2019-07-06

操作系统project_第1页
操作系统project_第2页
操作系统project_第3页
操作系统project_第4页
操作系统project_第5页
资源描述:

《操作系统project》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、一、实验题目:熟悉Linuxshell命令,熟悉fork,exec的使用.实验1,2当堂完成,报告编写实验1,2.二、实验目的:通过对相关linuxGNUc语法和命令的熟悉,可进一步了解linux操作系统的功能、结构;了解linux的进程创建方法,父子进程的关系,进程的回收,进程的不同状态等。三实验设备及环境:1.硬件设备:PC机一台2.软件环境:安装Linux操作系统,并安装相关的程序开发环境,如CC++tshbsh等编程语言环境。四实验内容及要求:1编写一个shell命令提示符,(1)包含以下内部命令:i.cd-ch

2、angethecurrentdefaultdirectoryto.Iftheargumentisnotpresent,reportthecurrentdirectory.Ifthedirectorydoesnotexistanappropriateerrorshouldbereported.ThiscommandshouldalsochangethePWDenvironmentvariable.ii.clr-clearthescreen.iii.dir-listthecontents

3、ofdirectoryiv.environ-listalltheenvironmentstringsv.echo-displayonthedisplayfollowedbyanewline(multiplespaces/tabsmaybereducedtoasinglespace)vi.help-displaytheusermanualusingthemorefiltervii.pause-pauseoperationoftheshelluntil'Enter'ispressedviii.q

4、uit-quittheshellix.Theshellenvironmentshouldcontainshell=/myshellwhere/myshellisthefullpathfortheshellexecutable(notahardwiredpathbacktoyourdirectory,buttheonefromwhichitwasexecuted)(2)在环境变量里添加parent=/myshell(3)支持批处理,如:myshellbatchfile(4)支持i/o-red

5、irection,如:programnamearg1arg2outputfile(5)支持后台运行,如:dir&(6)提示包含当前工作目录(7)用户手册(8)makefile文件2主机调度shell程序(1)实时进程基于先来先服务,同时抢占其他正在运行的低优先级的进程而立即被执行。这些实时进程能够一直运行到结束。(2)普通的用户进程在一个三级反馈的调度器上运行。调度器得到基本时间是1秒。这也是反馈调度器的时间量的值。五、实验方法内容1.需要的头文件(实验1,2共用)#include#include

6、o.h>#include#include#include2.主要的常量变量(实验1,2共用)pid_tp;3.主要模块(实验1,2共用)intmain(intargc,char*argv[])六.代码实验一代码://主函数#include#include#include#include#include#include#include"myio.h"#if

7、ndefFALSE#defineFALSE0#endif#ifndefTRUE#defineTRUE1#endifexternchar**environ;intmain(intargc,char**argv){intoldstdout,oldstdin;oldstdout=dup(1);oldstdin=dup(0);charinput[300];//inputstringchar*cmdline;char*cmd[20];charrmpath[100];char*execmd[20];charcwdstr[100];//paraments//va

8、lidcommandcharcmdbuf[300];//allthecommandgetcwd(rmpath,100);s

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。