上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec6

OPERATING SYSTEMS 1 龚玲 lgong@sjtu.edu.cn
OPERATING SYSTEMS 龚玲 lgong@sjtu.edu.cn 1

CHAPTER 3:PROCESSES Operating System Concepts with Java-7th Edition,Nov 15,2006 Silberschatz,Galvin and Gagne 2007
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 CHAPTER 3: PROCESSES

CHAPTER 3:PROCESSES o Process Concept o Process Scheduling o Operations on Processes o Cooperating Processes o Inter process Communication o Communication in Client-Server Systems
CHAPTER 3: PROCESSES Process Concept Process Scheduling Operations on Processes Cooperating Processes Inter process Communication Communication in Client-Server Systems

REVIEW o Process states o PCB o Process scheduling queues o Schedulers o Operations on processes o http://wenku.baidu.com/course/study/77f1dcccda38376ba flfae94#665ea0c7aa00b52acfc7ca94
REVIEW Process states PCB Process scheduling queues Schedulers Operations on processes http://wenku.baidu.com/course/study/77f1dcccda38376ba f1fae94#665ea0c7aa00b52acfc7ca94

GOALS FOR TODAY o Operations on processes
GOALS FOR TODAY Operations on processes

PROCESS CREATION o Parent process create children processes,which, in turn create other processes,forming a tree of processes o Resource sharing Parent and children share all resources Children share subset of parent's resources Parent and child share no resources o Execution Parent and children execute concurrently Parent waits until children terminate
PROCESS CREATION Parent process create children processes, which, in turn create other processes, forming a tree of processes Resource sharing Parent and children share all resources Children share subset of parent’s resources Parent and child share no resources Execution Parent and children execute concurrently Parent waits until children terminate

A TREE OF PROCESSES ON A TYPICAL SOLARIS Sched pid 0 init pageout fsflush pid =1 pid =2 pid =3 inetd dtlogin pid =140 pid 251 telnetdaemon Xsession pid=7776 pid 294 Csh sdt shel pid=7778 pid =340 Csh pid=1400 Netscape emacs pid=7785 pid=8105 Is cat pid=2123 pid=2536
A TREE OF PROCESSES ON A TYPICAL SOLARIS

PROCESS CREATION (CONT.) o Address space Child duplicate of parent Child has a program loaded into it o UNIX examples fork system call creates new process exec system call used after a fork to replace the process'memory space with a new program
PROCESS CREATION (CONT.) Address space Child duplicate of parent Child has a program loaded into it UNIX examples fork system call creates new process exec system call used after a fork to replace the process’ memory space with a new program

PROCESS CREATION parent resumes wait fork() child exec() exit()
PROCESS CREATION

PROCESS CREATION IN POSIX #include #include #include int main() pid_t pid; /fork a child process * pid fork(); if (pid 0){/*error occurred * fprintf(stderr,"Fork Failed"); exit(-1); else if (pid ==0){/*child process * execlp("/bin/1s","1s",NULL); else{/*parent process * /parent will vait for the child to complete * wait(NULL); printf("Child Complete"); exit(0);
PROCESS CREATION IN POSIX
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec5.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec4.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Process Synchronization_Lec14.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Process Synchronization_Lec13.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Process Synchronization_Lec12.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec24_Review.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec24_DISK MANAGEMENT AND I/O.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec23_file system implementation.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec22_file system implementation.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec21_file system interface.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec20_virtual memory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec19_virtual memory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec18_mainmemory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec17_mainmemory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec16_mainmemory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Introduction_Lec3.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Introduction_Lec2.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Introduction_Lec1.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-deadlock_Lec15.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-cpuscheduling_Lec11.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec7.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec8.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-semaphore EXERCISES.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-OPERATING SYSTEMS(LINUX SYSTEM CALLS).pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-thread.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资料(Java)Java Introduction.docx
- 上海交通大学:《操作系统 Operating System》课程教学资料(JAVA PPT)lec1.ppt
- 上海交通大学:《操作系统 Operating System》课程教学资料(JAVA PPT)lec2.ppt
- 上海交通大学:《操作系统 Operating System》课程教学资料(JAVA PPT)lec3.ppt
- 上海交通大学:《操作系统 Operating System》课程教学资料(JAVA PPT)lec4.ppt
- 上海交通大学:《操作系统 Operating System》课程教学资料(JAVA PPT)lec5.ppt
- 上海交通大学:《操作系统 Operating System》课程教学资料(Java)Java Primer.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资料(Java)Java多线程应用实例(制作烟花效果).doc
- 上海交通大学:《操作系统 Operating System》课程教学资料(Java)Java多线程编程.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资料(Java)JAVA多线程编程详解(详细操作例子).doc
- 上海交通大学:《操作系统 Operating System》课程教学资料(Java)Java学习笔记(JAVA的面向对象编程——课堂笔记).doc
- 上海交通大学:《操作系统 Operating System》课程教学资料_管程.docx
- 上海交通大学:《操作系统 Operating System》课程教学资料_往年试卷.pdf
- 上海交通大学:《Computational Thinking and Approach》教学资源(课件讲稿)Lecture01.pdf
- 上海交通大学:《Computational Thinking and Approach》教学资源(课件讲稿)Lecture02.pdf