Question

(IN C) Note: I just need an example of this, use whatever extra variables you need....

(IN C)

Note: I just need an example of this, use whatever extra variables you need. the queue is a First come First Serve style queue.

* Check if there are any processes still in the queues.
* Return TRUE if there is. Otherwise false.
*/
bool isScheduleUnfinished( schedule *ps ) {
/* check if there are any process still in a queue. Return TRUE if there is. */

return false; /* Replace with your return value */
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

As you have mentioned you need an example of this, so before that we will write the complete function isScheduleUnfinished() and accorrding to it, we will state one example.

So, the complete isScheduleUnfinished() function is written as follows:

bool isScheduleUnfinished( schedule *ps ) {
bool isAvailable = false;

/* Below we check if there is any address assigned to ps, if it is not NULL, then atleast one process is scheduled */

if ( ps != NULL )

isAvailable = true;

return isAvailable;
}

Now, let us take one example.

Example 1:

ps = P0

ps -> P1 -> P2 -> P3 ->NULL

Here, there are 4 processes, P0, P1, P2, P3.

Since ps != NULL is true, hence, isAvailable is updated to true.

Example 2:

ps = NULL

Here, there are 0 processes.

Since ps != NULL is false, hence, isAvailable remains false.

Add a comment
Know the answer?
Add Answer to:
(IN C) Note: I just need an example of this, use whatever extra variables you need....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (C++) I need to write a priority queue(where the processes inside are listed as example: P25:2...

    (C++) I need to write a priority queue(where the processes inside are listed as example: P25:2 , 25 being a randomly assigned ID(1-50) and 2 being a randomly assigned priority number(1-10). Once the priority queue is full(10 max), it will transfer the highest priority process to a waiting queue. Once the waiting queue is full(7 max), one process(highest priority) will transfer to a ready queue where the system would perform the process in a round robin style. Once 25 processes...

  • I need help fixing my code.   My output should be the following. Hello, world! : false...

    I need help fixing my code.   My output should be the following. Hello, world! : false A dog, a panic in a pagoda : true A dog, a plan, a canal, pagoda : true Aman, a plan, a canal--Panama! : true civic : true If I had a hi-fi : true Do geese see God? : true Madam, I’m Adam. : true Madam, in Eden, I’m Adam. : true Neil, a trap! Sid is part alien! : true Never odd...

  • Study the "Queue as linked list simple example" posted in this module. Rewrite the code to...

    Study the "Queue as linked list simple example" posted in this module. Rewrite the code to use array instead of linked lists. Please do not change anything besides the data structure. Instead of linked list use an array. The functionality should remain exactly the same. LListQueue.cpp ///--------------------------------------------------------------- /// File: LListQueue.cpp /// Purpose: Implementation file for a demonstration of a queue /// implemented as an array. Data type: Character /// Programming Language: C++ ///--------------------------------------------------------------- #include "LListQueue.h" ///-------------------------------------------- /// Function: LListQueue() ///...

  • I need help with the following and written in c++ thank you!: 1) replace the 2D...

    I need help with the following and written in c++ thank you!: 1) replace the 2D arrays with vectors 2) add a constructor to the Sudoku class that reads the initial configuration from a file 3) adds a function to the Sudoku class that writes the final Sudoku grid to a file or to the standard output device, cout. Sudoku.h #pragma once /* notes sudoku() default constructor precondition : none postcondition: grid is initialized to 0 sudoku(g[][9]) 1-parameter constructor precondition...

  • I just need an explanation why do we have to copy first then use the getfunction...

    I just need an explanation why do we have to copy first then use the getfunction why can we just dirctly use the get function on like (borrowers.getID() == ID) instead of (borrow.getID() == ID) //The class is class ReadershipList { private: ifstream myin; ofstream myout; string readerfile; vector<Borrower> borrowers; public: int findBorrowerbyID(string ID); //Find the borrowers index by ID int findBorrowerbyName(string name); void addBorrower(Borrower newBorrow); //Add a borrower to the vector of borrowers void listBorrowers(); //Prints the list of...

  • Description In this homework, you are asked to implement a multithreaded program that will allow ...

    Description In this homework, you are asked to implement a multithreaded program that will allow us to measure the performance (i.e, CPU utilization, Throughput, Turnaround time, and Waiting time in Ready Queue) of the four basic CPU scheduling algorithms (namely, FIFO, SJE PR, and RR). Your program will be emulating/simulating the processes whose priority, sequence of CPU burst time(ms) and I'O burst time(ms) will be given in an input file. Assume that all scheduling algorithms except RR will be non-preemptive,...

  • I'm trying to convert between different number representations in C++ , I have the prototype but...

    I'm trying to convert between different number representations in C++ , I have the prototype but im not sure what do do from here bool add(string & sum, bool & n, bool & z, bool & v, bool & c, const string & term0, const string & term1); term0 and term1 should each be 5-bit strings with each char being '0' or '1' – otherwise, return false. If term0 and term1 are ok, add's job is to perform the addition,...

  • In C++ please.. I only need the game.cpp. thanks. Game. Create a project titled Lab8_Game. Use...

    In C++ please.. I only need the game.cpp. thanks. Game. Create a project titled Lab8_Game. Use battleship.h, battleship.cpp that mentioned below; add game.cpp that contains main() , invokes the game functions declared in battleship.h and implements the Battleship game as described in the introduction. ——————————————- //battleship.h #pragma once // structure definitions and function prototypes // for the battleship assignment // 3/20/2019 #include #include #ifndef BATTLESHIP_H_ #define BATTLESHIP_H_ // // data structures definitions // const int fleetSize = 6; // number...

  • You have to use a h file for class definitions and two (as specified below) cpp...

    You have to use a h file for class definitions and two (as specified below) cpp file for the C++ implementation. You have to generate the list from scratch and check for overflow I will be giving extra points (up to 2 points this time) to students that exceed the requirements posed in the assignments. For example, extensive testing, checking for exceptions, and usable user interface. Please submit enough screenshots showing compiling and execution under Linux. Write a main program...

  • C++ program, inventory.cpp implementation Mostly need the int load(istream&) function. Implementation: You are supp...

    C++ program, inventory.cpp implementation Mostly need the int load(istream&) function. Implementation: You are supposed to write three classes, called Item, Node and Inventory respectively Item is a plain data class with item id, name, price and quantity information accompanied by getters and setters Node is a plain linked list node class with Item pointer and next pointer (with getters/setters) Inventory is an inventory database class that provides basic linked list operations, delete load from file / formatted print functionalities. The...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT