Welcome to ServerFault!
You have two CPU sockets, that is two physical processors. Each processor has 10 cores, each core being basically equivalent to a classic single-core CPU on its own. Each core can only run 1 thread at a time, i.e. hyperthreading is disabled.
So, you can have a total maximum of 20 threads executing in parallel, one thread per CPU/core. That can mean 20 single-threaded jobs, 1 multi-threaded job with 20 threads, or anything in between.
But that is only for threads that are expected to be 100% busy at work all the time, almost every millisecond of their life. If your threads are going to spend any significant time waiting for something else to happen, the system will automatically be able to run other threads while your thread(s) are waiting.
Unless you are in an environment that is heavily optimized for number crunching, you aren't going to get all those 20 threads for yourself for 100% of the time: the background processes (daemons) of the OS are going to occupy some of them for some (small) proportion of time. Run ps -ef
(or equivalent) on any modern unix-like system when it's idle: you are going to see way more than 20 processes, each containing at least one thread, and that is just for the OS itself.
Assuming that you'll get the most out of the system by allocating exactly the number of threads the hardware has available may be oversimplifying the optimization problem. Depending on exactly what you're doing, you might want to use more or less threads. For example, if you are planning for heavy calculation jobs that are inherently CPU-bound, you might actually get better results by allocating slightly less than 20 threads for your job, so that one or two CPU cores will remain available for the OS's background tasks, so your job threads will get interrupted less often.
But if you are setting up a J2EE server environment, the JVM will usually have a large number of threads, and most of which will spend most of their life waiting for input, so the total number of threads used by the J2EE server's JVM on a 20-CPU system can easily be way higher than 20.