📜 ⬆️ ⬇️

Is multitasking a myth?


In this blog, as in many others, various authors (including me) often write about how good parallel technologies and all sorts of “many” terms are: multitasking, multi-core ... And this is understandable :-). But lately, I often began to sit at a computer waiting for the completion of a task, just like the little man in this picture. Moreover, as a computer with two cores, and with four. What are these tasks that make me wait for their completion?

Task 1 - big long tests


When developing our software product, we use, among other things, a self-made testing system that performs code analysis in several dozen test projects in C / C ++. On a machine with four cores, tests are now performed for an hour and a half. The testing system allows, of course, to use either a part of the cores, or use a lower process priority, so that everything does not slow down during testing. However, since the result of the tests (passed / not passed) I want to know more quickly, it is better to boot the machine to the full and not disturb it. Thus, the user (the programmer running the tests) sits and waits for the completion of the work. And no multitasking will allow him to do something useful on this machine. Decision? Hardware multitasking - a second computer or laptop. Well, or you can drink tea while the computer is busy ...

Task 2 - User Interface Testing


Another system that we use when developing a software product allows us to automate user interface testing. This is a tool that opens the necessary windows in the program, clicks on the buttons and menu items. The tool is not particularly demanding on the hardware and the dual-core machine is quite enough for him. But regardless of the number of cores in the computer, apart from testing the user interface, nothing can be done at this moment. Because the system strives to click on the button it needs, open the window it needs, select the menu item it needs. And again I have to sit and wait for it to end. Well, as for the second computer and tea, so clear ...
')

Task 3 - Downloading Files from the Internet


When I had a modem for 33,600, I hoped that happy times would come and the files could be downloaded instantly. Happy times have come, but I still download files for a very long time. Regardless of the speed of the Internet, there is always something that does not download immediately, but only in a few hours. And if this is something I really need, then again you have to wait. No parallel ways of downloading files fundamentally solve the problem.

Not everything can be improved with parallelization?


It turns out that, despite the number of cores in the machine, there will always be tasks that lead the user to wait for the completion of their work. What does this mean when developing software? It is necessary to provide the user with the first results as soon as possible before the final results are ready. Here is how it is done in the above three tasks:
  1. The testing system shows the results immediately during the execution of each test, and not at the end. As a result, if tests can immediately show that there is a breakdown, then it is not necessary to wait for completion.
  2. User interface testing can also be interrupted when errors are first detected.
  3. Programs download files from the Internet have learned how to show the contents of the files, if possible, before the download is complete. Yes, and actively developing services, for example, online-video, which allow you not to download files.


Summary: while developing your programs, let the user start working with the results as early as possible. And do not expect that the miracle of parallel programming technology will make your users happy for you.

What is this post about? Despite the undoubted development of computers in terms of performance in general and parallel technologies in particular, it is still necessary to think through software solutions so that the user has to wait as little as possible near the computer. Keep this in mind when developing your own programs.

Source: https://habr.com/ru/post/95810/


All Articles