Another operating system architecture

    I decided to take a short break in the daily hobby coding, and share with you a description of what I actually do. So, I'm trying to develop and implement a virtual machine for a non-existent operating system, which I, perhaps, will also someday begin to implement. I will not argue with foam at the mouth, proving why another OS is needed, I will answer briefly: mainly then that I'm interested.




    So, my current vision of system architecture.

    1. There are two main entities: module and flow.
    2. The module contains unchanged code and mutable data.
    3. The module is permanent.

    The last paragraph says that the module always exists. In practice, this should be implemented through virtual memory. Those. the module’s pages currently being used are loaded into RAM, and unused pages are downloaded to disk. Permanent support should be at the system level, i.e. completely transparent to the application programmer. This can be considered a swap, brought to its logical conclusion, when we no longer need to load the module into RAM, since it will be in the “eternal” swap, and automatically loaded on demand. In other words, the file system is no longer needed.

    4. The module has many external procedures available for external calls. Module data is only available indirectly, through its external procedures.
    5. The module has an instance UUID (ID) and a type UUID (TID).
    6. When copying a module, a new ID is generated for the copy, but the old TID is saved.
    7. The module can be found by ID in the global network, or by TID on the local host.

    Only one module corresponds to each TID on the local host, even if there are several modules with the same TID.

    8. A thread can invoke an external procedure by its module ID and its numerical identifier.
    9. A thread can call an external procedure by the TID of its module located on the same host and its numerical identifier.

    Roughly speaking, TID is necessary for using modules as dynamically loaded libraries. In fact, the hosts will have a lot of the same code (system software, codecs, etc.), access to which should be very effective, and which does not make sense to use remotely.



    Now a multi-threaded synchronization model.

    1. The call to the external procedure is synchronized.
    2. An external procedure can be a function (f-procedure), a reader (r-procedure), or a writer (w-procedure). The F-procedure does not use modifiable data of the module, the r-procedure reads the modifiable data, and the w-procedure modifies them.
    3. Calling the module f-procedure is called without blocking.
    4. The r-procedure call is not blocked if other r-procedures are already called in this module.
    5. The call of the r-procedure and w-procedure is blocked if the w-procedure has already been called in this module.
    6. If the r-procedures and w-procedures are blocked, when the first one is unlocked, the w-procedure is executed.

    Those. there can be many readers without a writer, or just one writer. The writer has a higher priority over readers.



    In the above theses, a lot of things are missing. In particular, the security architecture is completely absent. Alas, I cannot formulate it yet.

    In subsequent posts I will describe the general architecture of the virtual machine, as well as details of its implementation up to the current state of the project. By the way, the current implementation is capable of executing factorial and quick sorting programs. For prematurely curious, I give a link to the repository: github.com/ababo/AntOS-VM-Prototype

    Also popular now: