In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "what is multitasking in computer programming". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "what is multitasking in computer programming" can help you solve your doubts. Let's follow the editor's ideas to learn new knowledge.
What is multitasking?
From the user's point of view, the computer does several things at the same time. There are mainly two situations, one is that you can write a blog while playing the video, and you can download files while tapping the code, which belongs to the situation where multiple applications are executed at the same time; the other is that if we observe the video player, you can operate the stop button when playing the video, which belongs to the multi-task within an application.
From the programmer's point of view, the computer executes multiple pieces of code at the same time. Here is a less rigorous diagram to illustrate the programmer's point of view of single-task and multi-task, assuming that two things need to be dealt with, namely TASK1,TASK2.
When a single task is executed, TASK1 is executed first, and when TASK1 is finished, TASK2 is executed. If it is multitasking, then TASK1 and TASK2 are executed alternately.
The so-called lack of rigor is worth in the actual system:
The division of task blocks is not necessarily uniform.
The order of execution is not necessarily strictly alternating.
Execution interval may not be necessary.
Why do you need multitasking?
There is a misunderstanding is to improve the efficiency of the system, it should be said that this is an inaccurate statement, in terms of execution time, the work that needs to be done is not reduced, of course, the time taken up by CPU will not be reduced. Not only that, multitask execution with more inter-TASK scheduling operations, in fact, the execution time will be slightly longer.
So what's the point of multitasking?
As can be seen from the figure above, although the total time has not changed, the execution interval of each task has become shorter, in other words, faster. If the interval is short enough (for example, 10 milliseconds), from a macro point of view, it looks as if both tasks are performing at the same time. The input can be processed in a timely manner.
To put it another way, multitasking is an effective solution if there is a task that requires at least one quick response to external requirements. Otherwise, there is no need to introduce multitasking.
Ways to achieve multitasking
The programmer implements it himself.
The two tasks are divided into small paragraphs and the alternating execution of the tasks is controlled by the program. The disadvantage of this approach is that the program will become very complex, and maintenance will be very troublesome when adding tasks or adjusting the contents of tasks. Of course, it also has advantages, this approach does not require the system to support multi-tasking, and is suitable for single-task systems or even programs executed on bare metal.
Implemented through the operating system
Each task is designed and implemented as a separate program, and the scheduling between tasks is realized by using the functions of the operating system. The advantage of this approach is that it maximizes the independence between tasks and makes it easy to add tasks or adjust the contents of tasks. Although this approach may increase system overhead, it has become mainstream in the current environment where software / hardware costs are falling.
After reading this, the article "what is multitasking in computer programming" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.