Sign in to follow this  
lexs

Kernel Design

Recommended Posts

So i'm trying to design a mini-kernel properly. You already know the basics, kernel keeps tasks and updates them. But how should the task get the timestep, should the kernel itself contain a timer and pass the dt to the task every update like: void update(float dt); or should i have a timer task where other tasks can request the current dt? And what if the task wants to be updated every 5 frame, or every 10'th second. Should it maybe register a method to the timer task which the timer task will call every 10'th second. Maybe i should just scrap the virtual update() method all together and only have timer callbacks? So that the task can register to have it's own update method call every frame only if it really needs it? I don't know and i need some help to decide a good non-limiting way of doing this.

Share this post


Link to post
Share on other sites
The way I handle it is the kernel passes the elapsed time to the tasks in the update method. If you want something that only updates every 10 ms I would add it as a member of a scheduler task. The scheduler task in it's simplest form takes two parameters. A time in ms to update and a task to update. The scheduler then just keeps track of elapsed time passed to it from the kernel and then will update the task that it was provided in the constructor.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this