Octacone wrote:I was thinking about something specific, for example would it speed up my GUI or make it more "fluent" in a way?
Something like:
1 core = 14 FPS
4 cores = 56 FPS
Without changing the code that runs the GUI, only adding SMP support.
In a single process with a single thread[1], without changes to the code? No, at least not in most instances without some sort of compiler sleight-of-hand. What it
will do is allow you to have multiple processes - or multiple kernel-supported threads within a process, if your kernel scheduler allows it - to run in parallel on different cores, truly simultaneously, rather than interleaved via time slicing.
IOW, while it won't make a single strictly sequential program any faster, it will let you run several programs at once faster than could be done if they were all splitting time on a single core, and a program which uses multithreading
may run faster if the kernel scheduler is thread-aware and capable of floating threads across multiple cores (and the threads are compute-bound rather than I/O-bound or IPC-bound). To put it another way, if there are 4 programs running on a four-core system, such that each gets a core scheduled more or less to itself, they will each run at something close to what they would if they were the only program running.
In any case, the CPU cores might not be the best thing for speeding up the GUI - the real answer for that specific case most likely is to have a good GPU driver (which has enough cores, and enough specialized architectural operations, to make a difference), rather than trying to use software rendering. Keep in mind that internally, the GPU
is a specialized form of symmetrical multiprocessor (mostly, it's a bit more complicated than that but it's close enough for this discussion), one that is designed for that particular task.
Of course, this leads to the problem of having the necessary documentation for the GPU, which is its own can of worms.
Octacone wrote:Another example will it calculate some number "X" times faster?
No, not in the general case. For specific cases, where the problem is broken up over multiple threads, it depends on how parallelizable the problem is, but even under the best case scenario it won't scale linearly, as there will be IPC overhead, added scheduling overhead, etc.
If the problem is something like, 'compute a single spreadsheet formula', then no, almost certainly not. If it is 'compute several spreadsheet cells in parallel', maybe, if the answers don't cascade (that is, they can each be computed without knowing the results of any of the other cells' computations). If it is 'add five thousand numbers together into one final result', well, there are ways to use multiple threads on multiple cores to speed it up, yes, through some sort of divide and conquer approach, but it won't be a linear speed-up[2], and it would have to be programmed to do it somewhere (there are specialized compilers which can parallelize that sort of thing, but your typical GCC back-end isn't going to without a lot of tweaking) - and again, this is more something you'd ideally use GPGPU programming for if the dataset is large enough to justify it (5000 probably isn't).
[1] It helps to keep the distinction between 'thread' and 'process' in this topic, even if you don't use multithreading - every process has at least one implicit thread of execution, even if there are no
explicitly created threads. Technically, the process is the protected memory environment in which the process's threads run, not the implicit thread of execution itself.
[2] Algorithmically, such a divide and conquer approach is potentially better than linear, even for a strictly sequential algorithm; the so-called '
Russian peasant method' of multiplication is just such an algorithm. However, when you take both setup time and IPC overhead into account, and the fact that you'd have more threads than cores for the general case (or possibly the reverse for manycore or GPGPU programming), it's pretty much a coin flip whether it would be better or worse than applying this sort of tree reduction as a single thread or not.