文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > 高等教育 > 理学 > 2008.Spring.Final.Exam
侵权投诉

2008.Spring.Final.Exam

深入理解计算机系统

Problem 1: (20 points)

Read the following program procSig and answer questions.

#include <unistd.h> #include <signal.h>

int knotA = 1; int knotB = 1;

void handlerA(int sig){ knotA = 0; } void handlerB(int sig){ knotB = 0; }

int counter = 0;

int main(int argc, char** argv){

printf("Hello\n");

signal(SIGUSR1, handlerA); signal(SIGUSR2, handlerB);

int pid = fork(); counter++;

if(pid == 0){

printf("Hello\n"); while(knotA){ sleep(0); } }

else if(pid > 0){

printf("Hello\n"); while(knotB){ sleep(0); } }

else{

printf("No\n"); }

printf("Hello\n");

printf("Counter %d\n", counter);

return 0; }

Hint: see Fig 8.23 on book p618.

1. When we run procSig as the background job (./procSig &), how many “Hello” will be printed on the screen before all procSig processes stop at “sleep(0);” statement? ___________ (4’)

2. Assume the pid of first procSig is is . After we execute command “kill -10 1873”, how many new “Hello” will be printed on the screen? ___________(4’) 3. Then we execute command “kill -12 1874”, how many new “Hello” will be printed on the screen? _______ (4’)

2

上一页第2页

你可能喜欢

热门文档

相关文档

  • spring_2008_-_exam_i_-_a...

    2008.Spring.Final.Exam... 暂无评价 2页 免费 Spring 2003 Exam 59页 1下载券 Spring 2000 Exam 55页 1下载券 Spring of 2008-2009tes... 6页 免费 Spri...

  • 2009.Spring.Final.Exam.Sol

    2009.Spring.Final.Exam.Sol ics finalics final隐藏>> 复旦大学软件学院 2008~2009学年第二学期期末考试答案 Problem 1: IO and Concurrent Programming (20’) ...

  • Final Exam, Spring 2006B答案

    暂无评价 1页 1财富值 Spring Semester Final Ex... 暂无评价 2页 免费 2008.Spring.Final.Exam.S... 暂无评价 2页 免费喜欢此文档的还喜欢 ...

  • Final Exam, Spring 2007A

    2008.Spring.Final.Exam 暂无评价 12页 1财富值 Final Exam, Spring 2006答... 暂无评价 8页 免费 Final Exam, Spring 2006B... 暂无评价 8页 免费 Spring...

  • 2008 Second Term FCI Foundation Course Final Exam -...

    Final Term Exam 2页 免费 Final Exam Outline-200... 12页 免费 2008.Spring.Final.Exam 暂无评价 12页 1下载券 GP AQ 2008 Term Exam[1... 5页 2下...

  • Final Exam, Spring 2006答案

    South China University of Technology School of Electronic and information Engineering Circuits Integrated Circuits Design Final Exam, Spring 2006 答案 Please ...

  • Final Exam, Spring 2007A答案1

    Final Exam, Spring 2007B 8页 免费 2008.Spring.Final.Exam 暂无评价 12页 1财富值 CCNA第三学期Final_Exam(附... 15页 5财富值 Spring 2013 Final Exam ...

  • Final Exam, Spring 2007B

    Final Exam, Spring 2007A 暂无评价 8页 免费 2008.Spring.Final.Exam 暂无评价 12页 1财富值 Final Exam, Spring 2006答... 暂无评价 8页 免费 Final Exam...

  • Spring Semester Final Exam Questions

    Final Exam, Spring 200... 8页 免费 Final Exam Questions 2页 1下载券 Final Exam, Spring 200... 暂无评价 8页 免费 2008.Spring.Final.Exam 暂无评价 ...

  • Final Exam Questions Spring 2010

    Spoken English IV, Spring 2010 Final Exam Questions Unit 1 Relationships Is it easiest to maintain a friendship between two men, two women, or a man ...

  • 2008.Spring.Final.Exam.Sol

    2页 2财富值 Final Exam, Spring 2006答... 暂无评价 8页 免费 Rutgers-spring 2008 exam 3页 免费 Final Exam, Spring 2006B... 暂无评价 8页 免费喜欢...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email