Operating-System-Simulator / Sim02 / simulator.h
simulator.h
Raw
#ifndef SIMULATOR_H
#define SIMULATOR_H

#include "datatypes.h"
#include "StringUtils.h"
#include "pthread.h"
#include "simtimer.h"

// function prototypes
void changeProcessState( ConfigDataType *configPtr, 
                            fileWriteList **fileWriteList, PCB *PCB, int state );
bool checkProgramEnd( PCBLinkedList **PCBLinkedListPtr );
PCB *chooseNextProcess( ConfigDataType *configPtr, fileWriteList **fileWriteList, 
                                               PCBLinkedList *PCBLinkedListPtr );
PCBLinkedList *clearPCBList( PCBLinkedList *pcbList );
void createPCB( OpCodeType *startOpCode, PCBLinkedList **PCBLLIterPtr, int cycleTime );
void displayHandler( ConfigDataType *configPtr, fileWriteList **fileWriteListPtr, 
                                    char *toWrite, bool writeOnly, bool newLine );
PCB *FCFS_N_Choice( PCBLinkedList **PCBList, ConfigDataType *configPtr, fileWriteList **fileWriteListPtr );
int getNextPID();
int getTimeFromOpCode( ConfigDataType *configPtr, OpCodeType *opCodePtr );
void initializeProcesses( ConfigDataType *configPtr, fileWriteList **fileWriteListPtr,
                          PCBLinkedList **PCBLinkedList );
void printPCBList( PCBLinkedList **pcbLLPtr );
void printWriteList( fileWriteList **fileWriteListPtr );
void scanForNewPCBs( OpCodeType **metaDataMstrPtr, PCBLinkedList **PCBLinkedListPtr, ConfigDataType *configPtr );
PCB *runProcess( ConfigDataType *configPtr, fileWriteList **fileWriteList, 
                             PCBLinkedList *PCBLinkedListPtr, PCB *PCB );
void runSim( ConfigDataType *configPtr, OpCodeType *metaDataMstrPtr );
void runTimerFor( long milliseconds );
fileWriteList *writeToFile( ConfigDataType *configPtr, fileWriteList **printList );

enum PROCESS_STATES{NEW=0, READY, RUNNING, WAITING, EXIT};

// string end for fileWriteList 
#define END_OF_STRLIST "---end-of-list---"

#endif // SIMULATOR_H