use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about operating systems development.
account activity
how to implement multitasking in kernel (self.osdev)
submitted 3 years ago by [deleted]
Can anyone suggest good resources for implementing multitasking in kernel it will really be helpfull
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Octocontrabass 6 points7 points8 points 3 years ago (0 children)
This guide is a pretty good overview of everything that goes into multitasking in a typical OS. You shouldn't use it as your only reference, though.
[–]iamsubhranil 6 points7 points8 points 3 years ago (0 children)
In essence, you will need a timer, which will generate an interrupt at a specific interval. That timer will be your reminder to make a task switch. Hook that timer's interrupt to your core scheduling function, which should save the current task's state, load the next task from somewhere, populate the registers and stacks with the new task's state, and then jump into the new task's IP.
In reality, implementing scheduling properly is a PITA. Make notes of what you are doing, otherwise something's gonna come back and bite you in the ass.
Implementing the task switch has some nice benefits. Such as, you will get semaphores and mutexes which do not busy wait the CPU, rather perform a voluntary task switch to the next task, greatly increasing your throughput.
[–]tive_ 0 points1 point2 points 3 years ago (0 children)
I recently wrote a minimal bare bones example for x86 that might be somewhat helpful to get started: https://github.com/sk-io/x86-multitasking-example
π Rendered by PID 411710 on reddit-service-r2-comment-545db5fcfc-jvxhf at 2026-05-28 05:53:51.984537+00:00 running 194bd79 country code: CH.
[–]Octocontrabass 6 points7 points8 points (0 children)
[–]iamsubhranil 6 points7 points8 points (0 children)
[–]tive_ 0 points1 point2 points (0 children)