CS431 - Homework #4
/*************************************
Name: Thomas Heffron (tehqnf@umkc.edu)
Section: CS431 NET
Program: Program #4 - worker process
Due Date: Oct. 31, 2002
Desc: This is a simple worker program
to create looping processes from
the main program #4.
Inputs: No inputs.
Outputs: Indication of end of each work cycle.
*************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main() {
double y;
double x = 3.0;
double e = 2.0;
int i, j = 0;
pid_t pid;
pid = getpid();
while (1) {
for (i = 0; i < 400000; i++) {
y = pow(x, e);
}
printf("Loop %d of process %d work cycle\n", j++, pid);
sleep(1);
}
}