Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting all processes per box to a certain core #3276

Closed
bastik-1001 opened this issue Sep 3, 2023 · 6 comments
Closed

Setting all processes per box to a certain core #3276

bastik-1001 opened this issue Sep 3, 2023 · 6 comments
Labels
added in next build Added in the next Sandboxie version Feature request New feature or idea

Comments

@bastik-1001
Copy link
Contributor

Is your feature request related to a problem or use case?

The use case is to separate processes per sandbox to individual cores, without doing that manually.

So that one can set sandbox A to have all its processes use core 0, while sandbox B is set to have all its processes will be set to core 1 (or any other than 0).

Simply to isolate processes with the help of hardware features.

Describe the solution you'd like

If someone has special needs to set those processes on different cores per box, they might have to use a taskmanager, since that appears to be overkill for Sandboxie (out of the scope, as far as I am concerned). Having a setting that "forces" processes of a certain sandbox to use a specific core.

I don't know how Sandboxie handles the creation of processes, but it could check for a setting in the ini and set the processes CPU affinity to that accordingly.

Describe alternatives you've considered

I am not sure, if that can be done via a script or something like that, to cover all the processes that get created.

@bastik-1001 bastik-1001 added the Feature request New feature or idea label Sep 3, 2023
@DavidXanatos DavidXanatos added the ToDo To be done label Nov 27, 2023
@DavidXanatos DavidXanatos added added in next build Added in the next Sandboxie version and removed ToDo To be done labels Apr 5, 2024
DavidXanatos added a commit that referenced this issue Apr 5, 2024
@bastik-1001
Copy link
Contributor Author

If I use 0x00000001, the processes get bound to core 0, so that I can confirm that it works.

Apparently I don't understand how the bitmask works. Neither 0x00000010 (which I assumed to be core 1, as it would be two bits), nor 0x00000100 (which was expected to be 4 in binary) changed it to some other core, all cores were set to be used. (My system has 4 cores (0-3)).

@offhub
Copy link
Collaborator

offhub commented Apr 11, 2024

https://bitsum.com/tools/cpu-affinity-calculator/

@DavidXanatos
Copy link
Member

this is not binary its hex
0x00000001 core 1
0x00000002 core 2
0x00000003 core 1 and 2
0x00000004 core 3
0x00000008 core 4
0x00000010 core 5
0x00000020 core 6
0x00000040 core 7
0x00000080 core 8
and so on

@bastik-1001
Copy link
Contributor Author

bastik-1001 commented Apr 11, 2024

In the meantime, after looking up bitmask, which I did before I replied to this, stating that I fail to understand it, I tried 0x00000002, and it worked, as it, like you said, is not in binary. (Should be called hexmask, :) as the term bitmask made me believe it needed binary input)

@offhub
Copy link
Collaborator

offhub commented Apr 11, 2024

You can write it in binary and then convert it to hex.

Count starts from zero.
0 = Off
1 = On

For 4 cores:

BIN: 1001 (CPU3 On, CPU2 to CPU1 Off, CPU0 On) ==> HEX: 0x00000009

For 12 cores:

BIN: 1000 0000 0001 (CPU11 On, CPU2 to CPU10 Off, CPU0 On) ==> HEX: 0x00000801

sbie3276.mp4

@SSJPKXL
Copy link

SSJPKXL commented Apr 19, 2024

A bit off-topic, but for better isolation make sure to either disable HyperThreading in BIOS or use only odd core numbers for Intel CPU's and only even core numbers for AMD CPU's if you want to avoid using fake cores for sandboxes while keeping HyperThreading enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added in next build Added in the next Sandboxie version Feature request New feature or idea
Projects
None yet
Development

No branches or pull requests

4 participants