Concurrent File Moving with Path Comparison to Prevent Tree Loops
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Concurrent file moving operations in directory trees can cause loops, leading to inefficiencies due to the need for global lock mechanisms that sequentially queue renaming operations.
Innovation Solution
Compare the source and destination paths of concurrent file moving operations to identify and avoid 'bidirectional' operations that could create loops, thereby improving concurrency and efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a global lock mechanism is used to prevent loops in directory trees, then reliability is improved, but productivity deteriorates due to sequential queuing of renaming operations
Solution Approach 1:
The patent segments the global lock mechanism into fine-grained path-based locks. Instead of using a single global lock for all renaming operations, the system divides the lock space into multiple segments corresponding to different directory paths. Each renaming operation acquires locks only for the specific paths involved, allowing concurrent operations on different paths while preventing loops through coordinated lock acquisition. This segmentation resolves the contradiction by maintaining reliability through path-specific locking while improving productivity through concurrent execution of non-conflicting operations.
Solution Approach 2:
The patent applies local quality by making lock acquisition behavior path-specific rather than uniform across the entire file system. Each renaming operation acquires locks locally for its source and destination paths, and the system tracks path relationships (ancestor-descendant, sibling, etc.) to determine concurrency safety. This local approach allows different parts of the file system to operate concurrently while maintaining loop prevention where needed, thus improving overall productivity without sacrificing reliability.
2Productivity
If concurrent file moving operations are allowed, then productivity is improved, but reliability deteriorates due to potential loop formation in directory trees
Solution Approach 1:
The patent implements dynamic lock acquisition and release based on the specific path relationships of each renaming operation. The system dynamically determines which locks to acquire by analyzing the source and destination paths, their ancestors, and siblings. Operations that don't create loops can proceed concurrently with dynamic coordination, while potentially problematic operations are serialized. This dynamic approach maximizes productivity by allowing concurrent operations when safe, while maintaining reliability through adaptive loop prevention.
Solution Approach 2:
The patent uses feedback mechanisms to monitor path relationships and detect potential loop conditions during concurrent operations. The system tracks the state of directory paths and uses this feedback to make real-time decisions about operation ordering and lock acquisition. When a potential loop is detected through path analysis, the system adjusts the execution order or acquires additional locks to prevent the loop, thus maintaining reliability while allowing high concurrency in safe scenarios.
3Reliability
If path comparison is performed to avoid reverse operations, then reliability is improved, but device complexity increases
Solution Approach 1:
The patent performs preliminary path analysis and lock acquisition planning before executing renaming operations. The system pre-computes the set of locks needed based on source and destination paths, identifies ancestor and sibling relationships, and determines the safe execution order in advance. This preliminary action simplifies the actual execution phase and reduces the complexity of real-time path comparison during operation, as the heavy lifting of path analysis is done beforehand. The complexity is managed by structuring the preliminary analysis in a systematic way that reuses information across operations.
Data Source
Figure 1~2
Figure 3~4
Figure 5~6
AI summary
A file moving method, an electronic device, and a computer-readable storage medium are provided. An implementation includes: in response to receiving a file moving request, obtaining (510) a source path and a destination path corresponding to a first moving operation corresponding to the request; determining (520) whether the source path and the destination path corresponding to the first moving operation exist; in response to determining that both the source path and the destination path corresponding to the first moving operation exist, comparing (530) at least one of the source path and the destination path corresponding to the first moving operation with a corresponding path of a source path and a destination path corresponding to a second moving operation; and determining, based on a comparison result, whether the first moving operation is to be performed.