Code: Select all
x:
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
jmp x
Code: Select all
x:
hlt
jmp x
Code: Select all
call _LowerDownSchedulerFrequency
x:
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
jmp x
Code: Select all
x:
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
jmp x
Code: Select all
x:
hlt
jmp x
Code: Select all
call _LowerDownSchedulerFrequency
x:
hlt
hlt
hlt
hlt
hlt
hlt
hlt
hlt
jmp x
In theory, putting multiple "hlt" instructions might cause the CPU to enter the "HLT state" (after interrupting the previous "hlt") a fraction of a nanosecond sooner. However, if the previous "hlt" was on one cache line and the next "hlt" is on the next cache line, then you'll probably have the extra expense (and power consumption) involved in fetching an additional cache line, so it'd be much worse.Lukand wrote:I thought to generate less heat and use less power.
That is cooperative, not preemptive. What if a process just does a while(true);?Brendan wrote:Hi,
For a real OS it's very likely that an IRQ handler will cause a task switch. For example, you might have a task waiting for a time-out; or waiting to receive data from the network, or from a file (from a storage device controller), or from a keyboard or mouse; where an IRQ means that the task can stop waiting.
True. But I think you may be missing the point.Lukand wrote:That is cooperative, not preemptive. What if a process just does a while(true);?Brendan wrote:Hi,
For a real OS it's very likely that an IRQ handler will cause a task switch. For example, you might have a task waiting for a time-out; or waiting to receive data from the network, or from a file (from a storage device controller), or from a keyboard or mouse; where an IRQ means that the task can stop waiting.
Then your idle task doesn't even get to run because the system isn't idle.Lukand wrote:What if a process just does a while(true);?