資源簡介
吉林大學計算機科學與技術學院《操作系統》實驗,完全正確的程序代碼(Code::Blocks工程)、實驗報告、實驗指導書。
代碼片段和文件信息
#include?
#include?
#include?
#include?
#include?
#include?
#include?
//為什么在沒有使用信號量的情況下消費者也會等待生產者???
char?r_buf[4];
char?w_buf[4];
int?pipe_fd[2];
pid_t?pid1pid2pid3pid4;
int?producer(int?id);
int?consumer(int?id);
int?main()
{
if(pipe(pipe_fd)<0){
printf?(“管道創建錯誤!!\n“);
exit(-1);
}
else{
printf?(“管道創建成功!\n“);
if((pid1=fork())==0)
producer(1);
if((pid2=fork())==0)
producer(2);
if((pid3=fork())==0)
consumer(1);
if((pid4=fork())==0)
consumer(2);
}
close(pipe_fd[0]);
close(pipe_fd[1]);
int?ipidstatus;
for?(i=0;i<4;i++)
????????pid=wait(&status);
exit(0);
}
int?producer?(int?id){
printf?(“生產者?%d?正在運行!\n“id);
close(pipe_fd[0]);
int?i=0;
for(i=1;i<10;i++){
sleep(1);
if
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????27136??2007-12-14?12:16??實驗指導2004-11-29\Linux?簡單.doc
?????文件??????30720??2008-03-27?10:18??實驗指導2004-11-29\Linux?簡單講稿.doc
????..A..H.???????162??2012-03-28?08:13??實驗指導2004-11-29\~$nux?簡單講稿.doc
?????文件??????53760??2006-07-09?11:21??實驗指導2004-11-29\實驗1?進程與線程.doc
?????文件??????52736??2006-07-09?11:21??實驗指導2004-11-29\實驗2?處理機調度.doc
?????文件??????51200??2006-07-09?11:21??實驗指導2004-11-29\實驗3?存儲管理.doc
?????文件??????70144??2006-07-09?11:21??實驗指導2004-11-29\實驗4?文件系統.doc
?????文件??????50688??2006-07-09?11:21??實驗指導2004-11-29\實驗5?設備管理.doc
?????文件????1125438??2013-05-10?10:06??《操作系統》實驗報告.docx
?????文件??????12288??2013-04-19?09:59??CodeBlocks?Projects\OSExp1-1\.main.c.swp
?????文件??????15447??2013-05-10?19:21??CodeBlocks?Projects\OSExp1-1\bin\Debug\OSExp1-1
?????文件???????4492??2013-03-29?16:02??CodeBlocks?Projects\OSExp1-1\bin\Release\OSExp1-1
?????文件??????10137??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\doxyfile
?????文件???????6619??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\doxygen.css
?????文件???????1281??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\doxygen.png
?????文件????????174??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2blank.png
?????文件????????255??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2doc.png
?????文件????????259??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2folderclosed.png
?????文件????????261??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2folderopen.png
?????文件????????233??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2lastnode.png
?????文件????????358??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2li
?????文件????????160??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2mlastnode.png
?????文件????????194??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2mnode.png
?????文件????????235??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2node.png
?????文件????????165??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2plastnode.png
?????文件????????200??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2pnode.png
?????文件????????229??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\ftv2vertline.png
?????文件????????528??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\index.html
?????文件???????2581??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\installdox
?????文件????????927??2013-03-29?15:56??CodeBlocks?Projects\OSExp1-1\doxygen\html\main.html
............此處省略86個文件信息
- 上一篇:數字水印 DCT SVD
- 下一篇:PowerBuilder設計作品——訂餐系統
評論
共有 條評論