Syscalls

Here are syscalls designed for achieving functionalities in the AIOS kernel.

Module
AIOS System Calls

Scheduler

set_id, get_id, set_status, get_status, set_priority, get_priority

LLM core(s)

llm_generate

Memory Manager

mem_alloc, mem_read, mem_write, mem_clear

Storage Manager

sto_create, sto_read, sto_write, sto_retrieve, sto_clear

Tool Manager

tool_run

Context Manager

gen_snapshot, gen_restore, check_restore, clear_restore

Access Manager

/

To implement system calls, a dedicated Syscall class is designed that extends the functionality of the threading.Thread object in Python. This class serves as a foundational abstraction, encapsulating the behavior and execution of individual system calls. By inheriting from threading.Thread and overrides the run methods to ensure that the syscalls can be executed concurrently.

class Syscall(Thread):
    def __init__(self, agent_name, query: Request):
        super().__init__()
        self.agent_name = agent_name
        self.query = query
        self.event = Event()
        self.pid: int = None
        self.status = None
        self.response = None
        self.time_limit = None
        self.created_time = None
        self.start_time = None
        self.end_time = None

    def run(self):
        self.set_pid(self.native_id)
        self.event.wait()

Last updated