FOR GAHGUY ONLY ..
First/Parallel-Job-Scheduler-master/.gitattributes
############################################################################### # Set default behavior to automatically normalize line endings. ############################################################################### * text=auto ############################################################################### # Set default behavior for command prompt diff. # # This is need for earlier builds of msysgit that does not have it on by # default for csharp files. # Note: This is only used by command line ############################################################################### #*.cs diff=csharp ############################################################################### # Set the merge driver for project and solution files # # Merging from the command prompt will add diff markers to the files if there # are conflicts (Merging from VS is not affected by the settings below, in VS # the diff markers are never inserted). Diff markers may cause the following # file extensions to fail to load in VS. An alternative would be to treat # these files as binary and thus will always conflict and require user # intervention with every merge. To do so, just uncomment the entries below ############################################################################### #*.sln merge=binary #*.csproj merge=binary #*.vbproj merge=binary #*.vcxproj merge=binary #*.vcproj merge=binary #*.dbproj merge=binary #*.fsproj merge=binary #*.lsproj merge=binary #*.wixproj merge=binary #*.modelproj merge=binary #*.sqlproj merge=binary #*.wwaproj merge=binary ############################################################################### # behavior for image files # # image files are treated as binary by default. ############################################################################### #*.jpg binary #*.png binary #*.gif binary ############################################################################### # diff behavior for common document formats # # Convert binary document formats to text before diffing them. This feature # is only available from the command line. Turn it on by uncommenting the # entries below. ############################################################################### #*.doc diff=astextplain #*.DOC diff=astextplain #*.docx diff=astextplain #*.DOCX diff=astextplain #*.dot diff=astextplain #*.DOT diff=astextplain #*.pdf diff=astextplain #*.PDF diff=astextplain #*.rtf diff=astextplain #*.RTF diff=astextplain
First/Parallel-Job-Scheduler-master/.gitignore
## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. # User-specific files *.suo *.user *.userosscache *.sln.docstates # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs # Build results [Dd]ebug/ [Dd]ebugPublic/ [Rr]elease/ [Rr]eleases/ x64/ x86/ build/ bld/ [Bb]in/ [Oo]bj/ # Visual Studio 2015 cache/options directory .vs/ # MSTest test Results [Tt]est[Rr]esult*/ [Bb]uild[Ll]og.* # NUNIT *.VisualState.xml TestResult.xml # Build Results of an ATL Project [Dd]ebugPS/ [Rr]eleasePS/ dlldata.c # DNX project.lock.json artifacts/ *_i.c *_p.c *_i.h *.ilk *.meta *.obj *.pch *.pdb *.pgc *.pgd *.rsp *.sbr *.tlb *.tli *.tlh *.tmp *.tmp_proj *.log *.vspscc *.vssscc .builds *.pidb *.svclog *.scc # Chutzpah Test files _Chutzpah* # Visual C++ cache files ipch/ *.aps *.ncb *.opensdf *.sdf *.cachefile # Visual Studio profiler *.psess *.vsp *.vspx # TFS 2012 Local Workspace $tf/ # Guidance Automation Toolkit *.gpState # ReSharper is a .NET coding add-in _ReSharper*/ *.[Rr]e[Ss]harper *.DotSettings.user # JustCode is a .NET coding add-in .JustCode # TeamCity is a build add-in _TeamCity* # DotCover is a Code Coverage Tool *.dotCover # NCrunch _NCrunch_* .*crunch*.local.xml # MightyMoose *.mm.* AutoTest.Net/ # Web workbench (sass) .sass-cache/ # Installshield output folder [Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ DocProject/Help/*.HxT DocProject/Help/*.HxC DocProject/Help/*.hhc DocProject/Help/*.hhk DocProject/Help/*.hhp DocProject/Help/Html2 DocProject/Help/html # Click-Once directory publish/ # Publish Web Output *.[Pp]ublish.xml *.azurePubxml ## TODO: Comment the next line if you want to checkin your ## web deploy settings but do note that will include unencrypted ## passwords #*.pubxml *.publishproj # NuGet Packages *.nupkg # The packages folder can be ignored because of Package Restore **/packages/* # except build/, which is used as an MSBuild target. !**/packages/build/ # Uncomment if necessary however generally it will be regenerated when needed #!**/packages/repositories.config # Windows Azure Build Output csx/ *.build.csdef # Windows Store app package directory AppPackages/ # Visual Studio cache files # files ending in .cache can be ignored *.[Cc]ache # but keep track of directories ending in .cache !*.[Cc]ache/ # Others ClientBin/ [Ss]tyle[Cc]op.* ~$* *~ *.dbmdl *.dbproj.schemaview *.pfx *.publishsettings node_modules/ orleans.codegen.cs # RIA/Silverlight projects Generated_Code/ # Backup & report files from converting an old project file # to a newer Visual Studio version. Backup files are not needed, # because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML UpgradeLog*.htm # SQL Server files *.mdf *.ldf # Business Intelligence projects *.rdl.data *.bim.layout *.bim_*.settings # Microsoft Fakes FakesAssemblies/ # Node.js Tools for Visual Studio .ntvs_analysis.dat # Visual Studio 6 build log *.plg # Visual Studio 6 workspace options file *.opt # LightSwitch generated files GeneratedArtifacts/ _Pvt_Extensions/ ModelManifest.xml
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler.sln
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 VisualStudioVersion = 12.0.30110.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HW6 - Parallel Job Scheduler", "HW6 - Parallel Job Scheduler\HW6 - Parallel Job Scheduler.vcxproj", "{AF23A572-92CE-41E6-A2BE-28594543F594}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {AF23A572-92CE-41E6-A2BE-28594543F594}.Debug|Win32.ActiveCfg = Debug|Win32 {AF23A572-92CE-41E6-A2BE-28594543F594}.Debug|Win32.Build.0 = Debug|Win32 {AF23A572-92CE-41E6-A2BE-28594543F594}.Release|Win32.ActiveCfg = Release|Win32 {AF23A572-92CE-41E6-A2BE-28594543F594}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection EndGlobal
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/HW6 - Parallel Job Scheduler.vcxproj
Debug Win32 Release Win32 {AF23A572-92CE-41E6-A2BE-28594543F594} Win32Proj HW6ParallelJobScheduler Application true v140 Unicode Application false v140 true Unicode true false Level3 Disabled WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) true Console true Level3 MaxSpeed true true WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) true Console true true true
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/HW6 - Parallel Job Scheduler.vcxproj.filters
{4FC737F1-C7A5-4376-A066-2A32D752A2FF} cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx {93995380-89BD-4b04-88EB-625FBE52EBFB} h;hh;hpp;hxx;hm;inl;inc;xsd {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms Source Files Source Files Header Files Header Files Resource Files Resource Files Resource Files Resource Files
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/Job.h
#ifndef JOB_H #define JOB_H #include <string> using namespace std; class Job { public: string _job_name; int _cpus_required; int _duration; int _duration_remaining; int _starting_tick; int _ending_tick; Job(string job_name, int cpus_required, int duration) { _job_name = job_name; _cpus_required = cpus_required; _duration = duration; _duration_remaining = duration; } }; #endif // job h
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/jobs.txt
12 J1 8 10 J2 2 1 J3 12 12 J4 10 2 J5 5 8 J6 4 2 J7 4 6 J8 2 5 J9 4 3 J10 6 2
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/main.cpp
#include <fstream> #include <iostream> #include "Tick.h" int MAX_CPUS = 0; int RESOURCE_POOL = 0; int CURRENT_TICK = 1; using namespace std; int main(void) { priority_queue<shared_ptr<Job>, vector<shared_ptr<Job>>, jobCompare> jobQueue; vector<shared_ptr<Job>> activeJobs; ofstream outputFile("myoutput.txt"), resultsFile("myresults.csv"); ifstream jobsFile; string line; cout << "Please enter the Jobs file: "; getline(cin, line); jobsFile.open(line); if (!jobsFile.is_open()) { cout << "Could not open " << line << ". Exiting..." << endl; return 1; } getline(jobsFile, line); // MAX_CPU information line MAX_CPUS = stoi(line); RESOURCE_POOL = MAX_CPUS; //Header for results csv resultsFile << "\"Job Name\",\"Starting Tick\",\"Ending Tick\",\"Duration\"" << endl; do { tick(jobQueue, activeJobs, jobsFile, resultsFile, outputFile); ++CURRENT_TICK; } while (!jobQueue.empty() || !activeJobs.empty()); outputFile.close(); resultsFile.close(); jobsFile.close(); return 0; }
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/myoutput.txt
*** Tick: 1 *** Processing jobs file... The next job in the list is: J1. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 1. Adding highest priority job: J1 8 10 Job queue empty. Running active jobs... *** Tick: 2 *** Processing jobs file... The next job in the list is: J2. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 1. Adding highest priority job: J2 2 1 Job queue empty. Running active jobs... Job J2 is complete. Freeing resources... *** Tick: 3 *** Processing jobs file... The next job in the list is: J3. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 4). Waiting for resources... Running active jobs... *** Tick: 4 *** Processing jobs file... The next job in the list is: J4. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 2. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... *** Tick: 5 *** Processing jobs file... The next job in the list is: J5. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 3. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... *** Tick: 6 *** Processing jobs file... The next job in the list is: J6. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 4. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... *** Tick: 7 *** Processing jobs file... The next job in the list is: J7. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 5. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... *** Tick: 8 *** Processing jobs file... The next job in the list is: J8. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 6. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... *** Tick: 9 *** Processing jobs file... The next job in the list is: J9. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 7. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... *** Tick: 10 *** Processing jobs file... The next job in the list is: J10. Adding job to jobs queue... Processing jobs queue... Current number of scheuled jobs: 8. Not enough CPUs available. (Requested: 10 Available: 4). Waiting for resources... Running active jobs... Job J1 is complete. Freeing resources... *** Tick: 11 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 8. Adding highest priority job: J4 10 2 Not enough CPUs available. (Requested: 4 Available: 2). Waiting for resources... Running active jobs... *** Tick: 12 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 7. Not enough CPUs available. (Requested: 4 Available: 2). Waiting for resources... Running active jobs... Job J4 is complete. Freeing resources... *** Tick: 13 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 7. Adding highest priority job: J6 4 2 Adding highest priority job: J10 6 2 Not enough CPUs available. (Requested: 4 Available: 2). Waiting for resources... Running active jobs... *** Tick: 14 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 5. Not enough CPUs available. (Requested: 4 Available: 2). Waiting for resources... Running active jobs... Job J6 is complete. Freeing resources... Job J10 is complete. Freeing resources... *** Tick: 15 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 5. Adding highest priority job: J9 4 3 Adding highest priority job: J8 2 5 Adding highest priority job: J7 4 6 Not enough CPUs available. (Requested: 5 Available: 2). Waiting for resources... Running active jobs... *** Tick: 16 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 2. Not enough CPUs available. (Requested: 5 Available: 2). Waiting for resources... Running active jobs... *** Tick: 17 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 2. Not enough CPUs available. (Requested: 5 Available: 2). Waiting for resources... Running active jobs... Job J9 is complete. Freeing resources... *** Tick: 18 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 2. Adding highest priority job: J5 5 8 Not enough CPUs available. (Requested: 12 Available: 1). Waiting for resources... Running active jobs... *** Tick: 19 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 1). Waiting for resources... Running active jobs... Job J8 is complete. Freeing resources... *** Tick: 20 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 3). Waiting for resources... Running active jobs... Job J7 is complete. Freeing resources... *** Tick: 21 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 7). Waiting for resources... Running active jobs... *** Tick: 22 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 7). Waiting for resources... Running active jobs... *** Tick: 23 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 7). Waiting for resources... Running active jobs... *** Tick: 24 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 7). Waiting for resources... Running active jobs... *** Tick: 25 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Not enough CPUs available. (Requested: 12 Available: 7). Waiting for resources... Running active jobs... Job J5 is complete. Freeing resources... *** Tick: 26 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 1. Adding highest priority job: J3 12 12 Job queue empty. Running active jobs... *** Tick: 27 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 28 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 29 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 30 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 31 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 32 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 33 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 34 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 35 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 36 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... *** Tick: 37 *** Processing jobs file... The next job in the list is: . Processing jobs queue... Current number of scheuled jobs: 0. Job queue empty. Running active jobs... Job J3 is complete. Freeing resources...
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/myresults.csv
| Job Name | Starting Tick | Ending Tick | Duration |
| J2 | 2 | 2 | 0 |
| J1 | 1 | 10 | 9 |
| J4 | 4 | 12 | 8 |
| J6 | 6 | 14 | 8 |
| J10 | 10 | 14 | 4 |
| J9 | 9 | 17 | 8 |
| J8 | 8 | 19 | 11 |
| J7 | 7 | 20 | 13 |
| J5 | 5 | 25 | 20 |
| J3 | 3 | 37 | 34 |
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/readme.txt
Run the exe, enter the jobs file when prompted (e.g. "Jobs.txt"). The output is in "myoutput.txt" The results are in "myresults.csv"
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/tick.cpp
#include "Tick.h" extern int MAX_CPUS; extern int RESOURCE_POOL; extern int CURRENT_TICK; //Adding the job from file if a job to add exists void addJob(priority_queue<shared_ptr<Job>, vector<shared_ptr<Job>>, jobCompare> &job_queue, ifstream &jobs_file, ofstream &output_file) { string line, jobName, cpusRequired, duration; shared_ptr<Job> job; output_file << "Processing jobs file..." << endl; //Tying to Extract jobName, cpusRequired, and duration information from the line getline(jobs_file, line); stringstream ss(line); ss >> jobName >> cpusRequired >> duration; output_file << "The next job in the list is: " << jobName << "." << endl; // Adding only a job if the line actually contained a job. if (jobName != "" && jobName != "NULL" && jobName != "null") { output_file << "Adding job to jobs queue..." << endl << endl; shared_ptr<Job> job{ new Job(jobName, stoi(cpusRequired), stoi(duration)) }; job->_starting_tick = CURRENT_TICK; job_queue.push(job); if (job->_cpus_required > MAX_CPUS) { throw exception("Max number of CPUs exceeded"); } //a single job per tick return; } } void addToActiveJobs(priority_queue<shared_ptr<Job>, vector<shared_ptr<Job>>, jobCompare> &job_queue, vector<shared_ptr<Job>> &active_jobs, ofstream &output_file) { shared_ptr<Job> currentJob; output_file << "Processing jobs queue..." << endl; output_file << "Current number of scheuled jobs: " << job_queue.size() << '.' << endl; if (job_queue.empty()) { output_file << "Job queue empty." << endl << endl; return; } if (RESOURCE_POOL == 0) { output_file << "No CPUs available. Waiting for resources..." << endl << endl; return; } while (!job_queue.empty()) { //Addin as many jobs as available CPUs for currentJob = job_queue.top(); if (currentJob->_cpus_required <= RESOURCE_POOL) { //There is enough available CPUs for the next job output_file << "Adding highest priority job:" << endl; output_file << currentJob->_job_name << "\t" << currentJob->_cpus_required << "\t" << currentJob->_duration << endl; job_queue.pop(); active_jobs.push_back(currentJob); RESOURCE_POOL -= currentJob->_cpus_required; } else { output_file << "Not enough CPUs available. (Requested: " << currentJob->_cpus_required << " Available: " << RESOURCE_POOL << "). "; output_file << "Waiting for resources..." << endl << endl; return; } } output_file << "Job queue empty." << endl << endl; return; } void executeJobs(vector<shared_ptr<Job>> &active_jobs, ofstream &output_file) { output_file << "Running active jobs..." << endl; for (int i = 0; i < active_jobs.size(); ++i) { //Doing 1 tick worth of work on each active_job --(active_jobs[i]->_duration_remaining); } } void jobToCsv(shared_ptr<Job> job, ofstream &results_file) { stringstream ss; int calculatedDuration = (job->_ending_tick - job->_starting_tick); ss << '"' << job->_job_name << "\",\"" << job->_starting_tick << "\",\"" << job->_ending_tick << "\",\"" << calculatedDuration << "\""; results_file << ss.str() << endl; } void removeJobs(vector<shared_ptr<Job>> &active_jobs, ofstream &results_file, ofstream &output_file) { for (vector<shared_ptr<Job>>::iterator iter = active_jobs.begin(); iter != active_jobs.end(); ) { if ((*iter)->_duration_remaining == 0) { //If all work is done for the job output_file << "Job " << (*iter)->_job_name << " is complete. Freeing resources..." << endl; RESOURCE_POOL += (*iter)->_cpus_required; (*iter)->_ending_tick = CURRENT_TICK; jobToCsv((*iter), results_file); iter = active_jobs.erase(iter); //Erasing returns the next iter in the series } else { ++iter; } } output_file << endl << endl; return; } void tick(priority_queue<shared_ptr<Job>, vector<shared_ptr<Job>>, jobCompare> &job_queue, vector<shared_ptr<Job>> &active_jobs, ifstream &jobs_file, ofstream &results_file, ofstream &output_file) { output_file << "*** Tick: " << CURRENT_TICK << " ***" << endl; addJob(job_queue, jobs_file, output_file); addToActiveJobs(job_queue, active_jobs, output_file); executeJobs(active_jobs, output_file); removeJobs(active_jobs, results_file, output_file); }
First/Parallel-Job-Scheduler-master/HW6 - Parallel Job Scheduler/Tick.h
#ifndef TICK_H #define TICK_H #include <queue> #include <vector> #include <fstream> #include <memory> #include <sstream> #include "Job.h" struct jobCompare { bool operator()(const shared_ptr<Job> &j1, const shared_ptr<Job> &j2) { return (j1->_duration > j2->_duration);//To sort duration from low to high } }; void tick(priority_queue<shared_ptr<Job>, vector<shared_ptr<Job>>, jobCompare> &job_queue, vector<shared_ptr<Job>> &active_jobs, ifstream &jobs_file, ofstream &results_file, ofstream &output_file); #endif // tick_h
First/Parallel-Job-Scheduler-master/P6.docx
Programming Assignment #4
Your organization has purchased a new parallel computer (or "cluster") which has several processors. Your task is to design and implement a simple shortest-job-first scheduler that allows multiple users to access the cluster at the same time, as per the following specification:
The scheduler performs all required functions at regular intervals, often called "ticks." During each tick, the scheduler must take into consideration several pieces of information:
1. Are there jobs in our input file that contains a list of jobs to be run? If so, add that job to our list of current jobs. Note that our jobs file contains one job per line in the following format: "<JOB_NAME> <CPUS_REQUIRED> <DURATION>". Only one job may be added to the jobs queue during any given tick. If a job has a name of "NULL," skip that job for the current tick (i.e. no jobs will be added during this tick). If a job requires more CPUs than the cluster contains, you should output an error and terminate execution of the program.
2. Are there jobs in the jobs queue? If so, find the job with the shortest duration. Are there enough CPU resources for this job to run? If so, begin execution (i.e. add to the active jobs queue). If, after adding the previous job, are there enough resources to run the next job in the queuejob? If so, go back to the beginning of step #2. Stop adding to the list of active jobs when there are not enough CPU resources available for the job to execute. Try again in the future.
3. For each executing job (note that there may be multiple concurrent jobs), perform one tick's worth of work. After, check to see if the job is done executing. If complete, remove from the active jobs queue and allocate the job's CPU resources back into the resource pool. Note that it is possible for a job with a duration of 1 to be scheduled, executed, and completed during the same tick.
Upon completion, your program should produce a CSV file called "result.csv" that documents the point at which each job enters the jobs queue, finishes its execution, and the difference between these two values.
Sample Jobs File
Below is a sample jobs file that you can use for testing:
|
12 J1 8 10 J2 2 1 J3 12 12 J4 10 2 J5 5 8 J6 4 2 J7 4 6 J8 2 5 J9 4 3 J10 6 2 |
Sample Output
Included with this document is the file "output.txt" that contains the output of my program running the sample jobs list with a CPU count of 12 (as specified in the first line of the input file). Also included is the generated CSV file.
Header Comment, and Formatting
1. Be sure to modify the file header comment at the top of your script to indicate your name, student ID, completion time, and the names of any individuals that you collaborated with on the assignment.
2. Remember to follow the basic coding style guide. A basic list of rules is included with this document.
Deliverables
Reflection Essay
In addition to the programming tasks listed above, your submission must include an essay that reflects on your experiences with this homework. This essay must be at least 350 words long. Note that the focus of this paper should be on your reflection, not on structure (e.g. introductory paragraph, conclusion, etc.). The essay is graded on content (i.e. it shows deep though) rather than syntax (e.g. spelling) and structure. Below are some prompts that can be used to get you thinking. Feel free to use these or to make up your own.
· Describe a particular struggle that you overcame when working on this programming assignment.
· Conversely, describe an issue with your assignment that you were unable to resolve.
· Provide advice to a future student on how he or she might succeed on this assignment.
1. Describe the most fun aspect of the assignment.
1. Describe the most challenging aspect of the assignment.
1. Describe the most difficult aspect of the assignment to understand.
1. Provide any suggestions for improving the assignment in the future.
Grading
Your grade will be determined as follows:
· [10] Your program uses a priority queue to model the scheduler.
· Your program uses good Object Oriented Programming principles. As evidence of this, your program uses classes to represent:
· [5] A given job
· [5] A CPU within the cluster
· [5] The cluster of CPUs itself
· [10] Your reflection essay satisfies the requirements as specified earlier in this document.
· [5] Your code is well documented and generally easy to read.
· [60] Does the code compile and run successfully on my test cases? Does the generated CSV file appear to be correct?
First/Parallel-Job-Scheduler-master/Reflection essay.docx
I struggled a lot coming deriving the variables and how I was going to frame my project in terms of main class and sub-classes. Further deriving the logical flow of the program how opening of files, decisions and executions was a big issue to finally put everything on a flow chart was a big issue. After a big struggle I overcame that and I was able to continue and start up the coding of my project.
There was no issue in the assignment that I was not able to solve, according to requirements I was able to solve all it was needed.
To succeed on such an assignment one should be able to fully draw a flowchart and understand each and every step of the assignment before coding, because even if somebody is a pro in programing the chances of succeeding in coding without understating fully the flow is almost impossible.
The most fun aspect of the assignment is codding, I found it a fun coding one selection structure after another and finally running it to produce the expected results.
The most difficult and challenging aspects of the assignment are on the input files, output files and the complexity of the selection structures in the program. It is difficult integrating the inputs from a file and adapting to the project rather than using and assigning variables. It would have been easy if it were to prompt for the inputs. Outputting the results on CSV files is also a bit complicated can be difficult compared to when the results are to just be displayed. Further the program is full of selections structures and one has to struggle to understand interims of a flowchart on the priority or which selection should come first.
This assignment should be open and readily allow students to select a language which one is comfortable with to code with, for example doing it in Java or C, further it should be able to allow student to make his or her final results basing on his/her inputs so that it is a bit open and allows a room for improvements. This will not punish students in terms of grading, there should be general output or the results of the project coding. The final grading of such a project should be on whether certain achievements’ have been met not against specific figures to determine the functions achieved on the project.