Attempting working on Sim04 without the LL stuff trying to fix in 03.

This commit is contained in:
Charles Descamps 2024-04-15 21:00:29 -07:00
parent fda57566d8
commit fda21f3cb6
8 changed files with 91 additions and 57 deletions

View file

@ -1 +1 @@
0.000001, OS: Simulator start 0.000988, OS: Simulator start

Binary file not shown.

View file

@ -0,0 +1,7 @@
0.000000, OS: Simulator start
READY state from NEW state
ate
ate

Binary file not shown.

BIN
Sim04/sim04 Executable file

Binary file not shown.

View file

@ -5,7 +5,7 @@ OBJECTS = OS_SimDriver.o simulator.o metadataops.o configops.o StringUtils.o sim
all: Simulator all: Simulator
Simulator: $(OBJECTS) Simulator: $(OBJECTS)
$(CC) $(OBJECTS) -o sim03 $(CC) $(OBJECTS) -lpthread -o sim04
StringUtils.o: StringUtils.c StringUtils.o: StringUtils.c
$(CC) -c StringUtils.c -o StringUtils.o $(CC) -c StringUtils.c -o StringUtils.o
@ -26,7 +26,7 @@ simtimer.o: simtimer.c
$(CC) -c simtimer.c -o simtimer.o $(CC) -c simtimer.c -o simtimer.o
clean: clean:
rm -f $(OBJECTS) sim03 sim03.out rm -f $(OBJECTS) sim04 sim04.out
clean_objects: clean_objects:
rm -f $(OBJECTS) rm -f $(OBJECTS)

View file

@ -71,7 +71,7 @@ bool allocMemory(ProcessControlBlock *singlePCB, int offset, int size, int array
singlePCB->allocatedMemOffsets[allocateIterator] = offset; singlePCB->allocatedMemOffsets[allocateIterator] = offset;
singlePCB->allocatedMemSizes[allocateIterator] = size; singlePCB->allocatedMemSizes[allocateIterator] = size;
allocateIterator = allocateIterator + 1; allocateIterator = allocateIterator + 1;
printf("Alloc Iter: %d\n", allocateIterator); // printf("Alloc Iter: %d\n", allocateIterator);
} }
// return true (temp) // return true (temp)
return true; return true;
@ -331,6 +331,21 @@ int findMin(int one, int another)
return minimumVal; return minimumVal;
} }
/*
Name: interruptManager
Process: does the managing of interrupts for the program
Function Input/Parameters: ???
Function Output/Parameters: none
Function Output/Returned: ???
Device Input/Device: none
Device Output/Device: none
Dependencies: none
*/
void interruptManager()
{
//
}
/* /*
Name: logOutput Name: logOutput
Process: Takes in a string, and then outputs it to monitor AND/OR file Process: Takes in a string, and then outputs it to monitor AND/OR file
@ -400,7 +415,8 @@ Device Input/Device: none
Device Output/Device: none Device Output/Device: none
Dependencies: ??? Dependencies: ???
*/ */
bool memManager(ProcessControlBlockLL *pcbList, MEMORY_SIGNALS memCode, int offset, int size, ConfigDataType *configPtr, ProcessControlBlock *singlePCB) bool memManager(ProcessControlBlockLL *pcbList, MEMORY_SIGNALS memCode, int offset, int size, ConfigDataType *configPtr,
ProcessControlBlock *singlePCB)
{ {
bool memDisplay = configPtr->memDisplay; bool memDisplay = configPtr->memDisplay;
ProcessControlBlock *wkgPtr; ProcessControlBlock *wkgPtr;
@ -497,7 +513,8 @@ bool memManager(ProcessControlBlockLL *pcbList, MEMORY_SIGNALS memCode, int offs
// //
printf("--------------------------------------------------\n"); printf("--------------------------------------------------\n");
printf("After memory allocation\n"); printf("After memory allocation\n");
printf("%d [ Used, P#: %d, %d-%d ] %d\n", offset - offset, singlePCB->uniquePid, offset, offset + size - 1, size - 1); printf("%d [ Used, P#: %d, %d-%d ] %d\n", offset - offset, singlePCB->uniquePid, offset,
offset + size - 1, size - 1);
printf("%d [ Open, P#: x, %d-%d ] %d\n", usedMem, currentOffset, currentSize, availableMem - 1); printf("%d [ Open, P#: x, %d-%d ] %d\n", usedMem, currentOffset, currentSize, availableMem - 1);
printf("--------------------------------------------------\n"); printf("--------------------------------------------------\n");
} }
@ -522,7 +539,8 @@ bool memManager(ProcessControlBlockLL *pcbList, MEMORY_SIGNALS memCode, int offs
// //
printf("--------------------------------------------------\n"); printf("--------------------------------------------------\n");
printf("After access success\n"); printf("After access success\n");
printf("%d [ Used, P#: %d, %d-%d ] %d\n", offset - offset, singlePCB->uniquePid, offset, offset + size - 1, size - 1); printf("%d [ Used, P#: %d, %d-%d ] %d\n", offset - offset, singlePCB->uniquePid, offset,
offset + size - 1, size - 1);
printf("%d [ Open, P#: x, %d-%d ] %d\n", usedMem, currentOffset, currentSize, availableMem - 1); printf("%d [ Open, P#: x, %d-%d ] %d\n", usedMem, currentOffset, currentSize, availableMem - 1);
printf("--------------------------------------------------\n"); printf("--------------------------------------------------\n");
} }
@ -531,7 +549,8 @@ bool memManager(ProcessControlBlockLL *pcbList, MEMORY_SIGNALS memCode, int offs
// //
printf("--------------------------------------------------\n"); printf("--------------------------------------------------\n");
printf("After access failure\n"); printf("After access failure\n");
printf("%d [ Used, P#: %d, %d-%d ] %d\n", offset - offset, singlePCB->uniquePid, offset, offset + size - 1, size - 1); printf("%d [ Used, P#: %d, %d-%d ] %d\n", offset - offset, singlePCB->uniquePid, offset,
offset + size - 1, size - 1);
printf("%d [ Open, P#: x, %d-%d ] %d\n", usedMem, currentOffset, currentSize, availableMem - 1); printf("%d [ Open, P#: x, %d-%d ] %d\n", usedMem, currentOffset, currentSize, availableMem - 1);
printf("--------------------------------------------------\n"); printf("--------------------------------------------------\n");
} }
@ -593,6 +612,7 @@ Dependencies: pthreads, sprintf, logOutput, ???
*/ */
void runCPU(char *command, char *argument, int intArg, ConfigDataType *configPtr, int processId) void runCPU(char *command, char *argument, int intArg, ConfigDataType *configPtr, int processId)
{ {
double timeDigits;
char timeStringy[MAX_STR_LEN]; char timeStringy[MAX_STR_LEN];
// char *command = workingMeta->command; // char *command = workingMeta->command;
// char *argument = workingMeta->strArg1; // char *argument = workingMeta->strArg1;
@ -601,13 +621,15 @@ void runCPU(char *command, char *argument, int intArg, ConfigDataType *configPtr
int cpuTime = 0; int cpuTime = 0;
int *cpuTimePtr = &cpuTime; int *cpuTimePtr = &cpuTime;
cpuTime = intArg * configPtr->procCycleRate; cpuTime = intArg * configPtr->procCycleRate;
sprintf(cpuOutput, "%f, Process: %d, %s %s operation start\n", accessTimer(LAP_TIMER, timeStringy), processId, command, argument); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(cpuOutput, "%f, Process: %d, %s %s operation start\n", timeDigits, processId, command, argument);
logOutput(configPtr, cpuOutput, false); logOutput(configPtr, cpuOutput, false);
// run timer for intArg * procCycleRate // run timer for intArg * procCycleRate
pthread_t cpuThread; pthread_t cpuThread;
pthread_create(&cpuThread, NULL, runTimer, (void *)cpuTimePtr); pthread_create(&cpuThread, NULL, runTimer, (void *)cpuTimePtr);
pthread_join(cpuThread, NULL); pthread_join(cpuThread, NULL);
sprintf(cpuOutput, "%f, Process: %d, %s %s operation end\n", accessTimer(LAP_TIMER, timeStringy), processId, command, argument); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(cpuOutput, "%f, Process: %d, %s %s operation end\n", timeDigits, processId, command, argument);
logOutput(configPtr, cpuOutput, false); logOutput(configPtr, cpuOutput, false);
// pthread_exit(NULL); // pthread_exit(NULL);
} }
@ -624,17 +646,20 @@ Dependencies: pthreads, sprintf, logOutput, ???
*/ */
void runIO(char *command, char *argument, int intArg, ConfigDataType *configPtr, int processId) void runIO(char *command, char *argument, int intArg, ConfigDataType *configPtr, int processId)
{ {
double timeDigits;
char timeStringy[MAX_STR_LEN]; char timeStringy[MAX_STR_LEN];
char ioOutput[MAX_STR_LEN]; char ioOutput[MAX_STR_LEN];
int ioTime = 0; int ioTime = 0;
int *ioTimePtr = &ioTime; int *ioTimePtr = &ioTime;
ioTime = intArg * configPtr->ioCycleRate; ioTime = intArg * configPtr->ioCycleRate;
sprintf(ioOutput, "%f, Process: %d, %s %s operation start\n", accessTimer(LAP_TIMER, timeStringy), processId, command, argument); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(ioOutput, "%f, Process: %d, %s %s operation start\n", timeDigits, processId, command, argument);
logOutput(configPtr, ioOutput, false); logOutput(configPtr, ioOutput, false);
pthread_t ioThread; pthread_t ioThread;
pthread_create(&ioThread, NULL, runTimer, (void *)ioTimePtr); pthread_create(&ioThread, NULL, runTimer, (void *)ioTimePtr);
pthread_join(ioThread, NULL); pthread_join(ioThread, NULL);
sprintf(ioOutput, "%f, Process: %d, %s %s operation end\n", accessTimer(LAP_TIMER, timeStringy), processId, command, argument); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(ioOutput, "%f, Process: %d, %s %s operation end\n", timeDigits, processId, command, argument);
logOutput(configPtr, ioOutput, false); logOutput(configPtr, ioOutput, false);
} }
@ -650,6 +675,7 @@ Dependencies: accessTimer, compareString, runCPU, runIO, ???
*/ */
void runProcess(ProcessControlBlock *singlePCB, ConfigDataType *configPtr, ProcessControlBlockLL *pcbList) void runProcess(ProcessControlBlock *singlePCB, ConfigDataType *configPtr, ProcessControlBlockLL *pcbList)
{ {
double timeDigits;
// run over the entire process, running the CPU when a CPU cycle comes up // run over the entire process, running the CPU when a CPU cycle comes up
// or a run IO when an IO cycle comes up // or a run IO when an IO cycle comes up
char timeStringy[MAX_STR_LEN]; char timeStringy[MAX_STR_LEN];
@ -667,7 +693,9 @@ void runProcess(ProcessControlBlock *singlePCB, ConfigDataType *configPtr, Proce
intArg = workingMeta->intArg2; intArg = workingMeta->intArg2;
intArgTwo = workingMeta->intArg3; intArgTwo = workingMeta->intArg3;
// inOutArg = workingMeta->inOutArg; // inOutArg = workingMeta->inOutArg;
while (!(compareString(command, "app") == EQUIV && compareString(argument, "end") == EQUIV) && !(compareString(command, "sys") == EQUIV && compareString(argument, "end") == EQUIV) && memManagerSuccess) while (!(compareString(command, "app") == EQUIV && compareString(argument, "end") == EQUIV) &&
!(compareString(command, "sys") == EQUIV && compareString(argument, "end") == EQUIV) &&
memManagerSuccess)
{ {
// check to see what operation will be performed // check to see what operation will be performed
if (compareString(command, "cpu") == EQUIV && compareString(argument, "process") == EQUIV) if (compareString(command, "cpu") == EQUIV && compareString(argument, "process") == EQUIV)
@ -685,27 +713,35 @@ void runProcess(ProcessControlBlock *singlePCB, ConfigDataType *configPtr, Proce
// run memory operations with the memory manager // run memory operations with the memory manager
if(compareString(argument, "allocate") == EQUIV) if(compareString(argument, "allocate") == EQUIV)
{ {
sprintf(processOutput, "%f, Process: %d, %s %s request (%d, %d)\n", accessTimer(LAP_TIMER, timeStringy), singlePCB->uniquePid, command, argument, intArg, intArgTwo); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(processOutput, "%f, Process: %d, %s %s request (%d, %d)\n", timeDigits,
singlePCB->uniquePid, command, argument, intArg, intArgTwo);
logOutput(configPtr, processOutput, false); logOutput(configPtr, processOutput, false);
// run the memory manager in allocate mode // run the memory manager in allocate mode
memManagerSuccess = memManager(pcbList, MEMORY_ALLOCATE, intArg, intArgTwo, configPtr, singlePCB); memManagerSuccess = memManager(pcbList, MEMORY_ALLOCATE, intArg, intArgTwo, configPtr, singlePCB);
if(!memManagerSuccess) if(!memManagerSuccess)
{ {
// //
sprintf(processOutput, "%f, Process: %d, failed %s %s request (%d, %d)\n", accessTimer(LAP_TIMER, timeStringy), singlePCB->uniquePid, command, argument, intArg, intArgTwo); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(processOutput, "%f, Process: %d, failed %s %s request (%d, %d)\n", timeDigits,
singlePCB->uniquePid, command, argument, intArg, intArgTwo);
logOutput(configPtr, processOutput, false); logOutput(configPtr, processOutput, false);
} }
} }
else if(compareString(argument, "access") == EQUIV) else if(compareString(argument, "access") == EQUIV)
{ {
sprintf(processOutput, "%f, Process: %d, %s %s request (%d, %d)\n", accessTimer(LAP_TIMER, timeStringy), singlePCB->uniquePid, command, argument, intArg, intArgTwo); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(processOutput, "%f, Process: %d, %s %s request (%d, %d)\n", timeDigits,
singlePCB->uniquePid, command, argument, intArg, intArgTwo);
logOutput(configPtr, processOutput, false); logOutput(configPtr, processOutput, false);
// run the memory manager in access mode // run the memory manager in access mode
memManagerSuccess = memManager(pcbList, MEMORY_ACCESS, intArg, intArgTwo, configPtr, singlePCB); memManagerSuccess = memManager(pcbList, MEMORY_ACCESS, intArg, intArgTwo, configPtr, singlePCB);
if (!memManagerSuccess) if (!memManagerSuccess)
{ {
// //
sprintf(processOutput, "%f, Process: %d, failed %s %s request (%d, %d)\n", accessTimer(LAP_TIMER, timeStringy), singlePCB->uniquePid, command, argument, intArg, intArgTwo); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(processOutput, "%f, Process: %d, failed %s %s request (%d, %d)\n", timeDigits,
singlePCB->uniquePid, command, argument, intArg, intArgTwo);
logOutput(configPtr, processOutput, false); logOutput(configPtr, processOutput, false);
} }
} }
@ -720,13 +756,15 @@ void runProcess(ProcessControlBlock *singlePCB, ConfigDataType *configPtr, Proce
if(memManagerSuccess) if(memManagerSuccess)
{ {
// //
sprintf(processOutput, "\n%f, OS: Process %d ended\n", accessTimer(LAP_TIMER, timeStringy), singlePCB->uniquePid); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(processOutput, "\n%f, OS: Process %d ended\n", timeDigits, singlePCB->uniquePid);
logOutput(configPtr, processOutput, false); logOutput(configPtr, processOutput, false);
} }
else else
{ {
// //
sprintf(processOutput, "\n%f, OS: Segmentation Fault, Process %d ended\n", accessTimer(LAP_TIMER, timeStringy), singlePCB->uniquePid); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(processOutput, "\n%f, OS: Segmentation Fault, Process %d ended\n", timeDigits, singlePCB->uniquePid);
logOutput(configPtr, processOutput, false); logOutput(configPtr, processOutput, false);
} }
// deallocate the memory for the process // deallocate the memory for the process
@ -757,6 +795,7 @@ void runSim(ConfigDataType *configPtr, OpCodeType *metaDataMstrPtr)
// char *nextCode; // char *nextCode;
// string variable for the timer stuff // string variable for the timer stuff
char simulatorOutput[MAX_STR_LEN]; char simulatorOutput[MAX_STR_LEN];
double timeDigits;
char timeStringy[MAX_STR_LEN]; char timeStringy[MAX_STR_LEN];
int processCount = 0; int processCount = 0;
int processIterator; int processIterator;
@ -765,7 +804,8 @@ void runSim(ConfigDataType *configPtr, OpCodeType *metaDataMstrPtr)
accessTimer(ZERO_TIMER, timeStringy); accessTimer(ZERO_TIMER, timeStringy);
// Operating System start timer goes here, log it. // Operating System start timer goes here, log it.
sprintf(simulatorOutput, "%f, OS: Simulator start\n", accessTimer(LAP_TIMER, timeStringy)); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(simulatorOutput, "%f, OS: Simulator start\n", timeDigits);
logOutput(configPtr, simulatorOutput, false); logOutput(configPtr, simulatorOutput, false);
// int variable for process to run // int variable for process to run
int currentPid; int currentPid;
@ -812,13 +852,17 @@ void runSim(ConfigDataType *configPtr, OpCodeType *metaDataMstrPtr)
{ {
// needs to set from READY to RUNNING // needs to set from READY to RUNNING
pcbPtr->process_state = PROCESS_STATE_RUNNING; pcbPtr->process_state = PROCESS_STATE_RUNNING;
sprintf(simulatorOutput, "%f, OS: Process %d set to RUNNING state from READY state\n\n", accessTimer(LAP_TIMER, timeStringy), pcbPtr->uniquePid); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(simulatorOutput, "%f, OS: Process %d set to RUNNING state from READY state\n\n", timeDigits,
pcbPtr->uniquePid);
logOutput(configPtr, simulatorOutput, false); logOutput(configPtr, simulatorOutput, false);
pthread_t runThread; pthread_t runThread;
pthread_create(&runThread, NULL, runTimer, (void *)processTimeLeftPtr); pthread_create(&runThread, NULL, runTimer, (void *)processTimeLeftPtr);
runProcess(pcbPtr, configPtr, pcbList); runProcess(pcbPtr, configPtr, pcbList);
// when finished, set to terminated // when finished, set to terminated
sprintf(simulatorOutput, "%f, OS: Process %d set to TERMINATED state from RUNNING state\n\n", accessTimer(LAP_TIMER, timeStringy), pcbPtr->uniquePid); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(simulatorOutput, "%f, OS: Process %d set to TERMINATED state from RUNNING state\n\n", timeDigits,
pcbPtr->uniquePid);
logOutput(configPtr, simulatorOutput, false); logOutput(configPtr, simulatorOutput, false);
pcbPtr->process_state = PROCESS_STATE_TERMINATED; pcbPtr->process_state = PROCESS_STATE_TERMINATED;
pthread_join(runThread, NULL); pthread_join(runThread, NULL);
@ -833,9 +877,11 @@ void runSim(ConfigDataType *configPtr, OpCodeType *metaDataMstrPtr)
pthread_join(cpuThread, NULL); pthread_join(cpuThread, NULL);
// deallocate all the memory for each process. // deallocate all the memory for each process.
memManager(pcbList, MEMORY_CLEAR, memoryOffset, memorySize, configPtr, pcbList->headPtr); memManager(pcbList, MEMORY_CLEAR, memoryOffset, memorySize, configPtr, pcbList->headPtr);
sprintf(simulatorOutput, "%f, OS: System Stop\n", accessTimer(LAP_TIMER, timeStringy)); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(simulatorOutput, "%f, OS: System Stop\n", timeDigits);
logOutput(configPtr, simulatorOutput, false); logOutput(configPtr, simulatorOutput, false);
sprintf(simulatorOutput, "%f, OS: Simulation End\n", accessTimer(LAP_TIMER, timeStringy)); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(simulatorOutput, "%f, OS: Simulation End\n", timeDigits);
logOutput(configPtr, simulatorOutput, true); logOutput(configPtr, simulatorOutput, true);
// deallocate the process list with destroyProcessList // deallocate the process list with destroyProcessList
destroyProcessList(pcbList); destroyProcessList(pcbList);
@ -858,6 +904,7 @@ Dependencies: sprintf, logOutput, ???
*/ */
int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPtr) int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPtr)
{ {
double timeDigits;
ProcessControlBlock *wkgPtr; ProcessControlBlock *wkgPtr;
int returnPid = -1; int returnPid = -1;
wkgPtr = headPointer->headPtr; wkgPtr = headPointer->headPtr;
@ -897,7 +944,9 @@ int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPt
// set the process within the PCB to the ready state, report in ready state. // set the process within the PCB to the ready state, report in ready state.
wkgPtr->process_state = PROCESS_STATE_READY; wkgPtr->process_state = PROCESS_STATE_READY;
// printf("Process %d set to READY from NEW\n", wkgPtr->uniquePid); // printf("Process %d set to READY from NEW\n", wkgPtr->uniquePid);
sprintf(loggingStr, "%f, OS: Process %d set to READY state from NEW state\n", accessTimer(LAP_TIMER, timeStringy), wkgPtr->uniquePid); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(loggingStr, "%f, OS: Process %d set to READY state from NEW state\n", timeDigits,
wkgPtr->uniquePid);
logOutput(configPtr, loggingStr, false); logOutput(configPtr, loggingStr, false);
} }
// move to the next pointer // move to the next pointer
@ -912,7 +961,9 @@ int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPt
if (wkgPtr->process_state != PROCESS_STATE_RUNNING && wkgPtr->process_state != PROCESS_STATE_TERMINATED) if (wkgPtr->process_state != PROCESS_STATE_RUNNING && wkgPtr->process_state != PROCESS_STATE_TERMINATED)
{ {
//printf("Process %d Selected with %.0f ms remaining\n", wkgPtr->uniquePid, wkgPtr->timeLeft); //printf("Process %d Selected with %.0f ms remaining\n", wkgPtr->uniquePid, wkgPtr->timeLeft);
sprintf(loggingStr, "%f, OS: Process %d selected with %.0f ms remaining\n", accessTimer(LAP_TIMER, timeStringy), wkgPtr->uniquePid, wkgPtr->timeLeft); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(loggingStr, "%f, OS: Process %d selected with %.0f ms remaining\n", timeDigits,
wkgPtr->uniquePid, wkgPtr->timeLeft);
logOutput(configPtr, loggingStr, false); logOutput(configPtr, loggingStr, false);
returnPid = wkgPtr->uniquePid; returnPid = wkgPtr->uniquePid;
} }
@ -940,7 +991,9 @@ int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPt
// set the process within the PCB to the ready state, report in ready state. // set the process within the PCB to the ready state, report in ready state.
wkgPtr->process_state = PROCESS_STATE_READY; wkgPtr->process_state = PROCESS_STATE_READY;
// printf("Process %d set to READY from NEW\n", wkgPtr->uniquePid); // printf("Process %d set to READY from NEW\n", wkgPtr->uniquePid);
sprintf(loggingStr, "%f, OS: Process %d set to READY state from NEW state\n", accessTimer(LAP_TIMER, timeStringy), wkgPtr->uniquePid); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(loggingStr, "%f, OS: Process %d set to READY state from NEW state\n", timeDigits,
wkgPtr->uniquePid);
logOutput(configPtr, loggingStr, false); logOutput(configPtr, loggingStr, false);
} }
// move to the next pointer // move to the next pointer
@ -991,7 +1044,9 @@ int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPt
if(processCount != 0) if(processCount != 0)
{ {
// printf("Process %d Selected with %.0f ms remaining\n", wkgPtr->uniquePid, wkgPtr->timeLeft); // printf("Process %d Selected with %.0f ms remaining\n", wkgPtr->uniquePid, wkgPtr->timeLeft);
sprintf(loggingStr, "%f, OS: Process %d selected with %.0f ms remaining\n", accessTimer(LAP_TIMER, timeStringy), shortestJobProcNum, (double)shortestJob); timeDigits = accessTimer(LAP_TIMER, timeStringy);
sprintf(loggingStr, "%f, OS: Process %d selected with %.0f ms remaining\n", timeDigits,
shortestJobProcNum, (double)shortestJob);
logOutput(configPtr, loggingStr, false); logOutput(configPtr, loggingStr, false);
} }
returnPid = shortestJobProcNum; returnPid = shortestJobProcNum;
@ -1002,20 +1057,4 @@ int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPt
} }
// return returnPid // return returnPid
return returnPid; return returnPid;
} }
/*
Name: simThread
Process: wrapper functions for threading in the simulator
Function Input/Parameters: milliseconds (int)
Function Output/Parameters: none
Function Output/Returned: none
Device Input/Device: none
Device Output/Device: none
Dependencies: pthreads, runTimer
*/
// void *simThread(int milSec)
// {
// runTimer(milSec);
// pthread_exit(NULL);
// }

View file

@ -219,16 +219,4 @@ Dependencies: ???
*/ */
int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPtr); int scheduleProcess(ProcessControlBlockLL *headPointer, ConfigDataType *configPtr);
/*
Name: simThread
Process: wrapper functions for threading in the simulator
Function Input/Parameters: milliseconds (int)
Function Output/Parameters: none
Function Output/Returned: none
Device Input/Device: none
Device Output/Device: none
Dependencies: ???
*/
// void *simThread(int milSec);
#endif // SIMULATORX #endif // SIMULATORX