CN108062224A - Data read-write method, device and computing device based on file handle - Google Patents
Data read-write method, device and computing device based on file handle Download PDFInfo
- Publication number
- CN108062224A CN108062224A CN201711486057.7A CN201711486057A CN108062224A CN 108062224 A CN108062224 A CN 108062224A CN 201711486057 A CN201711486057 A CN 201711486057A CN 108062224 A CN108062224 A CN 108062224A
- Authority
- CN
- China
- Prior art keywords
- file handle
- write
- event
- write operation
- handle
- 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
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
- G06F8/44—Encoding
- G06F8/443—Optimisation
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a kind of data read-write method based on file handle, device, computing device and computer storage medias.Wherein, the described method includes:The associated buffering area of monitoring file handle, to determine whether the file handle has readable event;It if the file handle has readable event, reads the corresponding data of the file handle and is handled accordingly, and write operation is performed to the file handle;Corresponding monitoring processing is carried out according to write operation implementing result, without exiting whether monitoring file handle writeable, so as to reduce one cycle and once monitor whether writeable operation, the performance of network programming frame is optimized.
Description
Technical field
The present invention relates to technical field of data processing, and in particular to a kind of data read-write method based on file handle, dress
It puts, computing device and computer storage media.
Background technology
File handle is system resource very valuable in operating system, for unique mark file, according to file handle
Corresponding file can be opened, in the prior art, for a file handle, can first monitor whether this file handle have can
If reading event with readable event, reads the corresponding content of file handle, after corresponding content has been read, just sets
The writeable event for monitoring this file handle is put, wait cycles next time, judges whether this file handle is writeable, if can
It writes and content is write buffering area, then monitor readable event again, and under normal circumstances, the associated buffering area of file handle is not
Writeable probability is very low, and whether monitoring file handle has writeable event before write-in every time, and it is unnecessary to not only increase
Cycling and snoop-operations, also affect the performance of network programming frame.
The content of the invention
In view of the above problems, it is proposed that the present invention overcomes the above problem in order to provide one kind or solves at least partly
State the data read-write method based on file handle, device, computing device and the computer storage media of problem.
According to an aspect of the invention, there is provided a kind of data read-write method based on file handle, including:
The associated buffering area of monitoring file handle, to determine whether the file handle has readable event;
If the file handle has readable event, read the corresponding data of the file handle and located accordingly
Reason, and write operation is performed to the file handle;
Corresponding monitoring processing is carried out according to write operation implementing result.
According to another aspect of the present invention, a kind of data read-write equipment based on file handle is provided, including:
Module is monitored, is adapted for listening for the associated buffering area of file handle, to determine it is readable whether the file handle has
Event;
Processing module if having readable event suitable for the file handle, reads the corresponding data of the file handle
And handled accordingly, and write operation is performed to the file handle;
Module is monitored to be further adapted for:Corresponding monitoring processing is carried out according to write operation implementing result.
According to another aspect of the invention, a kind of computing device is provided, including:Processor, memory, communication interface and
Communication bus, the processor, the memory and the communication interface complete mutual communication by the communication bus;
For the memory for storing an at least executable instruction, it is above-mentioned that the executable instruction performs the processor
The corresponding operation of data read-write method based on file handle.
In accordance with a further aspect of the present invention, provide a kind of computer storage media, be stored in the storage medium to
A few executable instruction, the executable instruction make processor perform such as the above-mentioned data read-write method correspondence based on file handle
Operation.
The scheme provided according to the present invention, the associated buffering area of monitoring file handle, whether to determine the file handle
With readable event;If the file handle has readable event, read the corresponding data of the file handle and carry out phase
The processing answered, and write operation is performed to the file handle;Corresponding monitoring processing is carried out according to write operation implementing result, without
Exit whether monitoring file handle writeable, so as to reduce one cycle and once monitor whether writeable operation, to network
The performance of programming framework is optimized.
Above description is only the general introduction of technical solution of the present invention, in order to better understand the technological means of the present invention,
And can be practiced according to the content of specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, below the special specific embodiment for lifting the present invention.
Description of the drawings
By reading the detailed description of hereafter preferred embodiment, it is various other the advantages of and benefit it is common for this field
Technical staff will be apparent understanding.Attached drawing is only used for showing the purpose of preferred embodiment, and is not considered as to the present invention
Limitation.And throughout the drawings, the same reference numbers will be used to refer to the same parts.In the accompanying drawings:
Fig. 1 shows the flow signal of the data read-write method according to an embodiment of the invention based on file handle
Figure;
Fig. 2 shows the flow signal of the data read-write method in accordance with another embodiment of the present invention based on file handle
Figure;
Fig. 3 shows the structural representation of the data read-write equipment according to an embodiment of the invention based on file handle
Figure;
Fig. 4 shows a kind of structure diagram of computing device according to an embodiment of the invention.
Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although the disclosure is shown in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Completely it is communicated to those skilled in the art.
Fig. 1 shows the flow signal of the data read-write method according to an embodiment of the invention based on file handle
Figure.As shown in Figure 1, this method comprises the following steps:
Step S100, the associated buffering area of monitoring file handle, to determine whether the file handle has readable event.
Big well known network service architectures are C/S frameworks (Client/Server frameworks, i.e. client/server frame
Structure), it is actively to initiate to ask to server from client, request server returns data to client, and takes under normal circumstances
Device be engaged in the case where not receiving request, it will not be actively to client push data.
If a client is connected to server, file handle can be carried in the request that user end to server is sent,
Server receives the function (accept functions) of client request that can obtain the corresponding file sentence of this client by calling
Handle, wherein, file handle is used for tab file, and corresponding file can be accessed according to file handle, therefore, need exist for supervising
Whether have readable event, asked with determining whether client sends to server, specifically, associated by monitoring file handle if listening
Buffering area come determine file handle whether have readable event.
Step S101 if the file handle has readable event, reads the corresponding data of the file handle and goes forward side by side
The corresponding processing of row, and write operation is performed to the file handle.
If file handle has readable event, the data in the corresponding file of this document handle can be read, are being read
, it is necessary to be handled accordingly data after to data, for example, parsing data are assorted with the definite requested content of client
, after corresponding processing is performed, write operation is directly performed to file handle, which is that server does request
Response, i.e., to client returned data.
Step S102 carries out corresponding monitoring processing according to write operation implementing result.
Although in step S101, write operation is performed to file handle, write operation implementing result may be write-in
Success or write-in failure, different write operation implementing results determine the monitoring processing scheme after write operation execution.
The method that above-described embodiment provides according to the present invention, the associated buffering area of monitoring file handle, to determine the text
Whether part handle has readable event;If the file handle has readable event, the corresponding number of the file handle is read
According to and handled accordingly, and to the file handle perform write operation;It is supervised accordingly according to write operation implementing result
Processing is listened, it is whether writeable without exiting monitoring file handle, it is whether writeable so as to reduce one cycle and once monitor
Operation, is optimized the performance of network programming frame.
Fig. 2 shows the flow signal of the data read-write method in accordance with another embodiment of the present invention based on file handle
Figure.As shown in Fig. 2, this method comprises the following steps:
Step S200, whether the monitoring associated buffering area of file handle is stored with data, if so, performing step S201.
In embodiments of the present invention, each file handle corresponds to a buffering area, and the associated buffering area non-empty of file handle is
When there are data, illustrate that buffering area there are data that can read, readable event, i.e. EPOLLIN events will be triggered at this time, therefore, lead to
Cross whether the associated buffering area of monitoring file handle is stored with data, you can determine whether file handle has readable event, if
The associated buffering area of file handle is stored with data, then supporting paper handle has readable event;If file handle is associated slow
It rushes area and is not stored with data, then explanation does not have readable event.
Step S201 determines that file handle has readable event, reads the corresponding data of the file handle and carry out phase
The processing answered, and write operation is performed to the file handle.
If listening to the associated buffering area of file handle is stored with data, shows there are data that can read, may be employed
Horizontal triggering mode, sends readable signal, it is possible thereby to determine that file handle has readable event, in this way, can be from buffering area
The data in the corresponding file of this document handle are read, it is necessary to be handled accordingly data, example after data are read
Such as, data are parsed to determine that the requested content of client is.
After reading the corresponding data of the file handle and handle accordingly, existing method is to continue with monitoring text
Whether part handle has writeable event, wait is recycled to next next time when, judges whether file handle has writeable event, if tool
There is writeable event, then write data into buffering area, then whether monitoring file handle has readable event again, specifically,
It can be realized by following code:
Under normal circumstances, the not writeable probability of the associated buffering area of file handle is very low, is monitored before write-in every time
Whether file handle has writeable event, not only increases unnecessary cycling and snoop-operations, also affects network programming frame
The performance of frame.
Based on the above problem, the embodiment of the present invention is reading the corresponding data of the file handle and is being handled accordingly
Afterwards, write operation is directly performed to file handle, which is the server response done to request, although directly to file
Handle performs write operation, but implementing result may be write-in failure or write successfully, according to different write operation implementing results,
Different method for processing interception will be performed.
Step S202, if write operation implementing result shows write-in failure, the associated buffering area of monitoring file handle, with true
Determine whether file handle has writeable event.
If write operation implementing result shows write-in failure, it is currently to be fully written state to illustrate buffering area, without idle empty
Between it is available for writing, at this time just need wait cycle next time, can by the associated buffering area of monitoring file handle come determine text
Whether part handle has writeable event, and specifically, whether the state that can monitor the associated buffering area of file handle is to write full shape
State, if the state of buffering area is not to write full state, illustrates that buffering area is discontented with, is free free space that can write, then can trigger writeable
Event:EPOLLOUT events.
Step S203 if file handle has writeable event, performs write operation, and continues to monitor after the write operation is completed
Whether the file handle has readable event, and execution cycles next time.
In the case where definite file handle has writeable event, then write operation is performed, is write data into buffering area, this
In write operation be to asking made response, after the completion of write operation, illustrate that one cycle terminates, monitoring file can be continued
Whether handle has readable event, and execution cycles next time.
Step S204 if write operation implementing result shows to write successfully, continues to monitor whether the file handle has
Readable event, execution cycle next time.
If write operation implementing result shows to write successfully, illustrate that data are had been written into buffering area, server is to client
Request has responded, and can perform cycle next time at this time, that is, continues whether monitoring file handle has readable event, with true
Determine client and whether have sent new request to be handled.
Whether the method that above-described embodiment provides according to the present invention, the monitoring associated buffering area of file handle are stored with number
According to, if so, determining file handle has readable event, read the corresponding data of the file handle and handled accordingly, and
Write operation is performed to the file handle, if write operation implementing result shows write-in failure, monitoring file handle is associated slow
Area is rushed, to determine whether file handle has writeable event, if file handle has writeable event, performs write operation, and
Continue to monitor whether the file handle has readable event after the completion of write operation, execution cycles next time;If write operation performs
The result shows that writing successfully, then continue to monitor whether the file handle has readable event, execution cycles next time.Based on this
The scheme of inventive embodiments, it is whether writeable without exiting monitoring file handle, so as to reduce one cycle and once monitor
Whether writeable operation, the performance of network programming frame is optimized.
Fig. 3 shows the structural representation of the data read-write equipment according to an embodiment of the invention based on file handle
Figure.As shown in figure 3, the device includes:Monitor module 300, processing module 310.
Module 300 is monitored, is adapted for listening for the associated buffering area of file handle, it can with whether the definite file handle has
Reading event.
Big well known network service architectures are C/S frameworks (Client/Server frameworks, i.e. client/server frame
Structure), it is actively to initiate to ask to server from client, request server returns data to client, and takes under normal circumstances
Device be engaged in the case where not receiving request, it will not be actively to client push data.
If a client is connected to server, file handle can be carried in the request that user end to server is sent,
Server receives the function (accept functions) of client request that can obtain the corresponding file sentence of this client by calling
Handle, wherein, file handle is used for tab file, and corresponding file can be accessed according to file handle, therefore, need exist for supervising
Whether have readable event, asked with determining whether client sends to server, specifically, associated by monitoring file handle if listening
Buffering area come determine file handle whether have readable event.
Processing module 310 if having readable event suitable for the file handle, reads the corresponding number of the file handle
According to and handled accordingly, and to the file handle perform write operation.
If file handle has readable event, the data in the corresponding file of this document handle can be read, are being read
, it is necessary to be handled accordingly data after to data, for example, parsing data are assorted with the definite requested content of client
, after corresponding processing is performed, write operation is directly performed to file handle, which is that server does request
Response, i.e., to client returned data.
Module 300 is monitored to be further adapted for:Corresponding monitoring processing is carried out according to write operation implementing result.
Although performing write operation to file handle, write operation implementing result may be to write successfully or write to lose
It loses, different write operation implementing results determines the monitoring processing scheme after write operation execution.
Existing method continues monitoring file after reading the corresponding data of the file handle and handle accordingly
Whether handle has writeable event, wait is recycled to next next time when, judges whether file handle has writeable event, if having
Writeable event is then write data into buffering area, and then whether monitoring file handle has readable event again, specifically, can
To be realized by following code:
Under normal circumstances, the not writeable probability of the associated buffering area of file handle is very low, is monitored before write-in every time
Whether file handle has writeable event, not only increases unnecessary cycling and snoop-operations, also affects network programming frame
The performance of frame.
Based on the above problem, the embodiment of the present invention is reading the corresponding data of the file handle and is being handled accordingly
Afterwards, write operation is directly performed to file handle, which is the server response done to request, although directly to file
Handle performs write operation, but implementing result may be write-in failure or write successfully, according to different write operation implementing results,
Different method for processing interception will be performed.
Optionally, the monitoring module 300 is further adapted for:If write operation implementing result shows write-in failure, monitor
The associated buffering area of file handle, to determine whether file handle has writeable event.
The processing module 310 is further adapted for:If file handle has writeable event, write operation is performed;And it is writing
Continue to monitor whether the file handle has readable event after the completion of operation, execution cycles next time.
The monitoring module 300 is further adapted for:If write operation implementing result shows to write successfully, continue described in monitoring
Whether file handle has readable event, and execution cycles next time.
Optionally, the monitoring module 300 is further adapted for:Monitor the associated buffering area of file handle state whether be
Full state is write, if not, it is determined that file handle has writeable event.
Optionally, the monitoring module 300 is further adapted for:Whether the monitoring associated buffering area of file handle is stored with number
According to if so, determining that file handle has readable event.
In embodiments of the present invention, each file handle corresponds to a buffering area, and the associated buffering area non-empty of file handle is
When there are data, illustrate that buffering area there are data that can read, readable event, i.e. EPOLLIN events will be triggered at this time, therefore, lead to
Cross whether the associated buffering area of monitoring file handle is stored with data, you can determine whether file handle has readable event, if
The associated buffering area of file handle is stored with data, then supporting paper handle has readable event;If file handle is associated slow
It rushes area and is not stored with data, then explanation does not have readable event.
Optionally, each file handle corresponds to a buffering area.
Whether the device that above-described embodiment provides according to the present invention, the monitoring associated buffering area of file handle are stored with number
According to, if so, determining file handle has readable event, read the corresponding data of the file handle and handled accordingly, and
Write operation is performed to the file handle, if write operation implementing result shows write-in failure, monitoring file handle is associated slow
Area is rushed, to determine whether file handle has writeable event, if file handle has writeable event, performs write operation, and
Continue to monitor whether the file handle has readable event after the completion of write operation, execution cycles next time;If write operation performs
The result shows that writing successfully, then continue to monitor whether the file handle has readable event, execution cycles next time.Based on this
The scheme of inventive embodiments, it is whether writeable without exiting monitoring file handle, so as to reduce one cycle and once monitor
Whether writeable operation, the performance of network programming frame is optimized.
Present invention also provides a kind of nonvolatile computer storage media, the computer storage media is stored at least
One executable instruction, the computer executable instructions can perform the data based on file handle in above-mentioned any means embodiment
Reading/writing method.
Fig. 4 shows a kind of structure diagram of computing device according to an embodiment of the invention, and the present invention is specific real
Example is applied not limit the specific implementation of computing device.
As shown in figure 4, the computing device can include:Processor (processor) 402, communication interface
(Communications Interface) 404, memory (memory) 406 and communication bus 408.
Wherein:
Processor 402, communication interface 404 and memory 406 complete mutual communication by communication bus 408.
Communication interface 404, for communicating with the network element of miscellaneous equipment such as client or other servers etc..
Processor 402 for performing program 410, can specifically perform the above-mentioned data read-write method based on file handle
Correlation step in embodiment.
Specifically, program 410 can include program code, which includes computer-managed instruction.
Processor 402 may be central processor CPU or specific integrated circuit ASIC (Application
Specific Integrated Circuit) or be arranged to implement the embodiment of the present invention one or more integrate electricity
Road.The one or more processors that computing device includes can be same type of processor, such as one or more CPU;Also may be used
To be different types of processor, such as one or more CPU and one or more ASIC.
Memory 406, for storing program 410.Memory 406 may include high-speed RAM memory, it is also possible to further include
Nonvolatile memory (non-volatile memory), for example, at least a magnetic disk storage.
Program 410 specifically can be used for so that processor 402 perform in above-mentioned any means embodiment based on file sentence
The data read-write method of handle.The specific implementation of each step may refer to the above-mentioned reading and writing data based on file handle in program 410
Corresponding description in corresponding steps and unit in embodiment, this will not be repeated here.Those skilled in the art can be clearly
Recognize, for convenience and simplicity of description, the equipment of foregoing description and the specific work process of module, may be referred to preceding method
Corresponding process description in embodiment, details are not described herein.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein.
Various general-purpose systems can also be used together with teaching based on this.As described above, required by constructing this kind of system
Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It should be understood that it can utilize various
Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the specification provided in this place, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention
Example can be put into practice without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of each inventive aspect,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:I.e. required guarantor
Shield the present invention claims the more features of feature than being expressly recited in each claim.It is more precisely, such as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim is in itself
Separate embodiments all as the present invention.
Those skilled in the art, which are appreciated that, to carry out adaptively the module in the equipment in embodiment
Change and they are arranged in one or more equipment different from the embodiment.It can be the module or list in embodiment
Member or component be combined into a module or unit or component and can be divided into addition multiple submodule or subelement or
Sub-component.In addition at least some in such feature and/or process or unit exclude each other, it may be employed any
Combination is disclosed to all features disclosed in this specification (including adjoint claim, summary and attached drawing) and so to appoint
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification is (including adjoint power
Profit requirement, summary and attached drawing) disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included some features rather than other feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
One of meaning mode can use in any combination.
The all parts embodiment of the present invention can be with hardware realization or to be run on one or more processor
Software module realize or realized with combination thereof.It will be understood by those of skill in the art that it can use in practice
Microprocessor or digital signal processor (DSP) realize the reading and writing data according to embodiments of the present invention based on file handle
The some or all functions of some or all components in equipment.The present invention is also implemented as being retouched here for performing
The some or all equipment or program of device (for example, computer program and computer program product) for the method stated.
Such program for realizing the present invention can may be stored on the computer-readable medium or can have one or more signal
Form.Such signal can be downloaded from internet website obtain either providing on carrier signal or with it is any its
He provides form.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability
Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference symbol between bracket should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.If in the unit claim for listing equipment for drying, several in these devices can be by same hardware branch
To embody.The use of word first, second, and third does not indicate that any order.These words can be explained and run after fame
Claim.
The invention discloses:
A1. a kind of data read-write method based on file handle, including:
The associated buffering area of monitoring file handle, to determine whether the file handle has readable event;
If the file handle has readable event, read the corresponding data of the file handle and located accordingly
Reason, and write operation is performed to the file handle;
Corresponding monitoring processing is carried out according to write operation implementing result.
A2. the method according to A1, wherein, it is described to be handled according to corresponding monitor of write operation implementing result progress into one
Step includes:
If write operation implementing result shows write-in failure, the associated buffering area of monitoring file handle, to determine file sentence
Whether handle has writeable event, if file handle has writeable event, performs write operation, and continues to supervise after the write operation is completed
Listen whether the file handle has readable event, execution cycles next time;
If write operation implementing result shows to write successfully, continue to monitor whether the file handle has readable event,
Execution cycles next time.
A3. the method according to A2, wherein, the associated buffering area of monitoring file handle, to determine file handle
Whether there is writeable event to further comprise:
Whether the state for monitoring the associated buffering area of file handle is to write full state, if not, it is determined that file handle has
Writeable event.
A4. according to A1-A3 any one of them methods, wherein, the associated buffering area of monitoring file handle, to determine
Whether file handle there is readable event to further comprise:
Whether the monitoring associated buffering area of file handle is stored with data, if so, determining that file handle has readable thing
Part.
A5. according to A1-A4 any one of them methods, wherein, each file handle corresponds to a buffering area.
B6. a kind of data read-write equipment based on file handle, including:
Module is monitored, is adapted for listening for the associated buffering area of file handle, to determine it is readable whether the file handle has
Event;
Processing module if having readable event suitable for the file handle, reads the corresponding data of the file handle
And handled accordingly, and write operation is performed to the file handle;
Module is monitored to be further adapted for:Corresponding monitoring processing is carried out according to write operation implementing result.
B7. the device according to B6, wherein, the monitoring module is further adapted for:If write operation implementing result shows
Write-in failure, then whether the associated buffering area of monitoring file handle, have writeable event with definite file handle;
The processing module is further adapted for:If file handle has writeable event, write operation is performed;And in write operation
Continue to monitor whether the file handle has readable event after finishing, execution cycles next time;
The monitoring module is further adapted for:If write operation implementing result shows to write successfully, continue to monitor the text
Whether part handle has readable event, and execution cycles next time.
B8. the device according to B7, wherein, the monitoring module is further adapted for:It is associated slow to monitor file handle
Whether the state for rushing area is to write full state, if not, it is determined that file handle has writeable event.
B9. according to B6-B8 any one of them devices, wherein, the monitoring module is further adapted for:Monitor file handle
Whether associated buffering area is stored with data, if so, determining that file handle has readable event.
B10. according to B6-B9 any one of them devices, wherein, each file handle corresponds to a buffering area.
C11. a kind of computing device, including:Processor, memory, communication interface and communication bus, the processor, institute
It states memory and the communication interface and mutual communication is completed by the communication bus;
For the memory for storing an at least executable instruction, the executable instruction makes the processor perform such as
The corresponding operation of the data read-write method based on file handle any one of A1-A5.
D12. a kind of computer storage media is stored with an at least executable instruction in the storage medium, described to hold
Row instruction makes processor perform the corresponding operation of the data read-write method based on file handle as any one of A1-A5.
Claims (10)
1. a kind of data read-write method based on file handle, including:
The associated buffering area of monitoring file handle, to determine whether the file handle has readable event;
If the file handle has readable event, read the corresponding data of the file handle and handled accordingly,
And write operation is performed to the file handle;
Corresponding monitoring processing is carried out according to write operation implementing result.
2. according to the method described in claim 1, wherein, it is described according to write operation implementing result carry out it is corresponding monitor handle into
One step includes:
If write operation implementing result shows write-in failure, the associated buffering area of monitoring file handle is with definite file handle
It is no that there is writeable event, if file handle has writeable event, write operation is performed, and continues to monitor institute after the write operation is completed
State whether file handle has readable event, execution cycles next time;
If write operation implementing result shows to write successfully, continue to monitor whether the file handle has readable event, perform
It cycles next time.
3. according to the method described in claim 2, wherein, the associated buffering area of monitoring file handle, to determine file sentence
Whether handle there is writeable event to further comprise:
Whether the state for monitoring the associated buffering area of file handle is to write full state, if not, it is determined that file handle has writeable
Event.
4. according to claim 1-3 any one of them methods, wherein, the associated buffering area of monitoring file handle, with true
Determine whether file handle there is readable event to further comprise:
Whether the monitoring associated buffering area of file handle is stored with data, if so, determining that file handle has readable event.
5. according to claim 1-4 any one of them methods, wherein, each file handle corresponds to a buffering area.
6. a kind of data read-write equipment based on file handle, including:
Module is monitored, is adapted for listening for the associated buffering area of file handle, to determine whether the file handle has readable event;
Processing module if having readable event suitable for the file handle, reads the corresponding data of the file handle and goes forward side by side
The corresponding processing of row, and write operation is performed to the file handle;
Module is monitored to be further adapted for:Corresponding monitoring processing is carried out according to write operation implementing result.
7. device according to claim 6, wherein, the monitoring module is further adapted for:If write operation implementing result table
Bright write-in failure, then whether the associated buffering area of monitoring file handle, have writeable event with definite file handle;
The processing module is further adapted for:If file handle has writeable event, write operation is performed;And it is completed in write operation
After continue to monitor whether the file handle has readable event, execution cycles next time;
The monitoring module is further adapted for:If write operation implementing result shows to write successfully, continue to monitor the file sentence
Whether handle has readable event, and execution cycles next time.
8. device according to claim 7, wherein, the monitoring module is further adapted for:It is associated to monitor file handle
Whether the state of buffering area is to write full state, if not, it is determined that file handle has writeable event.
9. a kind of computing device, including:Processor, memory, communication interface and communication bus, the processor, the storage
Device and the communication interface complete mutual communication by the communication bus;
For the memory for storing an at least executable instruction, the executable instruction makes the processor perform right such as will
Ask the corresponding operation of the data read-write method based on file handle any one of 1-5.
10. a kind of computer storage media, an at least executable instruction, the executable instruction are stored in the storage medium
Processor is made to perform the corresponding operation of the data read-write method based on file handle as any one of claim 1-5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711486057.7A CN108062224B (en) | 2017-12-29 | 2017-12-29 | Data reading and writing method and device based on file handle and computing equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711486057.7A CN108062224B (en) | 2017-12-29 | 2017-12-29 | Data reading and writing method and device based on file handle and computing equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108062224A true CN108062224A (en) | 2018-05-22 |
CN108062224B CN108062224B (en) | 2021-04-23 |
Family
ID=62141010
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711486057.7A Active CN108062224B (en) | 2017-12-29 | 2017-12-29 | Data reading and writing method and device based on file handle and computing equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108062224B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111208988A (en) * | 2019-12-24 | 2020-05-29 | 杭州海兴电力科技股份有限公司 | Single-chip microcomputer file system compiling method and single-chip microcomputer system |
CN111291003A (en) * | 2020-01-21 | 2020-06-16 | 浙江工商大学 | Data reading method and device and electronic equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101256505A (en) * | 2007-03-02 | 2008-09-03 | 中国科学院声学研究所 | Single process contents server device and method based on IO event notification mechanism |
US7512930B2 (en) * | 2004-03-31 | 2009-03-31 | Intel Corporation | Program object read barrier |
CN101814018A (en) * | 2008-12-30 | 2010-08-25 | 英特尔公司 | Read and write monitoring attributes in transaction memory (TM) system |
CN102841785A (en) * | 2011-06-24 | 2012-12-26 | 奇智软件(北京)有限公司 | File handle closuring operation method and device |
CN103514275A (en) * | 2013-09-22 | 2014-01-15 | 北京航空航天大学 | User space event filtering-based method for increasing network program processing speed |
CN106126374A (en) * | 2016-06-22 | 2016-11-16 | 腾讯科技(深圳)有限公司 | Method for writing data, method for reading data and device |
US20170123767A1 (en) * | 2015-10-30 | 2017-05-04 | Xiaomi Inc. | Generating communication firmware and a program plug-in based on product information and a program template |
-
2017
- 2017-12-29 CN CN201711486057.7A patent/CN108062224B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7512930B2 (en) * | 2004-03-31 | 2009-03-31 | Intel Corporation | Program object read barrier |
CN101256505A (en) * | 2007-03-02 | 2008-09-03 | 中国科学院声学研究所 | Single process contents server device and method based on IO event notification mechanism |
CN101814018A (en) * | 2008-12-30 | 2010-08-25 | 英特尔公司 | Read and write monitoring attributes in transaction memory (TM) system |
CN102841785A (en) * | 2011-06-24 | 2012-12-26 | 奇智软件(北京)有限公司 | File handle closuring operation method and device |
CN103514275A (en) * | 2013-09-22 | 2014-01-15 | 北京航空航天大学 | User space event filtering-based method for increasing network program processing speed |
US20170123767A1 (en) * | 2015-10-30 | 2017-05-04 | Xiaomi Inc. | Generating communication firmware and a program plug-in based on product information and a program template |
CN106126374A (en) * | 2016-06-22 | 2016-11-16 | 腾讯科技(深圳)有限公司 | Method for writing data, method for reading data and device |
Non-Patent Citations (1)
Title |
---|
邓晓燕等: "基于"互联网+"的实验教学管理和数据分析系统", 《实验技术与管理》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111208988A (en) * | 2019-12-24 | 2020-05-29 | 杭州海兴电力科技股份有限公司 | Single-chip microcomputer file system compiling method and single-chip microcomputer system |
CN111208988B (en) * | 2019-12-24 | 2023-09-26 | 杭州海兴电力科技股份有限公司 | Method for writing file system of single-chip microcomputer and single-chip microcomputer system |
CN111291003A (en) * | 2020-01-21 | 2020-06-16 | 浙江工商大学 | Data reading method and device and electronic equipment |
CN111291003B (en) * | 2020-01-21 | 2021-01-05 | 浙江工商大学 | Data reading method and device and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN108062224B (en) | 2021-04-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9535754B1 (en) | Dynamic provisioning of computing resources | |
US20200159622A1 (en) | Rule based failure addressing | |
US11625405B2 (en) | System and method for object-oriented pattern matching in arbitrary data object streams | |
CN107025256B (en) | Method and system for reducing reactivation time of cloud-based services | |
US11546380B2 (en) | System and method for creation and implementation of data processing workflows using a distributed computational graph | |
CN109254854A (en) | Asynchronous invoking method, computer installation and storage medium | |
CN110162344B (en) | Isolation current limiting method and device, computer equipment and readable storage medium | |
WO2014133512A1 (en) | Providing code change job sets of different sizes to validators | |
CN109614227A (en) | Task resource concocting method, device, electronic equipment and computer-readable medium | |
CN110188135A (en) | Document generating method and equipment | |
CN108123851A (en) | The lifetime detection method and device of main and subordinate node synchronization link in distributed system | |
CN112083971B (en) | Component processing method, device and storage medium | |
CN110609755A (en) | Message processing method, device, equipment and medium for cross-block chain node | |
CN108062224A (en) | Data read-write method, device and computing device based on file handle | |
US11861214B2 (en) | Memory device forensics and preparation | |
US20230385048A1 (en) | Predictive recycling of computer systems in a cloud environment | |
CN111488316B (en) | File cache recovery method and device | |
CN110069377A (en) | A kind of monitoring method of multi-core processor, terminal and computer storage medium | |
CN117076096A (en) | Task flow execution method and device, computer readable medium and electronic equipment | |
US20210096919A1 (en) | Identifying recurring actions in a hybrid integration platform to control resource usage | |
CN109783718A (en) | Repetitive requests judgment method and device | |
CN111681093B (en) | Method and device for displaying resource page and electronic equipment | |
CN116263717A (en) | Order service processing method and device based on event | |
US11061988B2 (en) | Reducing web page load times | |
CN111353766A (en) | Service process processing system and method of distributed service system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |