Questions
in C++ We are going to implement the following scheduling algorithms 1. First-Come First-Served (FCFS) 2....

in C++

We are going to implement the following scheduling algorithms

1. First-Come First-Served (FCFS)

2. Shortest Remaining Time First (SRTF)

3. Highest Response Ratio Next (HRRN)

4. Round Robin, with di_erent quantum values (RR)

We are interested to compute the following metrics, for each experiment:

_ The average turnaround time

_ The total throughput (number of processes done per unit time)

_ The CPU utilization

_ The average number of processes in the ready queue

The simulator needs to generate a list of processes. For each process, we need to generate its arrival time and

its requested service time. We can assume that processes arrive with an average rate _ that follows a Poisson

process (hence exponential inter-arrival times). The service times are generated according to an exponential

distribution. We will vary _ to simulate di_erent loads while keeping the average service time _xed. The

simulator should stop after processing 10,000 processes to completion (without stopping the arrival process),

then it should output the statistics (i.e., the metrics above).

Events (e.g., process arrival, process completion, time-slice) that occur causes the simulator to update its

current state (e.g., cpu busy/idle, number of processes in the ready queue, etc.) To keep track and process

events in the right order, we keep events in a priority queue (called \Event Queue") that describes the future

events and is kept sorted by the time of each event. The simulator keeps a clock the represents the current

time which takes the time of the _rst event in the Event Queue. Notice that when an event is processed

at its assigned time, one or more future events may be added to the Event Queue. For example, when a

process gets serviced by the CPU, another process can start executing (if one is waiting in the ready queue)

and under FCFS, we know exactly when this process would _nish (since FCFS is non-preeptive), so we can

schedule a departure event in the future and place it in the event queue. Notice that time hops between

events, so you would need to update your simulator clock accordingly.

The simulator should take few command-line arguments. The _rst is to indicate the scheduler, a 1

through 4 value based on the list above. Also, it should take other arguments such as the average arrival

rate, the average service time and the quantum interval (for RR). Running the simulator with no arguments,

should display the parameters usage.

Each scheduler would need to maintain a queue (the \Process Ready Queue") for the ready processes

that are waiting for the CPU. A scheduler will select a process to run next based on the scheduling policy.

Clearly, this queue should not be confused with the Event Queue that is used to hold events to be processed

in the future.

3 The Runs

We will vary the average arrival rate, _, of processes from 10 process per second to 30 processes per second

(based on a Poisson process). The service time is chosen according to an exponential distribution with an

average service time of 0.04 sec.

For each value of _, we need to compare the performance of each scheduler, based on the metrics above.

It is recommended (but not required) that you write a simple batch _le that would run those experiments

and put the results in a _le (that you can later import into a spread sheet and plot the values).

#!/bin/bash

rm sim.data

for ((i = 10; i < 31; i++)); do

./sim 1 $i 0.04 0.01

cp sim.data /data/1-$i-004.data

done

This will run the simulator using FCFS (indicated by the value 1 in the _rst argument) for 20 di_erent

values of _ using 0.04 as the average service time and a quantum value of 0.01 (which is ignored in all

algorithms, except round robin). Then, the script will move the sim.data _le to a safe place.

With the Round Robin algorithm, an argument is supplied to indicate the quantum used. Use 2 di_erent

values of quantum; 0.01 and 0.2. If a process _nishes before its quantum expires, the CPU will schedule the

next process right away.


In: Computer Science

China, which gave the world its first paper money, recently introduced the world's first official digital...

China, which gave the world its first paper money, recently introduced the world's first official digital currency. What are your thoughts on what will be the impact of this digital currency in the world? Can this Chinese digital currency pose challenge to the supremacy of US Dollar? How does this Chinese digital currency differentiate from other digital currencies such as Bit-coin?

In: Economics

1.Provide the differences between a weighted-average method of process costing and a first-in, first-out (FIFO) method...

1.Provide the differences between a weighted-average method of process costing and a first-in, first-out (FIFO) method of process costing

In: Accounting

PART 4 Process Costing - First-In First-Out General Information The I See The Light Company has...

PART 4

Process Costing - First-In First-Out

General Information

The I See The Light Company has a related company that produces the figurines. They use process costing

in the molding department. The factory overhead is applied at a rate of 50% of direct labor dollars.

The material is added at the beginning of the process. The labor and overhead costs are assumed

to be added uniformly throughout.

Month of January

Selected information for January is presented below. Note that the applied overhead rate was

50% of direct labor costs in the molding department.

Molding Department

Goods in-process as of January 1 were 2,900 figurines at a cost of $49,880.00. Of this amount, $46,400.00 was from

raw materials added, $2,320.00 for labor and $1,160.00 for overhead. These 2,900 figurines were assumed to be

40.00% complete as to labor and overhead.

During January, 21,500 units were started, $348,945.00 of materials and $37,680.00 of labor costs were incurred.

The 5,500 figurines that were in-process at the end of January were assumed to be 20.00% complete to

labor and overhead.

All figurines in January passed inspection.

In: Accounting

Cerner Corporation announced a first-come, first-serve stock repurchase offer to its shareholders – the company agreed...

Cerner Corporation announced a first-come, first-serve stock repurchase offer to its shareholders – the company agreed to repurchase 2,653,780 shares of its common stock in exchange for total consideration of $173,434,000. Cerner had 329,641,500 total shares outstanding before the redemption. You acquired 16,482,075 shares of Cerner's stock two years ago for $20/share. You were the only shareholder to participate in the repurchase offer and Cerner agreed to redeem the total number of shares directly from you. Using the applicable tax rates provided below, compute your after-tax savings if the redemption is treated as an exchange as opposed to a dividend distribution. Any dividend income amounts should be considered ordinary income in character. For purposes of the after-tax savings calculation, you should assume you are liable for the net investment income tax on both capital gains and dividend income. Applicable tax rates: Individual - ordinary income - 34% Individual - long-term capital gains - 20% Individual - net investment income - 3.8%

In: Accounting

Case Study: First City Bank Implements an ERP System First City bank initiated an Enterprise Resource...

Case Study: First City Bank Implements an ERP System First City bank initiated an Enterprise Resource Planning (ERP) system implementation project to reduce overhead, increase efficiency, enhance the quality of operations, and increase customer satisfaction for its mortgage branch. The Systems Integrator (SI) Sigma Consulting, LLC, was brought onboard to analyze the existing business processes at the mortgage branch of the First City Bank and help the bank achieve its business objectives by implementing and configuring the ERP system to increase automation of its repetitive operations, integrate various business functions, and offer a portal for the customers to directly submit their mortgage information online by completing an online application themselves. The SI performed the stakeholder identification and analysis and collected the stakeholder information in the stakeholder register. Thereafter, Joint Application Design (JAD) sessions were scheduled to gather stakeholder requirements. The JAD sessions were completed and requirements were collected. Based on the requirements collected, solution specifications were created, and in turn, the solution was developed and configured. However, the client did not accept the solution because it was not configured correctly. This became apparent during the User Acceptance Testing (UAT) phase when the client asked specific subject matter experts (SMEs) to test use cases and test scenarios, and SMEs discovered that the new ERP system was configured incorrectly. Apparently, the requirements captured by the SI were incomplete and incorrect due to the lack of participation by all required stakeholders. The incomplete requirements resulted in wrong solution specifications and hence incorrect configuration of the new ERP system. Jeff Barlow, the manager of the mortgage branch of First City Bank (the client), said that the SMEs engaged in performing the UAT were not available during the JAD sessions. This turmoil prompted the client First City Bank and SI Sigma Consulting to go back to the drawing board. The design of the solution was subjected to significant changes involving time-consuming change requests and approvals followed by additional cycles of the unit, system, and user acceptance testing. The solution, though, was finally approved and delivered, but it was significantly late and over budget. Case Questions 1. Who are the stakeholders in this case? 2. How do you define a successful project? In your opinion, was this project a success or a failure? 3. What went well in this project? 4. What went wrong in this project? 5. What are some lessons learned from this project that can be applied in similar project environments?

In: Operations Management

An operating system uses the First-Come, First-Served (FCFS) CPU scheduling algorithm. Consider the following set of...

An operating system uses the First-Come, First-Served (FCFS) CPU scheduling algorithm.

Consider the following set of processes in this OS, with the length of the CPU burst time given in milliseconds, and the shown priority. A larger priority number implies a higher priority. There is no pre-emption.

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.

Process Burst Time Priority
P1 2 2
P2 1 5
P3 4 1
P4 6 4
P5 3 3

a) Draw a Gantt chart illustrating the order of execution of these processes, showing their completion times.

b) Calculate each process’ waiting time, and then compute the average waiting time for this set.

Note:  waiting time = completion time – arrival time – burst time

=> Write your answers on scratch paper (make sure it is visible) then take a picture of it and upload it here.

In: Computer Science

import java.util.Scanner; public class CompareNums { private static String comparison( int first, int second){ if (first...

import java.util.Scanner;

public class CompareNums {
private static String comparison( int first, int second){
if (first < second)
return "less than";
else if (first == second)
return "equal to";
else
return "greater than";
  
  
}
  

// DO NOT MODIFY main!
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter first integer: ");
int first = input.nextInt();
System.out.print("Enter second integer: ");
int second = input.nextInt();
System.out.println("The first integer is " +
comparison(first, second) +
" the second integer.");
}
}

NEED HELP WITH TEST CODE

public class CompareNumsTest {
// TODO - write your code below this comment.
// Write three tests, where each test corresponds to one
// of the three possible scenarios:
// - CompareNums.comparison returns "less than"
// - CompareNums.comparison returns "equal to"
// - CompareNums.comparison returns "greater than"
}

In: Computer Science

3.1 Bratko states that iterative deepening combines the best properties of breadth-first search and depth-first search...

3.1 Bratko states that iterative deepening combines the best properties of breadth-first search and depth-first search and is therefore, in practice, often the best choice
amongst the basic search methods. Discuss this statement.


3.2 Discuss the concept of the ‘locality’ of the effects of actions in the context of planning problems.

In: Computer Science

The Encrypt class has an integer private data member 8 element array named digits. The first four elements (0 ~ 3) are to store the original 4 digits integer and the next four (4 ~ 7) are to store the encrypted data

C++ Please Modify the code and create a new header file

A company wants to transmit data over the telephone, but is concerned that its phones could be tapped. All of the data are transmitted as four-digit integers. The company has asked you to write a program that encrypts the data so that it can be transmitted more securely. Your program should read a four-digit integer and encrypt it as follows: Replace each digit by (the sum of that digit plus 7) modulus 10. Then, swap the first digit with the third, swap the second digit with the fourth and print the encrypted integer. Your main duty for this assignment is creating an Encrypt class which includes Encrypt.h and Encrypt.cpp. After finishing the task you can use CISP400V10A2.cpp to test the Encrypt class.

The following is the Encrypt class specification.

1. The Encrypt class has an integer private data member 8 element array named digits. The first four elements (0 ~ 3) are to store the original 4 digits integer and the next four (4 ~ 7) are to store the encrypted data.

2. Encrypt class has several public member functions

a. An Encrypt constructor takes an integer of any digits and stores the last four digits. It encrypts the last four digits, stores the encrypted information, displays a call to the constructor information, and shows the original information and encrypted information. If the inputted number is less than or equal to 0 the integer is set to 9436.

b. A displayOriginalData function does not accept and return any data. It displays the first four elements of the private data member.

/ CISP400V10A2.cpp

// Test program for class Encrypt.

#include "Encrypt.h" // include definition of class Encrypt

#include

#include

using namespace std;

int main()

{

Encrypt app1(0), app2(40), app3(4560), app4(6145698),app5(-6); // create Encrypt objects  

  

cout<<endl<< "Reset the app1's data to 100." << endl;// display the reset of app1.

app1.storeData(100);// call app1's storeData function

app1.displayOriginalData();//display the app1's current original data.

app1.displayEncryptedData();// display the app1's current encrypted data.

cout << endl;//Jump to the next line

system("PAUSE");

return 0; // indicate successful termination

} // end main

In: Computer Science