How does the kernel scheduler know a timeslice has passed?

Adam Thompson

In my previous question How does the kernel scheduler know how to pre-empt a process? I was given an answer to how pre-emption occurs.

Now I am wondering, how does the kernel scheduler know that a timeslice has passed? I read up on the hardware timer solution which makes sense to me, but then I read that most current operating systems (e.g. Windows, Linux, etc.) do not use hardware timers, but rather software timers.

How can software timers be used to pre-empt a process once it has taken up its timeslice (e.g. it did not pre-empt itself.) It seems like some hardware timer would be necessary?

Stephen Kitt

It seems like some hardware timer would be necessary?

Yes, the kernel relies on hardware to generate an interrupt at regular intervals. On PCs, this was historically the 8253/8254 programmable interval timer, or an emulation thereof, then the local APIC timer, then the HPET.

Current Linux kernels can be built to run “tickless” when possible: the kernel will program timers to only fire when necessary, and if a given CPU is running a single process, that may well be “never”. In most cases, dynamic ticks are used, so the kernel sets timers up to fire at varying intervals depending on its requirements — fewer interrupts means fewer wake-ups, which means idle CPUs can be kept in low-power modes for longer periods, which saves energy.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How does the Linux kernel manage data that has been passed to a user program via DMA?

分類Dev

How to know the address range of kernel stack in user process and kernel thread?

分類Dev

How does javascript know it has reached the end of __proto__ lookup chain

分類Dev

How to know if a set of threads has finished

分類Dev

How to know when a block has been completed

分類Dev

How to know if the winform has stopped functioning/responding

分類Dev

How to know the values of CR registers from linux user and kernel modes

分類Dev

how does the bootloader pass the kernel command line to the kernel?

分類Dev

How does the app know a component is a page

分類Dev

How does Terraform know what files to load?

分類Dev

How to know what an object porperty does

分類Dev

How to know what an object porperty does

分類Dev

How does this function know the variable exists?

分類Dev

How does ps know to hide passwords?

分類Dev

How does gcc know where boost is installed

分類Dev

How does the motherboard know that the OS is hibernated?

分類Dev

How does a computer "know" that it is being turned on?

分類Dev

How does NSDate seem to know it's TimeZone?

分類Dev

React how to know how many child components a parent has?

分類Dev

In CUDA programming how to understand if the GPU kernel has completed its task?

分類Dev

How to know if a user already has a role in an addrole command

分類Dev

How to know if a user already has a role in an addrole command

分類Dev

How to know which variable has a value and which one is null?

分類Dev

How to know quantity of objects that has specific property in common?

分類Dev

How to know if a flutter image has been seen by the user

分類Dev

JQuery how to know out of all select which has lost focus

分類Dev

How do I know if a QuickBlox message has been throttled

分類Dev

How to know in advance if a .zip has a parent directory inside

分類Dev

How to know if the ESP8266 has been manually reset?

Related 関連記事

  1. 1

    How does the Linux kernel manage data that has been passed to a user program via DMA?

  2. 2

    How to know the address range of kernel stack in user process and kernel thread?

  3. 3

    How does javascript know it has reached the end of __proto__ lookup chain

  4. 4

    How to know if a set of threads has finished

  5. 5

    How to know when a block has been completed

  6. 6

    How to know if the winform has stopped functioning/responding

  7. 7

    How to know the values of CR registers from linux user and kernel modes

  8. 8

    how does the bootloader pass the kernel command line to the kernel?

  9. 9

    How does the app know a component is a page

  10. 10

    How does Terraform know what files to load?

  11. 11

    How to know what an object porperty does

  12. 12

    How to know what an object porperty does

  13. 13

    How does this function know the variable exists?

  14. 14

    How does ps know to hide passwords?

  15. 15

    How does gcc know where boost is installed

  16. 16

    How does the motherboard know that the OS is hibernated?

  17. 17

    How does a computer "know" that it is being turned on?

  18. 18

    How does NSDate seem to know it's TimeZone?

  19. 19

    React how to know how many child components a parent has?

  20. 20

    In CUDA programming how to understand if the GPU kernel has completed its task?

  21. 21

    How to know if a user already has a role in an addrole command

  22. 22

    How to know if a user already has a role in an addrole command

  23. 23

    How to know which variable has a value and which one is null?

  24. 24

    How to know quantity of objects that has specific property in common?

  25. 25

    How to know if a flutter image has been seen by the user

  26. 26

    JQuery how to know out of all select which has lost focus

  27. 27

    How do I know if a QuickBlox message has been throttled

  28. 28

    How to know in advance if a .zip has a parent directory inside

  29. 29

    How to know if the ESP8266 has been manually reset?

ホットタグ

アーカイブ