The FIFO (First In, First Out) scheduler processes syscalls in the order they arrive, ensuring that earlier syscalls are handled before newer ones. This approach helps maintain a predictable sequence of operations, avoiding task starvation.
classFIFOScheduler(Scheduler):def__init__(self,llm,memory_manager,storage_manager,tool_manager,log_mode,get_llm_syscall: LLMRequestQueueGetMessage,get_memory_syscall: MemoryRequestQueueGetMessage,get_storage_syscall: StorageRequestQueueGetMessage,get_tool_syscall: ToolRequestQueueGetMessage, ):super().__init__( llm, memory_manager, storage_manager, tool_manager, log_mode, get_llm_syscall, get_memory_syscall, get_storage_syscall, get_tool_syscall, )defrun_llm_syscall(self):while self.active:try:# wait at a fixed time interval, if there is nothing received in the time interval, it will raise Empty llm_syscall = self.get_llm_syscall() llm_syscall.set_status("executing") self.logger.log(f"{llm_syscall.agent_name} is executing. \n", "execute" ) llm_syscall.set_start_time(time.time()) response = self.llm.address_syscall(llm_syscall) llm_syscall.set_response(response) llm_syscall.event.set() llm_syscall.set_status("done") llm_syscall.set_end_time(time.time())except Empty:passexceptException: traceback.print_exc()