Resource sharing method and system
A technology of resource sharing and resources, applied in the field of resource sharing
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0025] figure 1 The implementation flow of the resource sharing method provided by the first embodiment of the present invention is shown, and the details are as follows:
[0026] In step S101, a correspondence between resources and bytes in a file is set.
[0027] The file refers to the file used to implement the file lock. In the embodiment of the present invention, the resource file mapping table can be used to store the correspondence between the set resources and the bytes in the file, and of course other ways can also be used to store the correspondence between the set resources and the bytes in the file , without giving examples here. Table 1.1 shows an example of the resource file mapping table provided by the embodiment of the present invention, but is not limited to this example, where the resource number is used to uniquely identify the resource, that is, the corresponding resource can be obtained according to the resource number, byte The number refers to the by...
Embodiment 2
[0038] figure 2 The implementation flow of the resource sharing method provided by the second embodiment of the present invention is shown, and the details are as follows:
[0039] In step S201, a correspondence between resources and bytes in a file is set. The specific steps are as described above and will not be repeated here.
[0040]In step S202, when a process accesses a resource, a file lock is applied for a byte in the file corresponding to the resource. The specific steps are as described above and will not be repeated here.
[0041] In step S203, it is judged whether the file lock application is successful, if yes, execute step S205, otherwise execute step S204.
[0042] The steps to determine whether the file lock application is successful are as follows:
[0043] A. Determine whether the byte corresponding to the resource in the file has been applied for a file lock, if yes, perform step B, otherwise determine that the file lock application is successful;
[0...
Embodiment 3
[0055] image 3 It shows the implementation process of the resource sharing method provided by the third embodiment of the present invention, image 3 Steps S301 to S305 in the method shown with figure 2 The steps S201 to S205 shown are the same, and the only difference is that the following steps are also included:
[0056] In step S306, after the process releases the resource and releases the file lock for the byte corresponding to the resource in the file, wake up other processes waiting for the resource, and the awakened process applies for a file lock for the byte corresponding to the resource in the file. When there are multiple wake-up processes, that is, multiple processes apply for a file lock for the byte corresponding to the resource in the file at the same time, each process competes, and the winner successfully applies for the file lock for the byte corresponding to the resource in the file.
[0057] In the embodiment of the present invention, when a process fi...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 