int createProcess(int priority) { int pid; /*** INSERT YOUR CODE HERE ***/ pid = nextpid; nextpid++; insertList(&readyList,pid,priorityFunctionPtr); pcb[pid].priority = priority; pcb[pid].state = state_new; fprintf(stdout, "%d: process %d created\n", now, pid); if(running == -1) { dispatching(); } else if(preemptive &&compare_burstlength(pid,running)) { insertList(&readyList,running,priorityFunctionPtr); fprintf(stdout, "%d: process %d pre-empted\n", now, running); running = -1; dispatching(); } return pid; }