def dispatcher_func(self, cur_process): event_time = cur_process.run_for(self.quantum, self.time) + self.time time_left = cur_process.remaining_time if time_left <= 0: cur_process.process_state = ProcessStates.TERMINATED # Terminate process if it completes within the time frame of time slice event_type = EventTypes(3) return Event(process_id=cur_process.process_id, event_type=event_type, event_time=event_time) else: cur_process.process_state = ProcessStates.READY # Else put process in ready queue event_type = EventTypes(2) return Event(process_id=cur_process.process_id, event_type=event_type, event_time=event_time)
def dispatcher_func(self, cur_process): self.current = cur_process self.current_event._event_time = cur_process.run_for( self.current.remaining_time, self.time) + self.time self.current._process_state = ProcessStates.TERMINATED self.current_event._event_type = EventTypes(3) return self.current_event
def dispatcher_func(self, cur_process): event_time = cur_process.run_for(cur_process.remaining_time, self.time) + self.time cur_process.process_state = ProcessStates.TERMINATED event_type = EventTypes(3) return Event(process_id=cur_process.process_id, event_type=event_type, event_time=event_time)
def dispatcher_func(self, cur_process): event_time = cur_process.run_for( cur_process.remaining_time, self.time ) + self.time # Run process for its service time and assign it to a new var cur_process.process_state = ProcessStates.TERMINATED # Assign process state to termination event_type = EventTypes(3) # Assign event completion to new var return Event( process_id=cur_process.process_id, event_type=event_type, event_time=event_time) # Return new instance of Event class
def dispatcher_func(self, cur_process): processes = self.processes self.current = cur_process self.current_event._event_time = cur_process.run_for(self.quantum, self.time) + self.time if self.current.remaining_time <= 0: self.current._process_state = ProcessStates.TERMINATED else: self.current._process_state = ProcessStates.READY self.current_event._event_type = EventTypes(3) return self.current_event
def dispatcher_func(self, cur_process): self.current = cur_process self.current_event._event_time = cur_process.run_for(self.quantum, self.time) + self.time # print() # self.print_processes() # print() time_left = self.current.remaining_time # print(time_left) if time_left <= 0: self.current._process_state = ProcessStates.TERMINATED self.current_event._event_type = EventTypes(3) return self.current_event else: self.current._process_state = ProcessStates.READY return self.current_event