Author
| What do you thinks about this new chronogram system for MNBIOS?
|
flyguille msx master Posts: 1420 | Posted: June 04 2005, 17:27   |
These are the general rules for control the cpu's time.
Concepts:
Cycle is 1 second.
Lapse the time between two interrupts.
Process can be an aplication, a instance of an aplication or a driver with time asigned.
Ma "letme Alone Mode"
Mr "Rithmic Mode"
Ms "Use rest time Mode"
Mh "High priority Mode"
First, the MNBIOS looks for the attribute's process that has the FOCUS (first plane).
If the process has Ma enabled, this process will get the 100% of the cpu time. Only the processes with Mh enabled can steal him his time.
As normally none process has Mh enabled and will not, "Letme Alone Mode" is special for games being able get the 100% of the cpu time. And is a issue of the user if in a given moment he sets in a process the high priority flag.
if the process has Ma disabled and Mr enabled this process with FOCUS will be executed rithmicly 1 time each X interrupts . And the unused time is asigned to the rest of the processes following the general rules. Both, high and normal priority processes can use the unused time. This mode is for those aplication that needs rithmic execution but not needs all the interrupts lapses.
Both flags "Mr" and "Ma" has relevance only when the process has the focus, if the process hasn't the focus, the process is handled with the rest of the general rules.
REST OF GENERAL RULES
-------------------------------
if the process with focus has Ma and Mr is disabled all the processes will be handled equally using the following rules.
When a process has Ms disabled, the process is requiring a fixed ammount of time to use.
When a process has Ms enabled, the process is requiring to use the free time of the cpu.
Priority levels.
------------------
High priority + Ms disabled
Low priority + Ms disabled
High priority + Ms enabled
Low priority + Ms enabled
the agent takes care that each process has assigned a lapse at least. If there is not enought time to share, the processes without time assigned will stole time to the processes that have bigger quantity of assigned time.
The free cpu time is shared between all the processes that have Ms enabled.
The agent allways care that the cycle is always of ONE SECOND.
For that reason the kernel knows if is a msx of 60 or 50 interrupts per second.
I hope with this chronogram to get the attemption of the game's developers.
This system is already done, and it is 29KB of source code!!!!!!!! WOW! (like 1kb compiled code, I hops!).
|
|
Edwin msx professional Posts: 753 | Posted: June 04 2005, 21:26   |
My first impression is that it is a bit elaborate for a z80 based system. My instinct that something this complex will bring you quite a few problems you haven't even thought about. Also, I'm wondering how priority scheduling will work when you have no real way of doing idle detection.
Do you have any timings about the overhead this system creates?
|
|
flyguille msx master Posts: 1420 | Posted: June 04 2005, 22:06   |
For the idle detection... i will use the old style of mnbios... the program that is idling after do the checks "can" if it doesn't want to do nothing just release the cpu time with a function for that purpose.
This brings a problem, it is that releasing the time before the lapse ends, it shorts the cycle making it less than 1 second.
On other hand as the kernel can't overrides itself will be possible that the system loses interrupts events, and with that making larger the cycle. That will be seen when some application are doing heavy things on DISK/VRAM and at the same time you have a rithmic music player on focus that makes noticed about the larger size of the cycle.
OFFCOURSE, no one music player will use the rithmic attribute to play a song... there is others ways like the master sound buffering.
But as this things are impossible to solve in a standard msx system i will left it as it is. Maybe in some new msx generation there will be a NMI interruption to help.
|
|
flyguille msx master Posts: 1420 | Posted: June 04 2005, 22:16   |
the Rithmic attribite is more for upgrading an animation in background that for the human eye seens continuous...
rithmic animation can be used for the obsonet driver... so in that way there is not large lapses without flushing the buffers
|
|
Edwin msx professional Posts: 753 | Posted: June 04 2005, 22:58   |
To be honest, I have no idea whether it will work. My instinct rings a lot of alarm bells because there are so many sides to msx that weren't designed for this. I fear that every piece of hardware must be abstracted in a driver to make this work (and I won't even say without glitches). Good luck though. It's one of the most complex tasks anyone has undertaken.
|
|
flyguille msx master Posts: 1420 | Posted: June 04 2005, 23:04   |
for that is the kernel/drivers/libraries, and RULES!.
|
|
flyguille msx master Posts: 1420 | Posted: June 04 2005, 23:15   |
By example:
RULE NUMBER 1, aplications don't accesses directly to devices... , for that is hundreds and hundreds of FAST functions waiting for you call him. As the kernel don't can override itself all the overriding problems are solved
|
|
Edwin msx professional Posts: 753 | Posted: June 04 2005, 23:53   |
Btw, next time you want to call it a "scheduler" instead of a chronogram.  |
|
|
|
|