Unlock instant, AI-driven research and patent intelligence for your innovation.

Resource sharing method and system

A technology of resource sharing and resources, applied in the field of resource sharing

Active Publication Date: 2013-08-14
SHENZHEN SHI JI GUANG SU INFORMATION TECH
View PDF5 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The purpose of the embodiments of the present invention is to provide a method for resource sharing, aiming at solving the problem of cross-process mutually exclusive access to a large number of resources through file locks

Method used

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

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Resource sharing method and system
  • Resource sharing method and system
  • Resource sharing method and system

Examples

Experimental program
Comparison scheme
Effect test

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...

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

PUM

No PUM Login to View More

Abstract

The invention is suitable for the field of computer application and provides a resource sharing method and system. The method comprises the following steps: a corresponding relation between a resource and bytes in a file is set; when a process accesses the resource, the process applies a file lock for the bytes in the file which are corresponding to the resource and accesses the resource after the file lock is successfully applied; and when the process releases the resource, the file lock corresponding to the bytes in the file which are corresponding to the resource is unlocked. Through the file lock, the embodiment of the invention realizes exclusive sharing of the resource; and as the file lock for the bytes in the file which are corresponding to the resource is applied, i.e. a file lock for corresponding offset in the file is applied, the locked part is offset of the file instead of practical content of the file, so that the method has no requirement on a size of the file, and cross-process exclusive accessing to ample resources can be realized.

Description

technical field [0001] The invention belongs to the field of computer applications, in particular to a resource sharing method and system. Background technique [0002] When multiple processes or threads access the same resource concurrently, in order to ensure the consistency of the resource, mutual exclusion rules must be followed. In specific implementation, mutual exclusion rules mainly include shared locks (also called read locks) and mutual exclusion locks (also called write locks). Among them, shared lock means that multiple processes or threads can access resources at the same time, but cannot modify resources. That is, when a process or thread is accessing a resource rather than modifying the resource, if a shared lock is added to the resource, other processes or threads can access the resource, but cannot modify the resource. Among them, a mutex means that multiple processes or threads cannot access resources at the same time. That is, when a process or thread a...

Claims

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

Application Information

Patent Timeline
no application Login to View More
IPC IPC(8): G06F9/46G06F9/50
Inventor 禹荣凌
Owner SHENZHEN SHI JI GUANG SU INFORMATION TECH