jeudi 6 août 2015

My TIPS for p2p blocklist.

So the legacy one:

I-Blocklist :

List name: level1Author: BluetackAuthor's website:bluetack.co.ukAuthor's description:Companies or organizations who are clearly involved with trying to stop filesharing.Companies which anti-p2p activity has been seen from.Companies that produce or have a strong financial interest in copyrighted material.Government ranges or companies that have a strong financial interest in doing work for governments.Legal industry ranges.IPs or ranges of ISPs from which anti-p2p activity has been observed.

Intro

Hi,

today i'll write a tip about cmd and affinity because nowadays it is common to have multi-core processors, and sometimes we don't want that a process spawn on all the cores.

So, in the MS Windows os, you can achieve this by various ways. You can do it with process explorer, just select the process in the list, do a right clic, and then clic on Set Affinity. A multi check box will be presented, then you just have to choose the core you want your process run onto.

But this method is noy optimal, because you'll have to do it each time you run your process.

Another method is to write a script, or a shortcut, and then launch the process via the cmd program.

CMD have an option named Affinity, where you will provide a hexadecimal number wich serve as a mask.

I found in the web a lot of article which said that if you want to run your process on core 0, you just have to put the number 1, like:

cmd /AFFINITY 1 notepad.exe

Result:

And if you wan to run it on core 1, just put the number 2:

cmd /AFFINITY 2 notepad.exe

Result:

Ok, it will work if just have a dual core, or for the first 2 core. But i dislike those article, because a lot of people, including me, first understand that if you want to run the process on core 2, i just have to put the number 3, right ?

In fact no !

Try this in a Quad core, or more:

cmd /AFFINITY 3 notepad.exe

You will have the process running on core 0 AND 1 !

Result:

The reason is because the number you provide is a mask value !

Core Table

Imagine if you have an octo core, each core will have the value 1, and write it like this:

AND Truth Table

To calculate the result, we have to do a logical AND. To have TRUE, you have to have TRUE AND TRUE.
If you have FALSE (0) AND TRUE (1) the result is FALSE (0).
If you have FALSE (0) AND FALSE (1) the result is FALSE (0).