Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

//Header file declaration

#include

#include

//Global variable declaration

    char newProcess[] = "New";

    char runningProcess[] = "Running";

    char waitingProcess[] = "Waiting";

    char readyProcess[] = "Ready";

    char terminatedProcess[] = "Terminating";

 

//

    /*  This method will return the state text of a given state

        i.e. if you pass 1 as argument then it will return "New"

    */

    const char * returnState(int state){

        const char *stateText;

        if(state == 0)

            stateText = "New";

        else if(state == 1)

            stateText = "Running";

        else if(state == 2)

            stateText = "Waiting";

        else if(state == 3)

            stateText = "Ready";

        else

            stateText ="Terminated";

 

        return stateText;

    }

 

    /*  This method will print the status of a given process.

        i.e. if process parentProcess[0] is passed as an argument

        then it would use the element value to determine the status.

 

    */

    void printStatus(int processNumber, int value){

        printf(" The current status of process %d is %s.n", processNumber, returnState(value));

    }

 

    /*--- Start of main function*/

    int main(void){

        //Local variable declaration

        int processCount; //this will hold the total number process

        int index; // Index for "for loop"

 

        printf("Hello! Please enter a whole number in between 0-10.n");

        scanf("%d", &processCount);

 

        //Local variable declaration

        int parentProcess[processCount];/*  This variable will store the status of each process. i.e.

                                            if parentProcess[0] = 5 then process 1 is in terminated state, etc.

                                        */

        /*  Initially every process's status would be in new state. So, you have put 1 as value in every element

            of the array. i.e. parentProcess[0] = 1 etc.

        */

        for(index = 0; index < processCount; index++){

            parentProcess[index] = 1;

            printStatus(index, parentProcess[index]);

        }

 

        /* your code goes here*/

    }

Use this code snippet as your guidance. You need to add the following options in this program

1. Give the user an option to enter different status for a process

2. Display the status of a process after a process's state has been changed by the user.

3. The program should not quit until every process's status is changed to "Terminated".

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91672074
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Describe a study you might conduct in which it would be

Describe a study you might conduct in which it would be appropriate to compute a Pearson r(i.e., a study with one group of participants with two scores per participant). Predict if you perceive that the r-value would be ...

Select three interfaces and consider how the teamwork

select three interfaces, and consider how the teamwork application could be redesigned for each of these types. Use your imagination. How about using a tangible interface or even a drone to help remote students collabora ...

Companies persue closer coordination and collaboration with

Companies persue closer coordination and collaboration with channel suppliers to better address customer needs inorder to 1) Develop human resource management activities that improve the skills , expertise and knowledge ...

Has globalizationnbspincreased or decreased social and

Has globalization increased or decreased social and economic disparities around the globe? Can you please provide details.

Questionhow can you start business by mobile application

Question How can you start business by Mobile Application Development ? Discuss the testing process of Mobile Applications in detail ? List important steps for publishing an app in the Target Market ?

Question a tank for propane gas is a cylinder with

Question : A tank for propane gas is a cylinder with hemispheres at each end. Write a process that asks the user to enter the length of the cylinder and the radius of the cylinder (same as the radius of the hemisphere (s ...

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Systems analysis project 8 can you answer the 4 questions

Systems analysis project 8: can you answer the 4 questions at the task section please, thank you. Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the ...

Question suppose we know a lt b ie a reduces to b in linear

Question : Suppose we know A (a) What can be said about the running time for A? (b) What can be said about the running time for B?

What are some of the basic principles involved with

What are some of the basic principles involved with utilizing the ADT stack? What are some applications that could effectively utilize a stack?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As