{"id":20119086,"url":"https://github.com/luslower/win32ps-changer","last_synced_at":"2025-05-06T14:32:05.925Z","repository":{"id":244729754,"uuid":"816088961","full_name":"LuSlower/win32ps-changer","owner":"LuSlower","description":"get or calculate the value of Win32PrioritySeparation","archived":false,"fork":false,"pushed_at":"2024-12-30T02:17:48.000Z","size":74,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T13:46:46.179Z","etag":null,"topics":["quantum","scheduling-algorithms","win32-api","win32api","win32priority","windows-scheduler"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuSlower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-17T02:38:17.000Z","updated_at":"2025-04-07T14:52:55.000Z","dependencies_parsed_at":"2024-07-05T13:30:00.186Z","dependency_job_id":"f0b583c2-26a2-4ebc-a5ee-82c2009997b3","html_url":"https://github.com/LuSlower/win32ps-changer","commit_stats":null,"previous_names":["luslower/win32ps-changer"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuSlower%2Fwin32ps-changer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuSlower%2Fwin32ps-changer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuSlower%2Fwin32ps-changer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuSlower%2Fwin32ps-changer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuSlower","download_url":"https://codeload.github.com/LuSlower/win32ps-changer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252703451,"owners_count":21790887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quantum","scheduling-algorithms","win32-api","win32api","win32priority","windows-scheduler"],"created_at":"2024-11-13T19:14:17.992Z","updated_at":"2025-05-06T14:32:05.920Z","avatar_url":"https://github.com/LuSlower.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# win32ps-changer\nget or calculate the value of Win32PrioritySeparation\n\n[![Total Downloads](https://img.shields.io/github/downloads/LuSlower/win32ps-changer/total.svg)](https://github.com/LuSlower/win32ps-changer/releases)\n\n![image](https://github.com/user-attachments/assets/9a0e1c9c-d67f-4dcd-a7bb-07225941b99a)\n\n\u003e Win32PrioritySeparation is a registry value that allows you to adjust how Windows distributes CPU time between foreground processes and background processes.\n\nThis value determines the processor's time optimization strategy, affecting the duration and relative priority of foreground and background threads.\n\nBut what is it exactly?\n\n`Win32PrioritySeparation` is a 6-bit mask (AABBCC), where each pair of bits controls a different aspect of the processor's timing optimization strategy\n\nhighest bits (AA)\nspecify the duration of the interval\nThis can be short or long (short or long)\n\nthe middle bits (BB)\nspecify the length of the interval\nThis can be variable or fixed (variable or fixed)\n\nThe first 4 bits divide their values ​​into this quantum table:\n\n| Dur/Leng |  Short   |    Long    |\n|----------|----------|------------|\n| Variable | 06 12 18 | 12 24 36   |\n| Fixed    | 18 18 18 | 36 36 36   |\n\nlowest bits (CC)\nspecify the processor time optimization strategy that should be distributed between the foreground and background threads\n\nthis can be:\n\nEqual and fixed (1:1). Foreground and background threads get the same processor time at fixed intervals.\n\n2:1 ratio. Foreground threads get twice as much processor time as background threads.\n\n3:1 ratio. Foreground threads get three times more processor time than background threads. \n\npriority separation can vary depending on the value you specify, a fixed quantum would completely nullify priority separation between threads\n\nThe best known way to manage this is by going to `sysdm.cpl\u003esettings\u003eadvanced` \n\n![image](https://github.com/LuSlower/Win32Ps-Changer/assets/148411728/b110a7e4-7c5f-4be6-b30d-58b20c8ad995)\n\n_Background Services_\n2(2), default, default, 3:1\n\nbitmask = 000010\n\nforegroundquantum = _36 units_\n\nbackgroundquantum = _36 units_\n\napparently this has nothing to do with 3:1\nin windows server, because the interval is fixed that overrides the `PsPrioritySeparation` of the quanta,\nalthough it is also taken as a boost for the current priority of foreground processes\n\n```\nlkd\u003e dt _KPROCESS ffffa78530811080 -n QuantumReset nt!_KPROCESS //dwm\n+0x281 QuantumReset : 36 '$'\nlkd\u003e dt _KPROCESS ffffa7852c0ec080 -n QuantumReset nt!_KPROCESS //windbg\n+0x281 QuantumReset : 36 '$'\nlkd\u003e db PspForegroundQuantum 13\nfffff801`1fb63574 24 24 24\nlkd\u003e dd PsPrioritySeparation 11\nfffff801`1fb2c9d8 00000002\n```\n\n_Programs_\n26(38), short, variable, 3:1\n\nbitmask = 010110\n\nforegroundquantum = _18 units_\n\nbackgroundquantum = _6 units_\n\nhere it seems we can see a 3:1, similarly the quanta are fixed but the `PsPrioritySeparation` is applied, because the length is variable\n\n```\nlkd\u003e dt _KPROCESS ffffa78530811080 -n QuantumReset nt!_KPROCESS //dwm\n+0x281 QuantumReset : 6\nlkd\u003e dt _KPROCESS ffffa7852c0ec080 -n QuantumReset nt!_KPROCESS //windbg\n+0x281 QuantumReset : 18\nlkd\u003e db PspForegroundQuantum 13\nfffff801`1fb63574 06 0c 12\nlkd\u003e dd PsPrioritySeparation 11\nfffff801`1fb2c9d8 00000002\n```\n\nthanks to the information from:\nhttps://learn.microsoft.com/en-us/previous-versions/cc976120(v=technet.10)?redirectedfrom=MSDN\n\nIt can be stated that the maximum supported value is 3F (111111)\nIf 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.\n\n![image](https://github.com/user-attachments/assets/32b0d87f-454c-457e-a6e9-4944c6121402)\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluslower%2Fwin32ps-changer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluslower%2Fwin32ps-changer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluslower%2Fwin32ps-changer/lists"}