CN109062706A - The method that is communicated between electronic device and its limiting process, storage medium - Google Patents
The method that is communicated between electronic device and its limiting process, storage medium Download PDFInfo
- Publication number
- CN109062706A CN109062706A CN201810700051.3A CN201810700051A CN109062706A CN 109062706 A CN109062706 A CN 109062706A CN 201810700051 A CN201810700051 A CN 201810700051A CN 109062706 A CN109062706 A CN 109062706A
- Authority
- CN
- China
- Prior art keywords
- server
- binder
- communications
- client
- request
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/547—Remote procedure calls [RPC]; Web services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/541—Client-server
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/54—Indexing scheme relating to G06F9/54
- G06F2209/548—Queue
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
This application discloses a kind of methods communicated between limiting process, this method comprises: intercepting and capturing the binder when client sends binder request to server-side and requesting and obtain the accumulative number of communications of active client and server-side, accumulative total number of communications at current service end;It calculates accumulative number of communications and adds up the ratio of total number of communications, and judge whether ratio is greater than setting ratio;If so, waiting list end is added in the binder request of intercepting and capturing;Wherein, the binder request in set period of time post-processing waiting list.Disclosed herein as well is a kind of electronic devices and a kind of storage medium.By the above-mentioned means, the ratio of client and server-side number of communications and the total number of communications of server-side can be limited to setting ratio by the application, the fluency of system thereby may be ensured that.
Description
Technical field
The present invention relates to technical field of electronic equipment, more particularly to what is communicated between a kind of electronic device and its limiting process
Method, storage medium.
Background technique
Currently, with the continuous development of science and technology, the electronic devices such as smart phone increasingly become people's daily life
Necessity.
Android system is the common operating system of one kind of the electronic devices such as smart phone, two processes in Android system
Between communicated, the user's space between process cannot be shared, therefore the communication between two processes is logical
Often Binder mechanism is needed to realize communication.Existing electronic device does not use Binder mechanism to carry out communication feelings between process
The monitoring mechanism of condition, and interprocess communication process can not be optimized, cause system fluency not high.
Summary of the invention
The technical solution that the embodiment of the present application uses is: providing a kind of method communicated between limiting process, this method
It include: to intercept and capture the binder when client sends binder request to server-side and request and obtain active client and clothes
Accumulative number of communications, accumulative total number of communications at current service end at business end;Calculate accumulative number of communications and accumulative total communication time
Several ratio, and judge whether ratio is greater than setting ratio;If so, binder is requested waiting list end is added;Wherein,
Binder request in the post-processing waiting list of set period of time.
Another technical solution that the embodiment of the present application uses is: providing a kind of electronic device, which includes: to obtain
Modulus block, for intercepting and capturing the binder and requesting and obtain existing customer when client sends binder request to server-side
Accumulative number of communications, accumulative total number of communications at current service end at end and server-side;Computing module, for calculating accumulative communication
Number and the ratio for adding up total number of communications;Judgment module, for judging whether ratio is greater than setting ratio;Execution module is used
In when ratio is greater than setting ratio, binder is requested waiting list end is added;Wherein, in the post-processing of set period of time
Binder request in the waiting list.
Another technical solution that the embodiment of the present application uses is: providing a kind of electronic device, which includes place
Reason device and memory, memory are electrically connected with processor, and memory is calculated for storing computer program, processor for calling
Machine program is to realize above-mentioned method.
Another technical solution that the embodiment of the present application uses is: a kind of storage medium, and storage medium is calculated for storing
Machine program, computer program can be performed to realize above-mentioned method.
The embodiment of the present application is by intercepting and capturing the binder request simultaneously when client sends binder request to server-side
Obtain accumulative number of communications, the accumulative total number of communications at current service end of active client and server-side;Calculate accumulative communication
Number and the ratio for adding up total number of communications, and judge whether ratio is greater than setting ratio;If so, binder is requested to be added
Waiting list end;Wherein, the binder request in the post-processing of the set period of time waiting list, can be by client
It is limited to setting ratio with the ratio of server-side number of communications and the total number of communications of server-side, thereby may be ensured that the smoothness of system
Property.
Detailed description of the invention
Fig. 1 is the flow diagram of the method communicated between the application first embodiment limiting process;
Fig. 2 is the schematic illustration of interprocess communication in the embodiment of the present application;
Fig. 3 is the schematic illustration of Binder communication mechanism;
Fig. 4 is the interaction schematic diagram of client and server-side;
Fig. 5 is the flow diagram of the method communicated between the application second embodiment limiting process;
Fig. 6 be client, server-side, waiting list interaction schematic diagram;
Fig. 7 is the flow diagram of the method communicated between the application 3rd embodiment limiting process;
Fig. 8 is the flow diagram of the method communicated between the application fourth embodiment limiting process;
Fig. 9 is the module diagram of the embodiment of the present application electronic device;
Figure 10 is the hardware structural diagram of the embodiment of the present application electronic device.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete
Site preparation description.It is understood that specific embodiment described herein is only used for explaining the application, rather than to the limit of the application
It is fixed.It also should be noted that illustrating only part relevant to the application for ease of description, in attached drawing and not all knot
Structure.Based on the embodiment in the application, obtained by those of ordinary skill in the art without making creative efforts
Every other embodiment, shall fall in the protection scope of this application.
Term " first ", " second " in the application etc. be for distinguishing different objects, rather than it is specific suitable for describing
Sequence.In addition, term " includes " and " having " and their any deformations, it is intended that cover and non-exclusive include.Such as comprising
The process, method, system, product or equipment of a series of steps or units are not limited to listed step or unit, and
It is optionally further comprising the step of not listing or unit, or optionally further comprising for these process, methods, product or equipment
Intrinsic other step or units.
Referenced herein " embodiment " is it is meant that a particular feature, structure, or characteristic described can wrap in conjunction with the embodiments
It is contained at least one embodiment of the application.Each position in the description occur the phrase might not each mean it is identical
Embodiment, nor the independent or alternative embodiment with other embodiments mutual exclusion.Those skilled in the art explicitly and
Implicitly understand, embodiment described herein can be combined with other embodiments.
The process of each Android system can only operate in the virtual address space that oneself process is possessed.Virtual address is empty
Between include user's space independent of each other and kernel spacing.For user's space, cannot be shared each other between different processes,
And the kernel spacing between different processes is sharable.Different two processes (for example, client and server-side) it is every
Primary communication will be realized by being located at the Binder driver of kernel spacing.
The embodiment of the present application by monitoring one client and server-side between accumulative number of communications and server-side with it is different
Client between the total degree that communicates, and the ratio of number and total degree is limited to setting ratio, avoid the client with
Server-side number of communications excessively leads to the slack problem of system, referring specifically to following description.
Referring to Fig. 1, Fig. 1 is the flow diagram of the method communicated between the application first embodiment limiting process.
In the present embodiment, the method communicated between limiting process may comprise steps of:
Step 101: when client sends binder request to server-side, intercepting and capturing the binder and request and obtain current visitor
The accumulative number of communications of family end and server-side, accumulative total number of communications at current service end.
Wherein, Binder mechanism is a kind of mode of Inter-Process Communication in Android system (IPC).Four in Android system are big
Component is respectively as follows: Activity (workflow), Service (service), Broadcast (radio receiver), Content
Provider (content provider), different App (application program).This four big component all operates in different processes,
Binder mechanism is the bridge of these Inter-Process Communications.
As shown in Fig. 2, Fig. 2 is the schematic illustration of interprocess communication in the embodiment of the present application, each Android system into
Journey can only operate in the virtual address space that oneself process is possessed.Virtual address space includes user's space independent of each other
And kernel spacing.For user's space, cannot be shared each other between client and server-side, and client and server-side it
Between kernel spacing be sharable.Client will be by being located at kernel spacing with communicating each time for server-side
Binder driver is realized.
Based on the principle of above-mentioned binder mechanism, it can be appreciated that client and server-side can be any two process, it can
To be application, it is also possible to service, for example, it may be being also possible to using the communication between application using between service
Communication.Wherein, client refers to that client process, server-side refer to server-side process.
Fig. 3 is further regarded to, Fig. 3 is the schematic illustration of Binder communication mechanism, and Binder communication uses C/S framework,
For component visual angle, include Client process (client), Server process (server-side), Service Manager (service
Management) and binder driver, wherein Service Manager is for the various services in management system.
Wherein, Client process is the process using service.
Server process is the process for the service that provides.
The effect of Service Manager process is that the Binder name of character style is converted in Client to this
The reference of Binder enables Client to obtain the reference to Binder entity in Server by Binder name.
Binder driver is responsible for the foundation that Binder between process is communicated, transmitting of the Binder between process,
Binder reference count management, a series of basic-level supports such as the transmitting and interaction of data packet between process.
Mainly include following three processes in the communication process based on binder mechanism:
Registration service (add Service): Server process will first register Service to Service Manager.The mistake
Journey: Server is client, and Service Manager is server-side.
Obtain service (get Service):, must be first to Service before Client process uses some Service
Corresponding Service is obtained in Manager.The process: Client is client, and Service Manager is server-side.
Use service: Client is established and the Server process communication where Service according to obtained Service information
Access, then can directly be interacted with Service.The process: client is client, and server is server-side.
It should be understood that Client in Fig. 3, interaction is all that dotted line indicates between Server, Service Manager,
It is since they are not directly interactive each other, all by interacting with Binder driver, thus real
Existing IPC communication mode.Wherein Binder driver is located at kernel spacing, Client, Server, Service Manager
In user's space.Binder driving and Service Manager can regard the architecture of Android platform as, and Client and
Server is the application layer of Android, and developer only needs the customized end realization client, Server, by the basic of Android
Platform architecture can directly carry out IPC communication.
In an electronic, multiple applications may obtain same service simultaneously, so, a server-side may be with multiple visitors
Interprocess communication is carried out between the end of family, in this case, since the number of communications of server-side is more, thread usage amount is larger, logical
Letter is excessively frequent, will cause the Caton of system, and the present embodiment, which mainly passes through, to be obtained between a client and a server-side
Accumulative number of communications and obtain the server-side and multiple client (it includes above-mentioned client and others client)
Add up total number of communications, then calculates accumulative number of communications and the ratio for adding up total number of communications, this is measured by the ratio
Influence caused by busy extent of the client to server-side, to limit the client.
Optionally, in the present embodiment, which can be server of the system.
It optionally, can be by the way of accumulative, specifically when obtaining the number of communications between client and server-side
Ground, as shown in figure 4, Fig. 4 is the interaction schematic diagram of client and server-side, it is main in the communication process of client and server-side
It to include three processes, client initiates communication request, the communication request that server-side customer in response end is initiated, client to server-side
Data interaction is carried out between end and server-side.Optionally, which can request for above-mentioned Binder.
Wherein, by above-mentioned process, just at last therefore a traffic carried process can pass through above three node
In any one add up number of communications.
It is alternatively possible to when sending binder request to server-side whenever client, by the numerical value of accumulative number of communications
Add one, and when receiving binder request whenever server-side, the numerical value for adding up total number of communications is added one.
Optionally, step 101 can be with specifically: when client initiates communication request to server-side, by accumulative communication time
Several numerical value add one.
Optionally, step 101 can be with specifically:, will be accumulative logical when the communication request initiated at server-side customer in response end
The numerical value of letter number adds one.
Optionally, step 101 can be with specifically:, will be accumulative logical when the interprocess communication of client and server-side is completed
The numerical value of letter number adds one.
In a specific embodiment, server-side may be because that the reasons such as busy do not respond to the communication request of client,
Also or client can not completed to communicate due to collapse etc. with server-side, in this embodiment it is possible in visitor
When the interprocess communication of family end and server-side is completed, then the numerical value of accumulative number of communications is added one.It in this way can also be to avoid accidentally tired
Meter leads to the number of communications counted, and there are deviations.
It should be understood that being sent in client to server-side due to recording accumulative number of communications and adding up total number of communications
When binder is requested, obtains the numerical value of accumulative number of communications at this time and add up the numerical value of total number of communications at this time, then carry out
Subsequent calculating and judgement.
When client sends binder request to server-side, binder request is intercepted and captured, intercepting and capturing refer to interception and obtain, visitor
The binder request that family end is sent will not temporarily reach server-side, first preserve, and by subsequent calculating and judge later certainly
It is fixed whether to request the binder of intercepting and capturing to be sent to server-side.
Step 102: calculating accumulative number of communications and add up the ratio of total number of communications, and judge whether ratio is greater than setting
Ratio.
Wherein, setting ratio can be what the related data that basis recorded in the past was configured.For example, blocking in system
Immediately (for example, when CPU usage is higher, memory usage is higher, system total load is larger), current accumulative communication time is recorded
Number and the ratio for adding up total number of communications obtain the average value of the ratio recorded in a period of time and are protected as setting ratio
It deposits.
Optionally, ratio is presented with the formation of percentage.
If the judging result of step 102 be it is yes, then follow the steps 103.
If the judging result of step 102 be it is no, then follow the steps 104.
Step 103: binder being requested waiting list end is added;Wherein, waiting list is post-processed in set period of time
In binder request.
In step 103, the binder intercepted and captured in step 101 is requested that waiting list end is added.
Wherein, step 103 is specifically as follows: the binder request in waiting list being sent to clothes after set period of time
Business end, to allow server-side to carry out response to the binder request in waiting list and carry out interprocess communication with client.
Wait the binder request in (pending) queue that can't be responded immediately by server-side, but in setting time
The binder request in waiting list is sent to server-side again after section, is equivalent to the mechanism for establishing a buffering, meeting exists
Allow server-side to request to respond to binder after set period of time or when server-side is not busy, and is serviced
Interprocess communication between end and client.
Alternatively, in another embodiment, step 103 is specifically as follows: by waiting list after set period of time
In binder request send binder request to server-side as client, return step 101 is returned in client to clothes
Be engaged in end send binder request when, intercept and capture binder request and obtain active client and server-side accumulative number of communications, when
The step of accumulative total number of communications of preceding server-side, reacquires simultaneously ratio calculated, then judges ratio and sets the big of ratio
Small relationship decides whether to respond binder request or be retained in waiting list according to judging result.
It is illustrated below by a specific example, is illustrated in the example according to chronological order:
1, the first process of application program A (client) and system service (server-side) carry out binder communication, at this time should
Client adds up number of communications 1 time, if the server-side adds up total number of communications 20 times, ratio 5%.
2, the second process of application program A and system service carry out binder communication, at this time the accumulative communication time of the client
Number 2 times, if it is 20 times that the server-side, which adds up total number of communications, ratio 10%;
3, the second process of application program A and system service carry out binder communication, at this time the accumulative communication time of the client
Number 3 times, if it is 25 times that the server-side, which adds up total number of communications, ratio 12%;
4, the third process of application program A and system service carry out binder communication, at this time the accumulative communication time of the client
Number 4 times, if it is 26 times that the server-side, which adds up total number of communications, ratio 15.3%;
5, the first process of application program A and system service carry out binder communication, at this time the accumulative communication time of the client
Number 5 times, if it is 27 times that the server-side, which adds up total number of communications, ratio 18.5%.
In the above example, if the ratio of setting is 17%, the binder that client the 5th time is sent requests to be added
Waiting list.
It should be understood that client and server-side in above-described embodiment can be with self-definings, therefore aforesaid way
It can be adapted for any application or service, its number of communications be monitored.
In the present embodiment, it accumulative is always communicated time by obtain and calculate the accumulative number of communications of client and server-side
Whether several ratio can lead to system Caton or collapse since server-side is excessively busy to measure, and the ratio is limited in and is set
Ratio is determined to guarantee the smooth operation of system;Measured by the ratio server-side it is busy compared to simple according to client
The accumulative number of communications at end is more objective and accurate to measure, and can more reflect the busy extent of server-side.
Step 104: the binder request of intercepting and capturing being sent to server-side, to allow server-side customer in response end to send
Binder request simultaneously carries out interprocess communication with client.
If the ratio that the number of communications of client accounts for the total number of communications of server-side is less than setting ratio, illustrating will not
The busy extent of server-side is influenced, server-side customer in response end sends binder request, carries out between client and server-side
Normal communication.
Referring to Fig. 5, Fig. 5 is the flow diagram of the method communicated between the application second embodiment limiting process.
In the present embodiment, the method communicated between limiting process may comprise steps of:
Step 501:, will be accumulative logical when client, which sends binder to server-side, requests in current time period
The numerical value of letter number adds one, and when receiving binder request whenever server-side, the numerical value for adding up total number of communications is added one.
In the present embodiment, multiple time cycles will be divided into the time, add up the logical of client within each time cycle
Believe the total degree of number and the communication of accumulative server-side.Accumulative number is zeroed out at the end of the time cycle, and
The next time cycle counts again.
When client, which sends binder to server-side, requests, illustrates that client communicates once with server-side, will add up
Number of communications adds one.
When server-side receives binder request, illustrates that server-side communication is primary, total number of communications will be added up and add one.Value
It is to be noted that server-side receive binder request can be it is from above-mentioned client or other clients, tire out
Meter is the total number of communications of server-side.
Step 502: in current time period, when client sends binder request to server-side, intercepting and capturing the binder
Request, and obtain the numerical value of accumulative number of communications and add up the numerical value of total number of communications.
The timing node that binder is requested is sent to server-side in current time period, and in client, is obtained current
Accumulative number of communications numerical value and add up the numerical value of total number of communications.When client sends binder request to server-side,
Intercept and capture binder request.The description as described in intercepting and capturing binder request specifically may refer to description above, and details are not described herein again.
Step 503: calculating accumulative number of communications and add up the ratio of total number of communications, and judge whether ratio is greater than setting
Ratio.
If the judging result of step 503 be it is yes, then follow the steps 504.
If the judging result of step 503 be it is no, then follow the steps 505.
Step 504: binder being requested waiting list end is added;Wherein, waiting list is post-processed in set period of time
In binder request.
Step 505: the binder request of intercepting and capturing being sent to server-side, to allow server-side customer in response end to send
Binder request simultaneously carries out interprocess communication with client.
Wherein step 503-505 is similar with the explanation in first embodiment, no longer superfluous herein referring specifically to description above
It states.
As shown in fig. 6, Fig. 6 be client, server-side, waiting list interaction schematic diagram.
Within the n-th time cycle, client with server-side is every is once communicated, accumulative number of communications is just added one.
When client sends communication request 1 to server-side, the accumulative number of communications of client is 1, and server-side adds up
Total number of communications is 5, ratio 20%.
When client sends communication request 2 to server-side, the accumulative number of communications of client is 2, and server-side adds up
Total number of communications is 6, ratio 33.3%.
When client sends communication request 3 to server-side, the accumulative number of communications of client is 3, and server-side adds up
Total number of communications is 15, ratio 20%.
When client sends communication request 4 to server-side, the accumulative number of communications of client is 4, and server-side adds up
Total number of communications is 20, ratio 20%.
When client sends communication request 5 to server-side, the accumulative number of communications of client is the accumulative of 5. server-sides
Total number of communications is 25, and ratio remains as 20%.
When client sends communication request 6 to server-side, the accumulative number of communications of client is the accumulative total of 6 server-sides
Number of communications is 26, and ratio remains as 20%
When client sends communication request 7 to server-side, the accumulative logical number of client is 7, server-side it is accumulative in
Number of communications is 27, ratio 25.9%.
If setting ratio as 25%, then communication request 2 and communication request 7 can be added and wait team within the n-th period
Column.Server-side can respond communication request 1, communication request 3-6, so that server-side and client are communicated.
In n-th end cycle, accumulative number of communications and accumulative communication total degree are reset.
Binder request when the N+1 time cycle starts, in server-side priority processing waiting list.
Optionally, when next period starts, it is used as client to service the binder request of head end in waiting list
The binder request that end is sent, return step 502.
As shown in fig. 7, Fig. 7 is the flow diagram of the method communicated between the application 3rd embodiment limiting process.
In the present embodiment, the method communicated between limiting process may comprise steps of:
Step 701: when client sends binder request to server-side, intercepting and capturing the binder and request and obtain current visitor
The accumulative number of communications of family end and server-side, accumulative total number of communications at current service end.
Step 702: judging whether server-side meets preset condition.
If judging result is yes in a step 702, i.e., server-side meets preset condition, thens follow the steps 703.
If judging result is no in a step 702, i.e., server-side is unsatisfactory for preset condition, thens follow the steps 705.
Optionally, preset condition includes that the quantity of the available thread of server-side is less than the weight of setting number of threads, server-side
Rank is wanted to be greater than at least one of pre-set level.
It should be understood that the communication between two processes generally will use multiple threads.For example, android system is advised
32 Binder threads can be created for inter-process data communication by determining System Server process at most;Surface
Flinger process can at most create 4 Binder threads and communicate for inter-process data;Program application process can at most be created
8 Binder threads are built to communicate for inter-process data.
Therefore, subsequent calculating and judgement can be carried out again when the thread usage quantity of server-side is met the requirements,
For example, a server-side shares 32 threads, wherein 16 threads are used, available thread is 16 remaining, i.e., when being used line
Journey starts to judge whether number of communications is greater than given threshold when being greater than half.
Each process has corresponding priority, and priority determines when it runs and receive how many CPU time, server-side
It is no exception as a kind of process.
For example, totally 32 grades of priority, it is the numerical value from 0 to 31, referred to as base priority not (Base Priority
Level).For system according to the operation of different priority scheduling processes, 0-15 grades are normal priorities, and the priority of process can be with
Dynamic change, high priority process are preferentially run, when only high priority process is not run, ability schedules low priority process fortune
Row, the identical process of priority are run in turn according to timeslice.16-31 grades are real-time priorities, real-time priority with it is common excellent
The maximum of first grade distinguishes the operation for being equal priority process not according to round-robin, but the process first run is just first controlled
CPU processed, if it does not abandon actively controlling, at the same level or low priority process is just unable to run.
The severity level of server-side can refer to its priority level in systems, in other embodiments, server-side
Severity level is also possible to preset severity level.
Since more important server-side is often bigger on the influence of the fluency of system, it is greater than in the severity level of server-side and sets
When defining the level other, subsequent calculating and judgement are just carried out, client on the one hand can be effectively limited and important server-side carries out
Communication, carry out the fluency of lifting system, on the other hand, without all server-sides are all monitored can reduce it is unnecessary
Process.
Step 703: calculating accumulative number of communications and add up the ratio of total number of communications, and judge whether ratio is greater than setting
Ratio.
If judging result is yes in step 703,704 are thened follow the steps.
If judging result is no in step 704,705 are thened follow the steps.
Step 704: binder being requested waiting list end is added;Wherein, waiting list is post-processed in set period of time
In binder request.
Step 705: the binder request of intercepting and capturing being sent to server-side, to allow server-side customer in response end to send
Binder request simultaneously carries out interprocess communication with client.
The explanation of step 703-705 specifically may refer to description above, and details are not described herein again.
As shown in figure 8, Fig. 8 is the flow diagram of the method communicated between the application fourth embodiment limiting process.
In the present embodiment, the method communicated between limiting process may comprise steps of:
Step 801: when client sends binder request to server-side, intercepting and capturing the binder and request and obtain current visitor
The accumulative number of communications of family end and server-side, accumulative total number of communications at current service end.
Step 802: judging whether the service condition of current system meets predetermined condition.
If judging result is yes in step 802, i.e. the service condition of current system meets predetermined condition, thens follow the steps
803。
If judging result is no in step 802, i.e. the service condition of current system does not meet predetermined condition, then executes step
Rapid 805.
Predetermined condition can be the busy situation of operating status of current system, and optionally, predetermined condition may include: to work as
The process number that preceding system is currently running be greater than the Thread Count that setting process number, current system are currently running be greater than setting Thread Count,
Current system total load is greater than at least one of setting load.It can be understood that predetermined condition can also include other can be with
The larger situation of the currently running busy extent of reflection system, for example, the CPU usage of current system is greater than the set value, currently
The memory usage of system is greater than the set value etc..
By the above-mentioned means, subsequent calculating and judgement, a side can just be carried out only when current system operation is busier
Face can effectively limit the ratio of client Yu server-side number of communications when system is busy, carry out the fluency of lifting system,
On the other hand, it can be not limited in the systematic comparison free time, reduce unnecessary process.
Step 803: calculating accumulative number of communications and add up the ratio of total number of communications, and judge whether ratio is greater than setting
Ratio.
If judging result is yes in step 803,804 are thened follow the steps.
If judging result is no in step 804,805 are thened follow the steps.
Step 804: binder being requested waiting list end is added;Wherein, waiting list is post-processed in set period of time
In binder request.
Step 805: the binder request of intercepting and capturing being sent to server-side, to allow server-side customer in response end to send
Binder request simultaneously carries out interprocess communication with client.
The explanation of step 803-805 specifically may refer to description above, and details are not described herein again.
Optionally, on the basis of above-mentioned any one embodiment, increase the stream for monitoring and recording the timing node of communication
Journey, specifically, following steps can be further increased:
When client initiates communication request to server-side, first time point is recorded.
At server-side customer in response end when the communication request of initiation, recorded for the second time point.
According to first time point and the second time point, service latency is obtained.
Here service latency is the period between first time point and the second time point.
Service latency is saved, to provide based on service latency the optimization of subsequent operating system and verifying
Data are supported.
When the interprocess communication of client and server-side is completed, third time point is recorded.
According to first time point and third time point, interprocess communication total time is obtained.
Here interprocess communication total time is the period between first time point and third time point.
The interprocess communication total time obtained is saved, the optimization and verifying to subsequent operating system provide data and supports.
Its duration that communication is got in terms of three different, including service waiting time, communication service duration
And total duration.
Wherein, the average value or total duration of specific available each duration.It is as shown in the table:
For example, the average value of service waiting time is exactly the average value of a1, b1 and c1;The average value of communication service duration is just
It is the average value of a2, b2 and c2;Interprocess communication total duration is exactly the average value of a3, b3 and c3.
Optionally, above-mentioned data can also be counted using other statistical statistical methods, such as variance.
In addition, to above-mentioned number of communications, service waiting time, communication service duration and interprocess communication total duration into
It, can be raw according to number of communications, service waiting time, communication service duration and interprocess communication total duration when row statistics and monitoring
At histogram.
Above-mentioned number of communications, service waiting time, communication service duration, interprocess communication total duration and histogram can
To further upload to server, in order to which developer optimizes and verifies to operating system based on these data.
Referring to Fig. 9, Fig. 9 is the module diagram of the embodiment of the present application electronic device.
In the present embodiment, electronic device 90 may include with lower module:
Module 91 is obtained, for the binder being intercepted and captured and requesting and obtain when client sends binder request to server-side
Take the accumulative number of communications of active client and server-side, accumulative total number of communications at current service end.
Computing module 92, the ratio for calculating accumulative number of communications He adding up total number of communications.
Judgment module 93, for judging whether ratio is greater than setting ratio.
Execution module 94, for binder being requested waiting list end is added when ratio is greater than setting ratio;Its
In, the binder request in set period of time post-processing waiting list.
The particular content for the step of above-mentioned modules execute may refer to description above, and details are not described herein again.
Referring to Fig. 10, Figure 10 is the hardware structural diagram of the embodiment of the present application electronic device.
In the present embodiment, electronic device 10 includes processor 11 and memory 12.
Memory 12 is electrically connected with processor 11.
Memory 12 is realized above-mentioned any for storing computer program, processor 11 for executing the computer program
The method of one embodiment.
The embodiment of the present invention also provides a kind of computer-readable storage medium, which is used for
Computer program is stored, which can be executed by processor to realize the method provided in above-described embodiment.It can be with
Understand, the computer program of readable storage medium storing program for executing storage in the present embodiment is used to be performed method and above-mentioned implementation
The method that example provides is similar, and principle is identical with step, and which is not described herein again.
Wherein, the storage medium can for USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), with
Machine accesses various Jie that can store program code such as memory (RAM, Random Access Memory), magnetic or disk
Matter.
Electronic device in the above-mentioned any one implementation of the present invention can be smart phone, wearable smart machine, plate
Computer, palm PC, number PDA or other electronic devices.
The embodiment of the present application is by obtaining active client and service when client sends binder request to server-side
Accumulative number of communications, accumulative total number of communications at current service end at end;It calculates accumulative number of communications and adds up total number of communications
Ratio, and judge whether ratio is greater than setting ratio;If so, binder is requested waiting list end is added;Wherein, it takes
Business end responds the binder request in waiting list after set period of time, can communicate client with server-side secondary
Several ratios with the total number of communications of server-side are limited to setting ratio, thereby may be ensured that the fluency of system.
The foregoing is merely presently filed embodiments, are not intended to limit the scope of the patents of the application, all to utilize this
Equivalent structure or equivalent flow shift made by application specification and accompanying drawing content, it is relevant to be applied directly or indirectly in other
Technical field similarly includes in the scope of patent protection of the application.
Claims (13)
1. a kind of method communicated between limiting process, which is characterized in that the described method includes:
Client to server-side send binder request when, intercept and capture the binder request and obtain presently described client and
Accumulative number of communications, the accumulative total number of communications of presently described server-side of the server-side;
The accumulative number of communications and the ratio for adding up total number of communications are calculated, and judges whether the ratio is greater than setting
Ratio;
If so, the binder is requested waiting list end is added;Wherein, in the post-processing of the set period of time waiting
Binder request in queue.
2. the method according to claim 1, wherein the post-processing in the set period of time waiting list
In binder request the step of, comprising:
The binder request in the waiting list is sent to the server-side after set period of time, to allow the service
It holds and response is carried out to the binder request in the waiting list and carries out interprocess communication with the client.
3. the method according to claim 1, wherein the post-processing in the set period of time waiting list
In binder request the step of, comprising:
The binder request in the waiting list is sent into binder to server-side as client after set period of time
Request, return is described when client sends binder request to server-side, intercepts and captures the binder and requests and obtain current institute
The step of stating accumulative number of communications, the accumulative total number of communications of presently described server-side of client and the server-side.
4. the method according to claim 1, wherein described send binder request to server-side in client
When, it intercepts and captures the binder and requests and obtain the accumulative number of communications of presently described client and the server-side, presently described
Before the step of accumulative number of communications of server-side, comprising:
In current time period, when the client, which sends binder to the server-side, requests, by accumulative communication time
Several numerical value adds one, and when receiving binder request whenever the server-side, the numerical value for adding up total number of communications is added one;
It is described client to server-side send binder request when, intercept and capture the binder and request and obtain presently described client
The step of end and accumulative number of communications, the accumulative total number of communications of presently described server-side of the server-side, comprising:
In current time period, and when the client sends binder request to the server-side, described in intercepting and capturing
Binder is requested and is obtained the numerical value and the numerical value for adding up total number of communications of the accumulative number of communications.
5. according to the method described in claim 4, it is characterized in that, the method further includes:
At the end of current time period, by the accumulative number of communications and described add up total number of communications and reset;
When subsequent time period starts, by the binder request of head end in the waiting list as the client to described
The binder request that server-side is sent, return is described to be sent out in current time period, and in the client to the server-side
When binder being sent to request, intercept and capture the binder request and obtain the accumulative number of communications numerical value and the accumulative total communication
The step of numerical value of number.
6. the method according to claim 1, wherein
In the calculating accumulative number of communications and the ratio for adding up total number of communications, and judge whether the ratio is big
After the step of setting ratio, the method also includes:
If it is not, the binder request of intercepting and capturing is then sent to the server-side, to allow the server-side to respond the visitor
The binder that family end is sent is requested and is carried out interprocess communication with the client.
7. the method according to claim 1, wherein
It is described judge the ratio whether be greater than setting ratio the step of before, further includes:
Judge whether the server-side meets preset condition;
If the server-side meets the preset condition, the step for judging the ratio and whether being greater than setting ratio is executed
Suddenly;
If the server-side is unsatisfactory for the preset condition, the binder request of intercepting and capturing is sent to the server-side,
To allow the server-side to respond the binder request of the client transmission and carry out interprocess communication with the client.
8. the method according to the description of claim 7 is characterized in that the preset condition includes the available thread of the server-side
Quantity be less than setting number of threads, the severity level of the server-side is greater than at least one of pre-set level.
9. the method according to claim 1, wherein
It is described judge the ratio whether be greater than setting ratio the step of before, further includes:
Judge whether the service condition of current system meets predetermined condition;
If the service condition of current system meets predetermined condition, executes and described judge whether the ratio is greater than setting ratio
Step;
If the service condition of current system does not meet predetermined condition, the binder request of intercepting and capturing is sent to the service
End, to allow the server-side to respond the binder request of the client transmission and lead between the client carry out process
Letter.
10. according to the method described in claim 9, it is characterized in that, the predetermined condition includes: what current system was currently running
It is big that the Thread Count that process number is greater than setting process number, current system is currently running is greater than setting Thread Count, current system total load
In at least one of setting load.
11. a kind of electronic device, which is characterized in that the electronic device includes:
Module is obtained, for the binder being intercepted and captured and requesting and obtain to work as when client sends binder request to server-side
Accumulative number of communications, the accumulative total number of communications of presently described server-side of the preceding client and the server-side;
Computing module, for calculating the accumulative number of communications and the ratio for adding up total number of communications;
Judgment module, for judging whether the ratio is greater than setting ratio;
Waiting list end is added for when the ratio is greater than the setting ratio, the binder to be requested in execution module
End;Wherein, the binder request in the post-processing of the set period of time waiting list.
12. a kind of electronic device, which is characterized in that the electronic device includes processor and memory, the memory and institute
Processor electrical connection is stated, the memory is for storing computer program, and the processor is for calling the computer program
To realize method described in claim 1-10 any one.
13. a kind of storage medium, which is characterized in that the storage medium is stored with computer program, which can
It is performed to realize method described in claim 1-10 any one.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810700051.3A CN109062706B (en) | 2018-06-29 | 2018-06-29 | Electronic device, method for limiting inter-process communication thereof and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810700051.3A CN109062706B (en) | 2018-06-29 | 2018-06-29 | Electronic device, method for limiting inter-process communication thereof and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109062706A true CN109062706A (en) | 2018-12-21 |
CN109062706B CN109062706B (en) | 2021-03-05 |
Family
ID=64818611
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810700051.3A Active CN109062706B (en) | 2018-06-29 | 2018-06-29 | Electronic device, method for limiting inter-process communication thereof and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109062706B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023240506A1 (en) * | 2022-06-15 | 2023-12-21 | 北京小米移动软件有限公司 | Request processing method and apparatus, server, and storage medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02109154A (en) * | 1988-10-18 | 1990-04-20 | Nippon Telegr & Teleph Corp <Ntt> | Job control method |
CN103685336A (en) * | 2012-08-31 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Overload protection method, device and server |
CN104219316A (en) * | 2014-09-12 | 2014-12-17 | 微梦创科网络科技(中国)有限公司 | Method and device for processing call request in distributed system |
CN105335231A (en) * | 2014-08-15 | 2016-02-17 | 阿里巴巴集团控股有限公司 | Dynamic distribution method and device for server threads |
CN106210031A (en) * | 2016-07-06 | 2016-12-07 | 北京金山安全软件有限公司 | Service execution method, device, client and server |
CN107861817A (en) * | 2017-11-30 | 2018-03-30 | 努比亚技术有限公司 | Memory Optimize Method, mobile terminal and readable storage medium storing program for executing based on thread block |
CN108052390A (en) * | 2017-11-30 | 2018-05-18 | 努比亚技术有限公司 | Memory method for cleaning, mobile terminal and readable storage medium storing program for executing based on thread block |
-
2018
- 2018-06-29 CN CN201810700051.3A patent/CN109062706B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH02109154A (en) * | 1988-10-18 | 1990-04-20 | Nippon Telegr & Teleph Corp <Ntt> | Job control method |
CN103685336A (en) * | 2012-08-31 | 2014-03-26 | 腾讯科技(深圳)有限公司 | Overload protection method, device and server |
CN105335231A (en) * | 2014-08-15 | 2016-02-17 | 阿里巴巴集团控股有限公司 | Dynamic distribution method and device for server threads |
CN104219316A (en) * | 2014-09-12 | 2014-12-17 | 微梦创科网络科技(中国)有限公司 | Method and device for processing call request in distributed system |
CN106210031A (en) * | 2016-07-06 | 2016-12-07 | 北京金山安全软件有限公司 | Service execution method, device, client and server |
CN107861817A (en) * | 2017-11-30 | 2018-03-30 | 努比亚技术有限公司 | Memory Optimize Method, mobile terminal and readable storage medium storing program for executing based on thread block |
CN108052390A (en) * | 2017-11-30 | 2018-05-18 | 努比亚技术有限公司 | Memory method for cleaning, mobile terminal and readable storage medium storing program for executing based on thread block |
Non-Patent Citations (2)
Title |
---|
GITYUAN: "Binder系列10—总结", 《WEB.ARCHIVE.ORG/WEB/20160412211557/HTTP://GITYUAN.COM/2015/11/28/BINDER-SUMMARY/》 * |
山庄来客: "Android通信过程中的线程池管理", 《BLOG.IFJY.ME/ANDROID/2016/07/16/ANDROID通信过程中的线程池管理.HTML》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2023240506A1 (en) * | 2022-06-15 | 2023-12-21 | 北京小米移动软件有限公司 | Request processing method and apparatus, server, and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109062706B (en) | 2021-03-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11593152B1 (en) | Application hosting in a distributed application execution system | |
CN112162865B (en) | Scheduling method and device of server and server | |
CN110276182B (en) | API distributed current limiting realization method | |
US9390130B2 (en) | Workload management in a parallel database system | |
CN109117280A (en) | The method that is communicated between electronic device and its limiting process, storage medium | |
US11411798B2 (en) | Distributed scheduler | |
US20130152097A1 (en) | Resource Health Based Scheduling of Workload Tasks | |
CN109144700B (en) | Method and device for determining timeout duration, server and data processing method | |
CN109117279A (en) | The method that is communicated between electronic device and its limiting process, storage medium | |
CN105159782A (en) | Cloud host based method and apparatus for allocating resources to orders | |
WO2017067586A1 (en) | Method and system for code offloading in mobile computing | |
CN111078436B (en) | Data processing method, device, equipment and storage medium | |
CN109002364A (en) | Optimization method, electronic device and the readable storage medium storing program for executing of interprocess communication | |
CN106533961B (en) | Flow control method and device | |
CN115640113A (en) | Multi-plane flexible scheduling method | |
CN109062706A (en) | The method that is communicated between electronic device and its limiting process, storage medium | |
CN113595926A (en) | API data transmission method, device, equipment and medium based on data middlebox | |
CN108924128A (en) | A kind of mobile terminal and its method for limiting, the storage medium of interprocess communication | |
CN109062707A (en) | The method that is communicated between electronic device and its limiting process, storage medium | |
CN109670932B (en) | Credit data accounting method, apparatus, system and computer storage medium | |
CN115766582A (en) | Flow control method, device and system, medium and computer equipment | |
US10979359B1 (en) | Polling resource management system | |
CN111782364A (en) | Service calling method and device, electronic equipment and storage medium | |
US9043799B1 (en) | Managing access to a shared resource by tracking active requestor job requests | |
EP2115619B1 (en) | Communication socket state monitoring device and methods thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |