Python-based application multi-thread operation optimization method

An application program and operation optimization technology, which is applied in the direction of program code conversion, multi-program device, resource allocation, etc., can solve problems such as unpredictable, asynchronous, and uncertain order of transaction operation

Inactive Publication Date: 2018-01-12
SICHUAN CHANGHONG ELECTRIC CO LTD
View PDF2 Cites 3 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] (1) These tasks are asynchronous in nature and require multiple concurrent transactions;
[0008] (2) The running sequence of each transaction can be uncertain, random, and unpredictable
However, once it involves a time-consuming program that takes up too much computer resources, the program will enter a state of suspended animation, and can only run the current event that needs to be processed. At this time, because the multi-threading function is not enabled, for new user input or server response , the program will wait for the current thread to be completely processed, that is, the current thread is terminated before re-opening the thread for processing the next related processes

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Python-based application multi-thread operation optimization method
  • Python-based application multi-thread operation optimization method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0048] The present invention will be further described below in conjunction with the accompanying drawings. It should be noted that this embodiment is based on the technical solution and provides detailed implementation and operation steps, but the scope of protection of the present invention is not limited to the embodiment.

[0049] First of all, the operation process of the program before applying the present invention is as follows: figure 1 As shown, when the program receives a new operation from the user, if it is still in the state of processing the current request, the new request will be suspended, wait for the current time-consuming operation to be processed, and then process the new one ask. It should be noted that if there are too many new requests, it will take up too much memory space, and the program will enter a state of suspended animation, and will not be able to respond to user interaction events.

[0050] The program flow after applying the optimization of...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a python-based application multi-thread operation optimization method. The method comprises the following steps that firstly, a threading module of python is imported; secondly, a thread inherited to the threading module is created, a .run() function of the thread is rewritten, and a long-running operation in an original main program is packaged in the thread again; thirdly, a thread pool used for storing the running thread is created at a main entrance of a program, and the data structure of the thread pool is a list; fourthly, the content is deleted in the place wherethe long-running operation is originally called, the packaged thread is called, and a .start ()function is used for starting a specified thread; fifthly, a wx.CallAfter module is called in the specified thread to return data of a server to the main program. According to the method, multiple program operations can be carried out at the same time, and the program can be effectively prevented from entering a fake halt state.

Description

technical field [0001] The invention relates to the field of Windows terminal application security, in particular to a python-based multi-thread operation optimization method for application programs. Background technique [0002] Python is a high-level scripting language that combines interpretability, compilation, interactivity and object-oriented. Python is designed to be highly readable. Compared with other languages, it often uses English keywords and some punctuation marks in other languages. It has more distinctive grammatical structures than other languages. Python is an interpreted language: this means that there is no compilation part of the development process. Similar to PHP and Perl languages. Python is an interactive language: this means that you can execute programs you write directly and interactively at a Python prompt. Python is an object-oriented language: This means that Python supports an object-oriented style or programming technique in which code is...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/20G06F8/30G06F8/41G06F9/50
Inventor 罗为
Owner SICHUAN CHANGHONG ELECTRIC CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products