Coder Social home page Coder Social logo

luslower / win32ps-changer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 62 KB

get or calculate the value of Win32PrioritySeparation

License: MIT License

PowerShell 100.00%
quantum scheduling-algorithms win32-api win32api windows-scheduler win32priority

win32ps-changer's Introduction

win32ps-changer

get or calculate the value of Win32PrioritySeparation

Total Downloads PayPal Badge

image

Win32PrioritySeparation is a registry value that allows you to adjust how Windows distributes CPU time between foreground processes and background processes.

This value determines the processor's time optimization strategy, affecting the duration and relative priority of foreground and background threads.

But what is it exactly?

Win32PrioritySeparation is a 6-bit mask (AABBCC), where each pair of bits controls a different aspect of the processor's timing optimization strategy

highest bits (AA) specify the duration of the interval This can be short or long (short or long)

the middle bits (BB) specify the length of the interval This can be variable or fixed (variable or fixed)

The first 4 bits divide their values ​​into this quantum table:

Dur/Leng Short Long
Variable 06 12 18 12 24 36
Fixed 18 18 18 36 36 36

lowest bits (CC) specify the processor time optimization strategy that should be distributed between the foreground and background threads

this can be:

Equal and fixed (1:1). Foreground and background threads get the same processor time at fixed intervals.

2:1 ratio. Foreground threads get twice as much processor time as background threads.

3:1 ratio. Foreground threads get three times more processor time than background threads.

priority separation can vary depending on the value you specify, a fixed quantum would completely nullify priority separation between threads

The best known way to manage this is by going to sysdm.cpl>settings>advanced

image

Background Services 2(2), default, default, 3:1

bitmask = 000010

foregroundquantum = 36 units

backgroundquantum = 36 units

apparently this has nothing to do with 3:1 in windows server, because the interval is fixed that overrides the PsPrioritySeparation of the quanta, although it is also taken as a boost for the current priority of foreground processes

lkd> dt _KPROCESS ffffa78530811080 -n QuantumReset nt!_KPROCESS //dwm
+0x281 QuantumReset : 36 '$'
lkd> dt _KPROCESS ffffa7852c0ec080 -n QuantumReset nt!_KPROCESS //windbg
+0x281 QuantumReset : 36 '$'
lkd> db PspForegroundQuantum 13
fffff801`1fb63574 24 24 24
lkd> dd PsPrioritySeparation 11
fffff801`1fb2c9d8 00000002

Programs 26(38), short, variable, 3:1

bitmask = 010110

foregroundquantum = 18 units

backgroundquantum = 6 units

here it seems we can see a 3:1, similarly the quanta are fixed but the PsPrioritySeparation is applied, because the length is variable

lkd> dt _KPROCESS ffffa78530811080 -n QuantumReset nt!_KPROCESS //dwm
+0x281 QuantumReset : 6
lkd> dt _KPROCESS ffffa7852c0ec080 -n QuantumReset nt!_KPROCESS //windbg
+0x281 QuantumReset : 18
lkd> db PspForegroundQuantum 13
fffff801`1fb63574 06 0c 12
lkd> dd PsPrioritySeparation 11
fffff801`1fb2c9d8 00000002

thanks to the information from: http://systemmanager.ru/win2k_regestry.en/29623.htm

It can be stated that the maximum supported value is 3F (111111) If any value exceeds the maximum, only the 6 least significant bits (LSB) can be read, which in short would be the 6 bits that start from right to left.

image

win32ps-changer's People

Contributors

luslower avatar

Stargazers

Fabio CN  avatar

Watchers

 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.