Expanding out ideas on Simulator 2... trying to get everything working
This commit is contained in:
parent
93904cb2f3
commit
62418ec35a
5 changed files with 138 additions and 12 deletions
|
|
@ -24,15 +24,28 @@ typedef struct ProcessControlBlockStruct
|
|||
// this will be a mini loop within the master loop that goes until it
|
||||
// hits the app end command.
|
||||
// it may hold the next opcode, since you don't need to traverse backward
|
||||
char *nextOpCode;
|
||||
// have an IO cycle count here
|
||||
int ioCycles;
|
||||
// have a CPU cycle count here
|
||||
int cpuCycles;
|
||||
// maybe have a total cycle count here
|
||||
int totalCycles;
|
||||
// time left could be calculated from these.
|
||||
// potentially could change the cycles or have a 'left' variable to
|
||||
// see how many are left.
|
||||
// also need a time left state here?
|
||||
double timeLeft;
|
||||
// connect to the next process control block here
|
||||
struct ProcessControlBlockStruct *nextPtr;
|
||||
} ProcessControlBlock;
|
||||
|
||||
typedef struct ProcessControlBlockLLStruct
|
||||
{
|
||||
// holds the head ptr for PCBs
|
||||
ProcessControlBlock *headPtr;
|
||||
} ProcessControlBlockLL;
|
||||
|
||||
/*
|
||||
Name: ???
|
||||
Process: ???
|
||||
|
|
@ -51,7 +64,7 @@ Dependencies: ???
|
|||
/*
|
||||
Name: ???
|
||||
Process: ???
|
||||
// Function Input/Parameters: ???
|
||||
Function Input/Parameters: ???
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: none
|
||||
Device Input/Device: none
|
||||
|
|
@ -71,7 +84,45 @@ Dependencies: ???
|
|||
// need a function called destroyProcessList
|
||||
// deallocated the ll of PCBs recursively, frees the rest of the struct.
|
||||
|
||||
//
|
||||
// have a function to change the state of the process?
|
||||
// have it take in the process struct, switch it's state and report that it
|
||||
// has switched FROM a state TO a different state.
|
||||
|
||||
/*
|
||||
Name: createProcessList
|
||||
Process: reads through the opcode struct to fill out the linked list of PCBs
|
||||
Function Input/Parameters: metadata (OpCodeType *)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: head pointer to the PCBs
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: malloc, sizeof, ???
|
||||
*/
|
||||
ProcessControlBlockLL *createProcessList(OpCodeType *metadataPtr);
|
||||
|
||||
/*
|
||||
Name: destroyProcessList
|
||||
Process: deallocates memory used for the linked list struct
|
||||
Function Input/Parameters: head pointer to linked list (ProcessControlBlockLL *)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: NULL
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: free, destroyProcessListHelper, ???
|
||||
*/
|
||||
ProcessControlBlockLL *destroyProcessList(ProcessControlBlockLL *linkedListPtr);
|
||||
|
||||
/*
|
||||
Name: destroyProcessListHelper
|
||||
Process: recursively clears the PCB linked list struct, freeing the struct
|
||||
Function Input/Parameters: head pointer to linked list (ProcessControlBlockLL *)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: NULL
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: free, destroyProcessListHelper(recursively), ???
|
||||
*/
|
||||
ProcessControlBlock *destroyProcessListHelper(ProcessControlBlock *nodePtr);
|
||||
|
||||
/*
|
||||
Name: runSim
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue