summaryrefslogtreecommitdiff
path: root/kernel/traps.s
diff options
context:
space:
mode:
authorJake Mannens <jake72360@gmail.com>2018-07-31 23:48:38 +1000
committerJake Mannens <jake72360@gmail.com>2018-07-31 23:48:38 +1000
commit7babda5d4573d432441a416f880cb8cc8c15b55b (patch)
tree65accc145f0d583a0c9f5f4cdd36e592a4bb9ca9 /kernel/traps.s
parent5a4038a196887994a09968dc08bee4b11e30c411 (diff)
Modified the scheduler so that a HLT instruction is executed if no
runnable task is found. This is a very basic method of putting the CPU into an idle state to reduce power consumption and heat production. This method is far from perfect however since when the CPU is woken by a timer interrupt, the scheduler runs through the entire process table again regardless of whether any task has become runnable, before putting the CPU back to sleep. In practice, this basic sleep mechanism reduced idle CPU usage of the VM from 100% to ~6%, a very effective amount. Updated the sleep() library function to use the new sys_alarm and sys_pause system calls. This method works by first registering a dummy signal handler, setting an alarm and finally calling pause() to put the process to sleep. When the alarm expires, the dummy signal handler is called (which returns immediately) and finally, the sleep() call returns. Note however, that this is a temporary function implemented poorly since it overwrites any pending alarms as well as the SIGALRM handler.
Diffstat (limited to 'kernel/traps.s')
0 files changed, 0 insertions, 0 deletions