Skip to content

CafePixel/simpletought

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 

Repository files navigation

Simple tought (Concept)

Concept imagined by the user. README generated by Copilot.

🧠 Overview

This project presents a conceptual idea for a new computer architecture where memory and CPU are designed to natively understand and manage pointers and references. The goal is to address one of the most persistent sources of bugs in software development: unsafe or invalid memory access due to poor pointer management.

Architecture Overview

The memory safety model spans the full system stack:

  1. Hardware

    • Manages reference counts for all variables.
    • Checks access hashes on every read/write.
    • Automatically frees memory when refcount == 0.
  2. BIOS / Firmware

    • Initializes the hardware reference system.
    • Sets up global permissions and prepares reference hashes for authorized programs.
  3. Operating System

    • Distributes access hashes to programs according to policy.
    • Ensures isolation between programs without performing per-access checks (hardware handles that).
  4. Applications / Software

    • Manipulate references securely.
    • No direct memory management needed; unsafe pointer operations are impossible.

Core Concept

  • Variables live only in RAM: Programs never manipulate raw addresses, only hardware-managed references.
  • References are lightweight handles managed by the CPU, which internally tracks:
    • The physical memory address
    • A reference count (updated only on creation/destruction of a reference)
    • Optional integrity hash and access permissions
  • Automatic memory management: When the last reference to a variable is destroyed, the memory is freed automatically.
  • Optional security: Hashes and permissions can be enabled for critical data, ensuring that only authorized programs can read/write.
  • Performance flexibility: References can be created with or without hash checks, allowing trade-offs between speed and safety depending on the use case.

Advantages

  • Memory safety by design: Prevents use-after-free, null dereference, and memory corruption.
  • Predictable performance: No runtime garbage collection pauses; hardware handles reference counting.
  • Controlled inter-program access: Only programs with valid hashes can share references.
  • Reduced developer burden: No manual memory management; safer code by default.

πŸ” Enhanced Memory Security with BIOS Control and Hash (Optional)

For critical variables, the system can enable a hash-based access control combined with BIOS-enforced reference limits:

Each reference is assigned a unique hash provided by the OS or the authorized program.

Only references with the correct hash can read or write the variable. Unauthorized access is blocked by the hardware.

Access is verified at reference registration, not at every read/write, preserving performance.

The BIOS can enforce a maximum number of simultaneous references per variable or per program. If the limit is reached, new reference requests are denied, even if the hash is correct.

Combined with reference counting, this allows precise tracking of how many programs are accessing a critical variable at any time.

Can have flags for only read or write/read.

πŸ’‘ The goal is to make memory access safer and more complex than traditional systems, while keeping flexibility for less sensitive variables.

Conceptual Flow#

Program A requests a variable -> OS issues reference + hash
Program A uses reference -> hardware updates refcount automatically
Reference goes out of scope -> refcount decreases
Refcount reaches 0 -> hardware frees memory
Program B attempts access -> hardware verifies hash; access denied if invalid

⚠️ Disclaimer

This is a conceptual idea imagined by the user. The user does not plan to develop this project themselves. This repository is intended to share the vision and invite experienced developers, researchers, and hardware architects to explore and experiment with the concept.

πŸ“¬ Get Involved

If you're interested in exploring this idea further, feel free to:

  • Fork the repository
  • Share your thoughts and improvements
  • Prototype the concept in software or hardware simulation

This idea was born out Godot, when need adding features and must learn new langages and make another game engine.

More clear ?

🎯 Concept Overview

SimpleTought β€” Memory with Stable References
Instead of working with raw memory addresses, we use protected references (small identifiers).
A central table translates these references into the actual values in memory.
Values can be moved / replaced / compacted without breaking the references.

Goals:

  • Eliminate entire classes of bugs (dangling pointers, double free, memory corruption)
  • Simplify memory management
  • Enable hot‑reload, streaming, and memory compaction

Cost: One extra indirection (mitigated by caches and inlined small values).
Status: Open concept β€” contributions and experiments welcome.


βœ… The 3 Core Invariants

  1. Stability
    A reference is not a raw address: it stays valid even if the value moves.

  2. Simple Safety
    If the value is freed, the generation changes β†’ old references fail gracefully.

  3. Controlled Size
    A reference should cost about the same as a pointer (~8 bytes); everything else lives in the table.


Conceptual Diagram

[ Ref (id, gen, flags) ] ──► [ Central Table ] ──► [ Value (RAM/VRAM/...) ] β–² β”‚ └─ (thread-local cache) β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Releases

No releases published

Packages

No packages published