Parallel programing is a ancient subject. But still not very used (my opinion).
At a simple desktop application (connection with database, sales and purchases), whats the benefits can provide the parallel programing?
When you say parallel programming, do you mean multithreading ?
Yes, I know it the parallel programing provide benefice related to performance. But to a simple desktop app (sales, ...), is there a benefice?
The only answer is: it depends. It's really use case based. Threads are not the answer to all e.g. you can do much things asynchronously with Qt.
Parallel processing helps if you have functions that take a long time to return (for example, if your database queries take 5 seconds). In this example, your GUI will freeze if you use 1 thread only.
Having said that, you might be able to optimize your program in other ways (for example, you could rewrite your SQL query to be more efficient). If you can make your functions return faster, then you don't need parallel programming.
Yes, I know it the parallel programing provide benefice related to performance.
Not always. If you use it wrongly, you can get worse performance.
as @JKSH said multi-threading programming helps only if your algorithm can be parallelized.
Keep in mind that if you use multiple threads you MUST synchronize the access to shared data so, sometimes, make no-sense use threads instead of working with a single thread and asyncrhonous mode
@mcosta in response to 'MUST synchronize the access to shared data', this is not the only method. There is the 'lock free queue' concept, but as this can be troublesome, and usually only considered as an optimization. I see it coming up in the world of audio plugin development, but I'm sure there are other performance bound contexts.
@Meyer-Sound You're right. sometimes synchronization is not the only way.
BTW my concept was that multi-thread programming is NOT the best solution to solve every problem.
Keep in mind that creating sub-process or threads consumes resources and sometimes this is a problem.
In the original example from @Exotic_Devel (DB connections for simple sales and purchases) you can easly manage all the work with the standard Qt asynchronous mode
The other example is when you are trying to rename a lot of files, since I/O is very very slow, you would not like this kind of operations to "freeze" your UI. To give the users a feeling that your UI still "alive", you can create a thread to rename the files, and update the QProgressBar.
The chapter 8 of the book "advanced Qt programming", will show you how to do it.