GithubHelp home page GithubHelp logo

sniio / reservedcpusets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andreyrgw/reservedcpusets

0.0 0.0 0.0 137 KB

ReservedCpuSets is an extension of the SetRTCores feature of WindowsIoT CSP

License: GNU General Public License v3.0

C++ 17.41% C# 76.88% PowerShell 5.71%

reservedcpusets's Introduction

ReservedCpuSets

program-screenshot.png

Downloads Buy Me a Coffee

This is an extension of the WindowsIoT CSP Soft Real-Time Performance configuration and assumes you have read the documentation. SetRTCores essentially prevents interrupts and tasks from being scheduled on reserved cores so that you can isolate real-time applications from user and kernel-level disturbances by configuring affinity policies.

Important

Unexpected behavior occurs when a process affinity is set to reserved and unreserved CPUs. Ensure to set the affinity to either reserved or unreserved CPUs, not a combination of both. See #2 for more information.

Usage

  • Launch the program and select the CPUs you wish to reserve and save changes

  • After a restart, verify whether the configuration is working as expected by assessing per-core usage while placing load on the CPU with a program such as CpuStres. The reserved cores should be underutilized compared to the unreserved cores

Why a Separate Program?

This program aims to circumvent the limitations of the PowerShell script in the documentation by:

  1. Allowing customization of the bitmask instead of the configuration being limited to reserving the last N consecutive cores

  2. Revert the changes

  3. Adding support for earlier Windows 10 versions

How It Works

Upon inspection of system changes while configuring SetRTCores to 11 with the PowerShell script, the registry key below was created. After a few minutes of reverse engineering, the explanation for the value is relatively simple (see examples).

[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\kernel]
"ReservedCpuSets"=hex(3):FE,0F,00,00,00,00,00,00

Adding support for earlier versions of Windows 10 involves utilizing NtSetSystemInformation as demonstrated in CpuSet from Windows Internals.

Example 1

111111111110 corresponds to the bitmask for reserving the last 11 cores on a 12 core system. Converting the bitmask to hexal little endian results in FFE. Converting that value to hexal big endian results in FE0F. Hence, the registry value of FE,0F,00,00,00,00,00,00.

Example 2

11100000 corresponds to the bitmask for reserving the last 3 cores on an 8 core system. Converting the bitmask to hexal little endian results in E0. Converting that value to hexal big endian results in E0. Hence, the registry value of E0,00,00,00,00,00,00,00.

Since the registry value originates from an affinity bitmask, I have confirmed that it can be customized instead of the configuration being limited to the last N consecutive cores. Below is an example of 10101010.

custom-bitmask.png

Reverting the Changes

The documentation does not provide information as to how the value can be reverted to default. Since we are aware that a registry value is changed and does not exist by default, we can determine whether deleting the registry entry reflects in a local kernel debugger such as WinDbg by reading KiReservedcpusets.

Default

Write-Host $obj.SetRTCores // 0

lkd> dd KiReservedcpusets L1
fffff807`216fdc10  00000000

Setting SetRTCores to 3

Write-Host $obj.SetRTCores // 3

lkd> dd KiReservedcpusets L1
fffff807`216fdc10  000000e0

Deleting the ReservedCpuSets registry entry

Write-Host $obj.SetRTCores // 0

lkd> dd KiReservedcpusets L1
fffff807`216fdc10  00000000

In the program, reverting the changes is equivalent to unchecking all CPUs then saving changes.

reservedcpusets's People

Contributors

dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.