































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
































3.^
!^ Process Concept!^ Process Scheduling!^ Operations on Processes!^ Cooperating Processes!^ Interprocess Communication!^ Communication in Client-Server Systems
3.^
3.^
!^ As a process executes, it changes
state
"^ new : The process is being created "^ running
: Instructions are being executed "^ waiting
: The process is waiting for some event to occur "^ ready
: The process is waiting to be assigned to a process "^ terminated
: The process has finished execution
3.^
Information associated with each process!^ Process state!^ Program counter!^ CPU registers!^ CPU scheduling information!^ Memory-management information!^ Accounting information!^ I/O status information
3.^
3.^
!^ Job queue
3.^
3.^
!^ Long-term scheduler
(or job scheduler) – selects which
processes should be brought into the ready queue! Short-term scheduler
(or CPU scheduler) – selects
which process should be executed next and allocatesCPU
3.^
3.^
!^ When CPU switches to another process, the system must save thestate of the old process and load the saved state for the newprocess!^ Context-switch time is overhead; the system does no useful workwhile switching!^ Time dependent on hardware support
3.^
!^ Parent process create children processes, which, in turn createother 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
3.^
3.^
int main() { Pid_t pid;^ /* fork another process /^ pid = fork();^ if (pid < 0) { / error occurred */
fprintf(stderr, "Fork Failed"); exit(-1); } else if (pid == 0) { /* child process / execlp("/bin/ls", "ls", NULL); } else { / parent process / / parent will wait for the child to complete */ wait (NULL); printf ("Child Complete"); exit(0); } }