Giter Site home page Giter Site logo

cs3113sp20-project1's Introduction

Intro to OS Project 1 - CPU Scheduling

by Parker Brandt (ID: 113521131)

Running the Program
To run the program, simply type "make all" in the command line and it will compile to an executable file named "project1".
From there, the user can just type "./project1 [filename]" to run the program. [filename] should be replaced with the name of the file with the instructions for the program.

Functions
char* readline(int fd)
This function takes in a file descriptor, and then uses that file descriptor to read the file. The function reads the file until a newline character appears, and once it does, it returns the string before the newline character.

char** split(char* string, char split)
This function takes in a string as the "char* string" parameter splits the string into an array of strings according to the "char split" parameter. The function then returns the array of strings.

int countContextSwitches(Process* processes, int numInstructions)
This function counts the number of voluntary context switches in the list of processes provided as the first parameter. The other parameter, is the number of instructions provided in the input file. The function returns the integer number of voluntary contextswitches. (NOTE: A voluntary context switch is when a process completes and does not complete later)

int countNonvolSwitches(Process* processes, int numInstructions)
This function counts the number of nonvoluntary context switches in a list of processes provided in the first parameter. (NOTE: A nonvoluntary context switch is when a process finishes its burst but has not yet completed)

double calcCPUUtilization(Process* processes, int numInstructions)
This function calculates the CPU utilization percentage. In this programming project, the CPU will be utilized 100% of the time, so it should always return 100.00

double calcThroughput(Process* processes, int numThreads, int numInstructions)
This function calculates the average throughput of all of the processes given in the first parameter. The second parameter "int numThreads" is the number of individual threads in the processes list while "int numInstructions" is the number of total instructions and a singular thread can have multiple instructions. (NOTE: Throughput is the number of executions completed per unit time, and no specific time unit was given in this assignment)

double calcTurnaroundTime(Process* processes, int numThreads, int numInstructions)
Calculates the average turnaround time of all of the processes in the processes list. Turnaround time is the time from submission until completion, so in this assignment the average turnaround time will be the time for each process to complete divided by the number of threads.

double calcWaitingTime(Process* processes, int numThreads, int numInstructions)
This function calculates the average waiting time for each process in "Process* processes" list. The waiting time is the number of time units from submission until the process begins executing.

double calcResponseTime(Process* processes, int numThreads, int numInstructions)
This function calculates the average response time for each process in the processes list. The response time is similar to the wait time, but does not include when the process executes again later.

Assumptions
The main assumption I made is that the number of characters on each line would not exceed 64 characters as I made that the buffer size in my program.

cs3113sp20-project1's People

Contributors

parkerbrandt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.