AIOS Docs
  • Welcome
  • Getting Started
    • Installation
    • Quickstart
      • Use Terminal
      • Use WebUI
    • Environment Variables Configuration
  • AIOS Kernel
    • Overview
    • LLM Core(s)
      • LiteLLM Compatible Backend
      • vLLM Backend
      • Hugging Face Backend
      • LLM Routing
    • Scheduler
      • FIFOScheduler
      • RRScheduler
    • Context
    • Memory
      • Base Layer
      • Agentic Memory Operations
    • Storage
      • sto_mount
      • sto_create_file
      • sto_create_directory
      • sto_write
      • sto_retrieve
      • sto_rollback
      • sto_share
    • Tools
    • Access
    • Syscalls
    • Terminal
  • AIOS Agent
    • How to Use Agent
    • How to Develop Agents
      • Develop with Native SDK
      • Develop with AutoGen
      • Develop with Open-Interpreter
      • Develop with MetaGPT
    • How to Publish Agents
  • AIOS-Agent SDK
    • Overview
    • LLM Core API
      • llm_chat
      • llm_chat_with_json_output
      • llm_chat_with_tool_call_output
      • llm_call_tool
      • llm_operate_file
    • Memory API
      • create_memory
      • get_memory
      • update_memory
      • delete_memory
      • search_memories
      • create_agentic_memory
    • Storage API
      • mount
      • create_file
      • create_dir
      • write_file
      • retrieve_file
      • rollback_file
      • share_file
    • Tool API
      • How to Develop Tools
    • Access API
    • Post API
    • Agent API
  • Community
    • How to Contribute
Powered by GitBook
On this page
  1. AIOS Kernel
  2. Scheduler

RRScheduler

RRScheduler

The Round Robin scheduler ensures fair distribution of processing time among tasks by limiting each task's execution time and cycling through all tasks.

Key Features

  • Configurable time slice per task (default: 1 second)

  • Fair CPU time distribution

  • Support for suspending and resuming long-running tasks

  • Preemptive scheduling

Core Functions

def _execute_syscall(self, syscall, executor, syscall_type):
    try:
        syscall.set_time_limit(self.time_slice)
        syscall.set_status("executing")
        self.logger.log(f"{syscall.agent_name} is executing {syscall_type} syscall.\n", "executing")
        syscall.set_start_time(time.time())

        response = executor(syscall)
        syscall.set_response(response)
        
        if response.finished:
            syscall.set_status("done")
            log_status = "done"
        else:
            syscall.set_status("suspending")
            log_status = "suspending"

        syscall.set_end_time(time.time())
        syscall.event.set()
        
        self.logger.log(
            f"{syscall_type} syscall for {syscall.agent_name} is {log_status}. Thread ID: {syscall.get_pid()}\n",
            log_status
        )
        
        return response
    # Error handling omitted for brevity
PreviousFIFOSchedulerNextContext

Last updated 1 month ago