• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

How do OS's handle hyperthreading?

d4mo

Senior member
Like on an i7 for example is the OS smart enough to assign one thread per physical core before assign 2 to one?

For Example

Core 1
Logical core 1 - Thread
Logical core 2 - Nothing

Core 2
Logical core 1 - Thread
Logical core 2 - Nothing

Core 3
Logical core 1 - Thread
Logical core 2 - Nothing

Core 4
Logical core 1 - Thread
Logical core 2 - Nothing
 
Yes. Scheduling is pretty smart and pretty complex on the OS level. OSes do a lot of work to try to keep your CPU as busy as possible. The OS scheduler needs to take into account things like core affinity to make sure that you aren't getting a bunch of cache misses because your thread is leaping across cores (memory -> CPU is expensive).
 
Generally, no.

Scheduling is one of those core things that OSes do. They try to provide flexible schedulers that are very general purpose. Some OSes will allow you to change the scheduler that is being used to help optimize it for the system task (different scheduler for a database for example). But those are generally OSes geared towards servers and not end users.

It is best not to futz around with the scheduler. The guys that write these things put blood, sweat, and tears in them to make them work as fast and as efficiently as possible. Almost anything you would do will negatively impact your system's performance.

One way you can influence the scheduler is by bumping the priority of whatever it is you care about. In linux this is the "nice" value and in windows you can change it from the task manager. Be warned, though, if you do something like set a bunch of tasks to realtime which are CPU intensive, you can pretty much take down your OS. The scheduler will starve the OS in favor of running your app.
 
in a pure CompSci theoretical sense, the OS shouldn't know the difference between logical and virtual cores, and it shouldn't matter to the OS. in reality - it knows.
 
If that interests you, you should also look into core parking. Some related info there which can be interesting to learn and try.
 
Back
Top