ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 4 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 19 May 2017 My Price 9.00

Design, write, and test a program

Design, write, and test a program which estimates the time required to fork a process.  This should be the minimum time to return from the fork function in both the parent and child processes as tested by repeated forking child processes from a single parent process. This is the program I get so far right now, the question ask estimates the time, so can any one help to edit the code, and make it how to estimates the time to the fork process, and let the min time to return from the fork function. Thank you!

 

#include <unistd.h>#include <sys/types.h>#include <errno.h>#include <stdio.h>#include <sys/wait.h>#include <stdlib.h>int global_variable;int main(){pid_t childprocess_pid;int status;int local_variable = 0;childprocess_pid = fork();if (childprocess_pid >= 0){if (childprocess_pid == 0){printf("\nChild!\n");local_variable++;global_variable++;printf("child PID = %d, parentpid = %d\n", getpid(), getppid());printf("\n Local_Variable ofchild is = %d, Global_Variable of child is = %d\n", local_variable,global_variable);}else{printf("\nParent!\n");printf("parent PID = %d, childpid = %d\n", getpid(), childprocess_pid);wait(&status);printf("\n Local_Variable ofparent is = %d, Global_Variable of parent is = %d\n", local_variable,global_variable);

Answers

(11)
Status NEW Posted 19 May 2017 08:05 AM My Price 9.00

-----------

Not Rated(0)