how i can do that in c++ i can not know how i can start ?
Assume there are three (or any number) concurrent processes running on a system (with single CPU). These processes are needed to be scheduled for a period of time (pre-set or variable). Every task will run for the full slot (an allocated amount of time for a process) or finish its task before the slot finishes. E.g. If process A wants to run for 10 mS and the CPU slot is 50, then after 10mS (after completion of A), the CPU will move to the next process.
You are required to run the scheduling program for a certain amount of time and print a report to show some statistics such as, how long a certain process was executed, how many times etc.
this is my try code ?
#include <iostream>
using namespace std;
struct jobType{
int ID;
double Total;
double NextSchedule;
double jobDuration;
};
int main()
{
double MasterClock=0.0,T;
int N;
Type num[100];
n1,n2,n3 ;
n1.Total=0
n2.Total=0
n3.Total=0
n1.NextSchedule=1.5;
n2.NextSchedule=2.5;
n3.NextSchedule=3.5;
cout<<"How long you want to run the simulation: ";
cin>>T;