RRScheduler

The Round-Robin (RR) scheduler allocates fixed time quantum slices (we set as 0.5s by default) for each LLM system call execution, and will invoke the context manager to perform context switch between different system calls when time slice expires or the process voluntarily yields.

class RRScheduler(Scheduler):  # Inherits from Scheduler
    def __init__(
        self,
        llm,
        memory_manager,
        storage_manager,
        tool_manager,
        log_mode,
        get_llm_syscall: LLMRequestQueueGetMessage,
        get_memory_syscall: MemoryRequestQueueGetMessage,
        get_storage_syscall: MemoryRequestQueueGetMessage,
        get_tool_syscall: ToolRequestQueueGetMessage,
    ):
        super().__init__(  # Call parent class constructor
            llm,
            memory_manager,
            storage_manager,
            tool_manager,
            log_mode,
            get_llm_syscall,
            get_memory_syscall,
            get_storage_syscall,
            get_tool_syscall,
        )
+       self.time_limit = 0.5  # Time slice for each syscall
+       self.simple_context_manager = SimpleContextManager()  # Context switching manager
        

Last updated