Add in progress a5

This commit is contained in:
2023-10-27 11:24:40 -03:00
parent c1b88cf242
commit b653288368
8 changed files with 69 additions and 22 deletions

View File

@ -5,7 +5,7 @@
//Assume that the string passed in is null terminated
Process *createProcess(char *username, char job, int arrival_time, int duration) {
Process *createProcess(char *username, char job, int arrival_time, int duration, int affinity) {
// Allocate memory for the process, and check if it was successful
Process *node = calloc(1, sizeof(Process));
if (node == NULL) {
@ -26,6 +26,9 @@ Process *createProcess(char *username, char job, int arrival_time, int duration)
node->arrival_time = arrival_time;
node->duration = duration;
node->next_elem = NULL;
node->prev_elem = NULL;
node->finish_time = 0;
node->affinity = affinity;
return node;
}

View File

@ -9,9 +9,10 @@ typedef struct Process {
int arrival_time;
int duration;
int finish_time;
int affinity;
} Process;
Process *createProcess(char *username, char job, int arrival_time, int duration);
Process *createProcess(char *username, char job, int arrival_time, int duration, int affinity);
void destroyProcess(Process *node);

View File

@ -71,6 +71,7 @@ Process *dequeue(Queue *queue) {
queue->size--;
return temp;
}
void printList(Queue *queue) {
Process *current = queue->end;
while (current != NULL) {