What is multithreading?


Most modern processors are built with multiple cores, which help them work on many things at once.  Each core provides one or more threads to the operating system to use for multitasking.  For more information, see here.


Veil Core v1.0.1.5 introduced multithreaded zerocoin validation to speed up block validation time.  This is helpful because zerocoin spends require significant CPU processing compared to a normal cryptocurrency transaction.


To speed up blockchain sync, multithreading allows each thread to work on 7 or more spends at a time, rather than waiting for 1 thread to process them all.  The link above shows the massive increase in speed this provides.


How do I enable multithreading?


Multithreading is set to 2 threads by default, but can be adjusted with the following command in your veil.conf file inside your data directory (this example sets it to 4 threads).


threadbatchverify=4


How do I know how many threads I have available?


Windows

1. Press Ctrl + Shift + Esc to open Task Manager.

2. Select the Performance tab to see how many cores and logical processors your PC has.

3. Logical processors is the amount of threads you have. If your computer has 4 Threads then it is the best to choose 2.


MacOS

1. Click the Apple icon in the top-left corner of your Mac.

2. This will bring up a drop-down menu. Pick the top option: About This Mac.

3. The resulting window should show you the information you need including processor speed, memory, and graphics card information.

4. Click on Hardware. The total number of cores *2 are your available threads, so if you have 4 cores it means you have 8 threads.


Linux

1. Open terminal in Linux.

2. Execute this command: grep -c ^processor /proc/cpuinfo.

3. The output is the amount of threads available.

You may notice that you have more threads than CPU cores.  This can be done with tech like hyperthreading, which simulates twice as many threads as you have cores.


How many threads should I choose?


You may not want to choose the full amount of threads available to you because your system may become unusable or unstable.  For example a VPS with 2 threads may want to limit themselves to 1 thread so other software does not crash.  50% of available threads is generally safe, but there isn't much harm in trying out different amounts to see what is best for you.