Kernel maintenance thread

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
invalid
Member
Member
Posts: 60
Joined: Thu Feb 23, 2012 8:39 am

Kernel maintenance thread

Post by invalid »

Hello!

In my other topic (http://forum.osdev.org/viewtopic.php?f=1&t=25084 - thanks to all participants!) it appears to be a consensus that the kernel usually needs some maintenance thread.

I can see two reasons for spawning such thread:
  • some work may be postponed to be run in background (e.g. cleaning lists of unused entries)
  • implementation details create artifacts, which are hard to override (e.g. problem with releasing current task's stack)
And now I wonder: what are the jobs that you decided/were forced to defer to the maintenance thread in your kernel?
User avatar
brain
Member
Member
Posts: 247
Joined: Thu Nov 05, 2009 5:04 pm
Location: UK
Discord: https://discord.gg/brainbox
GitHub: https://github.com/braindigitalis
Contact:

Re: Kernel maintenance thread

Post by brain »

How about garbage collection for interpreted languages ;-) I intend to add this as soon as its needed, right now I just garbage collect in the main thread at regular intervals between lines of interpreted code.
User avatar
bluemoon
Member
Member
Posts: 1761
Joined: Wed Dec 01, 2010 3:41 am
Location: Hong Kong

Re: Kernel maintenance thread

Post by bluemoon »

You may also do some kind of benchmark, adaptive adjustment of parameters based on collected data and runs in background.
For example, cache expiry/invalidation to reclaim memory.

Basically, IMO, kthread are workaround for monolith kernel which those functionality are likewise implemented in servers for micro kernel.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Kernel maintenance thread

Post by egos »

There are some jobs that are executing within same or several kernel-owned threads:
  • zeroing pages;
  • thread destruction;
  • executing HLT;
  • etc.
If you have seen bad English in my words, tell me what's wrong, please.
Post Reply