It's quite a huge project and surely I won't implement it completely. I'll start soon, and I'll go on until I want.
Just a note: I'm not an expert. I'm a very newbie. Something I'll wrote will be wrong. Feel free to abuse me.
Another note: It's a really high-view of an OS. Maybe it's not an OS but a group of services. And the implementation it's quite impossibile.
But I would hear what you guys think about it
So let's start (I divided the system into point of views):
DEVICES
Each device/componenet have to be registered in the device manager. At the start-up, each connected device is initialized.
The category are:
- Processor (Cpu, Gpus, microcontrollers, FPGA, dsp)
- Main memory
- Storage (hdd, ssd, flash storage)
- Inputs (keyboard, mouse, webcam, mics, joypad, buttons, VR, scanner, bluetooth receive, ethernet, wifi)
- Outputs (video, speaker, mechanical outputs like vibration, printer)
- Bus (protocol that manages each internal bus: sata, pci, usb, battary management)
- Processor: each processor have to specify its task, a CPU regster itself as n device (n = nr of core), a GPU register itself as n cores that can do only particular jobs, a random generator (did you see them? sort of USB that you plug in and gives you random numbers) register itself as default processor that generates random number. So if I ask for a random number, I look at the device manager's default RNG, and then I ask him to give me my random bits.
- Memory: read/write. Must support paging. Memory protection is optional: high privilege task (driver) can write and execute, in every page; user tasks can write or execute, not both (protection agains self modifying code, a tecnique that is very interesting but I won't apply to user apps (see ABI and applications)
- Storage: read/write
- Inputs: many subcategories: example VR: track head, eyes, mouth movement; mics: give me a stream of uncompressed audio at xxkbps
- Outputs: many subcategories: video: bring the video memory buffer from the RAM and print it into the buffer; printer: receive the stram of character and print...
- Bus: each bus fall in its category
When an application starts, it starts each on a different core (eg: 3 cores, thread 1 = core 0, th2 = core1, th3 = core2, th4 = core0...), if the application requires "special" resources eg. read a file from the hdd, without askng the OS it can ask the hdd (that has to supply a standard "storage" interface) the file the application asked. Simple time scheduler, with a priority queue that lets urgent thread to run more often than common ones.
If the application want to process a shader, it asks to the GPU, that process it and (I don't know) write the processed shader in the video buffer.
If the application ask for a particular custom device that do a particulat task (eg cryptography), if it's not available abort the application.
FILESYSTEM
I know nothing about filesystem. Just quote that the OS's partition divides into /core, /drivers, /user
ABI and applications
Binary data divides into APPS and DRIVERS.
A driver is an already compiled executable that have to register its role in the system (video, audio...). It has high privileges and can access and write memory everywhere (dangerous?)
Apps come in an intermediate form (like java's bytecode) that is compiled during the installation (platform and processor indipendent). Apps can write only inside /user directory.
The OS should come with a rich build-in library, be modern (C++ style) and be coherent (all the function uses stdcall, no in-out parameters, not too much templates because it's ugly)
GRAPHICS
Most difficoult part?
The graphic part should be impemented with a buffer, so displays bring data directly form this buffer. Must support different resolution and different color depth. Build-in library have to implements some low level tasks to draw things on the screen
Feel free to comment