Process Ring Simulator Log for joe speigle generated Tue Mar 09 20:04:24 GMT 2004
Process Ring Simulator Log for joe speigle generated Tue Mar 09 20:04:24 GMT 2004
- code: code for the program
- one: default configuration
- two: Change After fork from parent to child
- three: Change After fork from parent to either
- four: Change After fork from parent to random
- five: Change Choose Process from FCFS to Random
- six: Change Scheduling from no preempt to round robin with a quantum of 5 and Choose Process from FCFS to Random
- seven: Repeat the experiment above with a quantum of 2 and see if it behaves differently
- eight: Change Print Atomic to Print Not Atomic with probability 0.1
- nine: Insert a wait(NULL) call before the fprintf statement
- ten: Change Print Atomic to Print Not Atomic with probability 0.1 and insert a wait(NULL) call before the fprintf statement
|
code
pipe(fd);
dup2(fd[0],0);
dup2(fd[1],1);
close(fd[0]);
close(fd[1]);
for(i=1;i<nprocs;i++) {
pipe(fd);
if (childpid = fork()) {
dup2(fd[1],1);
}
else {
dup2(fd[0],0);
}
close(fd[0]);
close(fd[1]);
if (childpid)
break;
}
fprintf(stderr,"This is process %d with parent %d\n",getpid(),getppid());
-->

Ring of Processes Simulation
default configuration
Tue Mar 09 20:05:07 GMT 2004

Gantt Chart
Output for Ring of Processes
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Change After fork from parent to child
Tue Mar 09 20:12:08 GMT 2004

Gantt Chart
Tue Mar 09 20:11:33 GMT 2004
Output for Ring of Processes
After fork: child, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 104 with parent 103
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
Output for Ring of Processes
After fork: child, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 104 with parent 103
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
Output for Ring of Processes
After fork: child, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 104 with parent 103
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
Change After fork from parent to either
Output for Ring of Processes
After fork: either, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 104 with parent 103
This is process 102 with parent 1
This is process 103 with parent 1
Output for Ring of Processes
After fork: either, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 102 with parent 101
This is process 101 with parent 1
This is process 104 with parent 103
This is process 103 with parent 1
Output for Ring of Processes
After fork: either, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 102 with parent 101
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 104 with parent 103
This is process 103 with parent 1

Gantt Chart
Output for Ring of Processes
After fork: random, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 104 with parent 103
This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
Output for Ring of Processes
After fork: random, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: random, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Change Choose Process from FCFS to Random
Tue Mar 09 21:11:32 GMT 2004

Gantt Chart
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: no preempt, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Change Scheduling from no preempt to round robin with a quantum of 5 and Choose Process from FCFS to Random
Tue Mar 09 20:36:28 GMT 2004

Gantt Chart
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: RR quantum 5, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: RR quantum 5, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: RR quantum 5, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Repeat the experiment above with a quantum of 2 and see if it behaves differently
Tue Mar 09 20:41:08 GMT 2004

Gantt Chart
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: RR quantum 2, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 102
This is process 104 with parent 103
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: RR quantum 2, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Output for Ring of Processes
After fork: parent, Choose Process: Random, Scheduling: RR quantum 2, Print Atomic
This is process 100 with parent 1
>>>This is process 101 with parent 1
This is process 102 with parent 1
This is process 103 with parent 1
This is process 104 with parent 1
Change Print Atomic to Print Not Atomic with probability 0.1.
Tue Mar 09 20:47:20 GMT 2004

Gantt Chart
Output for Ring of Processes
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Not Atomic 0.1
TThis is process 101 his is process 100 wiTwith pareth parent 1
>>>This is process 103his nt 100
Thi with parent 102
iss is process 104 with parent 1 process 102 03
with parent 101
Tue Mar 09 20:48:16 GMT 2004

Gantt Chart
Output for Ring of Processes
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Not Atomic 0.1
This is process 100 with parThis is procesent 1
>>>Ths This is101 This is process 104 with parent 103is is proc with parent 100
ess 103 with parent 102
process 102 with parent 101
Output for Ring of Processes
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Not Atomic 0.1
This iTs processThis ish 100This is process 103 with pris is process 101 witThis parocwih parent is procentess 102 with parent 101
th parent 100
1
>>>ess 104 102
with parent 103
Insert a wait(NULL) call before the fprintf statement
>>>
pipe(fd);
dup2(fd[0],0);
dup2(fd[1],1);
close(fd[0]);
close(fd[1]);
for(i=1;i<nprocs;i++) {
pipe(fd);
if (childpid = fork()) {
dup2(fd[1],1);
}
else {
dup2(fd[0],0);
}
close(fd[0]);
close(fd[1]);
if (childpid)
break;
}
wait(NULL);
fprintf(stderr,"This is process %d with parent %d\n",getpid(),getppid());
-->
Tue Mar 09 20:52:01 GMT 2004

Gantt Chart
Output for Ring of Processes (modified)
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 104 with parent 103
This is process 103 with parent 102
This is process 102 with parent 101
This is process 101 with parent 100
This is process 100 with parent 1
>>>
Output for Ring of Processes (modified)
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 104 with parent 103
This is process 103 with parent 102
This is process 102 with parent 101
This is process 101 with parent 100
This is process 100 with parent 1
>>>
Output for Ring of Processes (modified)
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Atomic
This is process 104 with parent 103
This is process 103 with parent 102
This is process 102 with parent 101
This is process 101 with parent 100
This is process 100 with parent 1
Change Print Atomic to Print Not Atomic with probability 0.1 and insert a wait(NULL) call before the fprintf statement.
Tue Mar 09 20:57:41 GMT 2004

Gantt Chart
Output for Ring of Processes (modified)
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Not Atomic 0.1
This is process 104 with parent 103
This is process 103 with parent 102
This is process 102 with parent 101
This is process 101 with parent 100
This is process 100 with parent 1
>>>
Output for Ring of Processes (modified)
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Not Atomic 0.1
This is process 104 with parent 103
This is process 103 with parent 102
This is process 102 with parent 101
This is process 101 with parent 100
This is process 100 with parent 1
>>>
Output for Ring of Processes (modified)
After fork: parent, Choose Process: FCFS, Scheduling: no preempt, Print Not Atomic 0.1
This is process 104 with parent 103
This is process 103 with parent 102
This is process 102 with parent 101
This is process 101 with parent 100
This is process 100 with parent 1
>>>
return to top