Surely our security model will evolve as Cosmos evolves. However we need something simple, efficient, and with minimal impact to the users. I feel this is something most operating systems today fail greatly at.

Cosmos will be divided into rings. In some senses they are similar to traditional operating system rings however they are not enforced by hardware and thus do not have the runtime overhead. Instead they are enforced by the compiler and later by the installation system which will verify assemblies are part of installation.

A new assembly level attribute will be created for processing by IL2CPU. If the attribute is not present User Ring is the default.

Rings from highest to lowest:

- User
  - System
    - Hardware
      - Core

### Ring Control

Rings can only access assemblies in the same ring, or the next lower ring.

Core <-- Hardware <-- System <-- User

For example, System can consume classes in Hardware but not Kernel.

### Core Ring

In the core ring, "anything goes". This also means that code which does not require such privileges should not exist in the core ring. The core ring should be restricted to code which truly needs such unfettered access.

Priviliges that exist only in the core ring:

- Use of pointers and direct access to memory
- Access to x86 IO ports.
- Explicit assembly language code
- Unsafe code

The core ring includes functionality such as:

- Threading
- Memory management

Assemblies which are part of the core are restricted.

The core ring exposes objects which allow the hardware ring to access memory indirectly, and in a controlled restricted fashion. For example to allow a driver to acccess video RAM, a memory object can be created by the core ring which allows access to only the specific block of memory needed by the video driver.

### Hardware Ring

The hardware ring contains drivers and code for accessing hardware via more generic objects exposed by the kernel ring.

The hardware ring includes functionality such as:

- IDE
- SATA
- Ethernet
- USB Controller

The hardware ring may be further split into two levels at a later date. For example, a driver may exist for the USB Controller and it would require access to the core ring. But drivers implementing USB devices do not need to talk to hardware directly, but instead talk to the USB Controller driver.

### System Ring

The system ring contains code which builds functionality on top of hardware or other system assemblies.

The system ring includes functionality such as:

- File systems
- TCP/IP

### User Ring

The user ring is compromised of all user code including applications and services.