91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 89KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2021-06-23
  • 語言: 其他
  • 標簽: 操作系統??

資源簡介

山東大學操作系統實驗代碼,其中包含五個實驗分別放置了文件夾

資源截圖

代碼片段和文件信息

/**
Author:Inno?Jia
@?www.innohub.top
**/
#include?“pctrl.h“


char?*args[]?=?{“/bin/ls““-l“NULL};
int?status;
int?status1;

void?child_ls()
{

int?i;
for(i=0;?args[i]?!=?NULL;?i++)?
printf(“%s?“args[i]);
printf(“\n“);
//裝入并執行新的程序
????//?execve(args[0]argsNULL);
????status?=?system(“/bin/ls?-l“);


}

void?child_ps()
{


printf(“ps?-l\n“);
//裝入并執行新的程序
????//?execve(args[0]argsNULL);
????status1?=?system(“ps?-l“);
//?sleep(3);

}
int?main(int?argc?char?*argv[])
{


while(1)
{
int?pid1;
int?pid2;
//存放子進程號

//signal(SIGINT(sighandler_t)sigcat);?注冊一個本進程處理鍵盤中斷的函數
pid1=fork()?;?//建立子進程

if(pid1<0)?//?建立子進程失敗?
{
printf(“Create?Process?fail!\n“);
exit(EXIT_FAILURE);
}
if(pid1?==?0)?//?子進程執行代碼段
{
//報告父子進程進程號
printf(“I?am?Child?process?%d\nMy?father?is?%d\n“getpid()getppid());
printf(“%d?child?will?Running:?\n“getpid());?//
printf(“The?ls?command!\n“);
????sleep(1);
child_ls();

exit(0);

}
else
{
printf(“\nI?am?Parent?process?%d\n“getpid());

pid2?=?fork();
if(pid2?<0)
{
printf(“Child?Process?Failed!\n“);
}
if(pid2==0)
{
printf(“I?am?Child?process?%d\nMy?father?is?%d\n“getpid()getppid());
printf(“%d?child?will?Running:?\n“getpid());?//
printf(“The?ps?command!\n“);

child_ps();

exit(0);
}
if(pid2?>?0)//父進程執行代碼段
{


waitpid(pid2&status10);
waitpid(pid1?&status0);

kill(pid2?SIGINT);
printf(“ps?process?over:%d\n“?pid1);
kill(pid1?SIGINT);
printf(“ls?process?over:%d\n“?pid1);
}
?}

sleep(3);
}

return?EXIT_SUCCESS;
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????12288??2018-04-10?16:41??操作系統代碼\Work1\.makefile.swo

?????文件??????12288??2018-04-10?16:40??操作系統代碼\Work1\.makefile.swp

?????文件????????174??2018-04-10?16:41??操作系統代碼\Work1\makefile

?????文件??????10952??2018-04-10?16:36??操作系統代碼\Work1\pctl

?????文件???????1770??2018-04-13?11:38??操作系統代碼\Work1\pctrl.c

?????文件????????266??2018-04-09?21:33??操作系統代碼\Work1\pctrl.h

?????文件???????7320??2018-04-10?16:36??操作系統代碼\Work1\pctrl.o

?????文件????????190??2018-04-16?16:36??操作系統代碼\Work2\makefile

?????文件????????154??2018-04-15?23:26??操作系統代碼\Work2\test\makefile

?????文件??????10408??2018-04-16?15:35??操作系統代碼\Work2\test\ppipe

?????文件???????2039??2018-04-16?15:34??操作系統代碼\Work2\test\ppipe.c

?????文件???????2153??2018-04-15?23:19??操作系統代碼\Work2\test\tpipe.c

?????文件??????15768??2018-04-16?17:00??操作系統代碼\Work2\thread_func

?????文件???????3329??2018-04-16?17:00??操作系統代碼\Work2\thread_func.c

?????文件??????10176??2018-04-16?17:00??操作系統代碼\Work2\thread_func.o

?????文件????????163??2018-04-23?15:37??操作系統代碼\Work3\makefile

?????文件??????15776??2018-05-21?11:04??操作系統代碼\Work3\psched

?????文件???????3013??2018-04-23?18:38??操作系統代碼\Work3\psched.c

?????文件???????8504??2018-05-21?11:04??操作系統代碼\Work3\psched.o

?????文件???????8688??2018-05-21?11:05??操作系統代碼\Work3\test

?????文件????????224??2018-05-21?11:05??操作系統代碼\Work3\test.c

?????文件???????4191??2018-05-07?17:12??操作系統代碼\Work4\ipc.c

?????文件???????1224??2018-04-30?20:41??操作系統代碼\Work4\ipc.h

?????文件??????13160??2018-04-30?20:45??操作系統代碼\Work4\ipc.o

?????文件????????372??2018-04-30?20:30??操作系統代碼\Work4\makefile

?????文件??????19848??2018-04-30?20:45??操作系統代碼\Work4\smoker

?????文件???????3050??2018-04-30?20:45??操作系統代碼\Work4\smoker.c

?????文件???????9448??2018-04-30?20:45??操作系統代碼\Work4\smoker.o

?????文件??????20000??2018-04-30?20:45??操作系統代碼\Work4\supplier

?????文件???????2841??2018-04-30?20:40??操作系統代碼\Work4\supplier.c

............此處省略24個文件信息

評論

共有 條評論