File reading method, electronic device, chip system, storage medium, and program product

By selecting an appropriate pointer offset method based on file parameters, the problems of slow file system reading speed and large memory consumption in electronic devices are solved, thereby improving file reading efficiency and user experience.

CN119377172BActive Publication Date: 2026-01-09HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411205455.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2026-01-09
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

The file system of electronic devices suffers from slow reading speed and high memory consumption when reading files, especially when reading large files or reading files frequently.

Method used

By determining parameters such as the size of the target file, pointer offset, offset frequency, and usage frequency, a suitable pointer offset method is selected, and file reading is performed using either the fast seek or normal seek method, thereby reducing memory usage and improving reading efficiency.

Benefits of technology

It improves file reading efficiency, reduces the memory usage of electronic devices, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119377172B_ABST
    Figure CN119377172B_ABST
Patent Text Reader

Abstract

The file reading method, the electronic device, the chip system, the storage medium and the program product provided by the embodiments of the present application relate to the technical field of terminals. The method comprises: determining a pointer offset mode used when reading a target file by judging whether one or more of the size, the pointer offset, the offset frequency and the usage frequency of the target file to be read meet a first condition. In this way, the file system can select a suitable file reading mode based on the target parameters of the target file, can read the file content faster, improve the efficiency of reading the file, and thus improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of terminals, and in particular to a file reading method, an electronic device, a chip system, a storage medium and a program product. BACKGROUND

[0002] The file system of some electronic devices can be used to manage and read various files, such as font libraries, user interface (UI) resources, configuration files, log files, and the like.

[0003] However, in some scenarios, the file system may have a slow reading speed and a long reading time when reading files. SUMMARY

[0004] Embodiments of the present application provide a file reading method, an electronic device, a chip system, a storage medium and a program product, which are applied to the technical field of terminals and can enable the electronic device to select a more appropriate pointer offset mode when reading a target file, improve file reading efficiency, and thus improve user experience.

[0005] In a first aspect, embodiments of the present application provide a file reading method. The method comprises: in a case where a target parameter of a target file meets a first condition, reading the target file by using a first pointer offset mode; in a case where the target parameter of the target file does not meet the first condition, reading the target file by using a second pointer offset mode; wherein the first pointer offset mode has the following characteristics compared with the second pointer offset mode: long time to open a file, large memory occupation and fast reading speed, and the target parameter comprises one or more of the following: size of the target file, pointer offset amount of the target file, offset frequency of the target file, and usage frequency of the target file. By judging one or more of the file size, the file pointer offset size, the file pointer offset frequency and / or the file single opening time length of the target file, the file pointer offset mode used when reading the target file is determined. In this way, the file system can select a suitable file reading mode according to the actual situation of each file, can reduce the occupation of the memory of the electronic device, and can read the file content faster to improve the efficiency of reading the file, thereby improving user experience.

[0006] In combination with the first aspect, in some implementations of the first aspect, the first condition comprises one or more of the following: the size of the target file is greater than or equal to a first threshold value, the pointer offset amount of the target file is greater than or equal to a second threshold value, the offset frequency of the target file is greater than or equal to a third threshold value, and the usage frequency of the target file is greater than or equal to a fourth threshold value. When the electronic device determines that the target file meets the first condition, it can be understood that the fast seek mode is more suitable for reading the target file, which can improve the efficiency of reading the file and thus improve user experience.

[0007] With reference to the first aspect, in some implementations of the first aspect, the electronic device is configured with a first configuration file, and the target file is read in the first pointer offset mode in a case where the target parameter of the target file meets the first condition, including: the target file is read in the first pointer offset mode in a case where the target file is included in the first configuration file; wherein the first configuration file includes identifiers of L files, the target parameters of the L files each meet the first condition, the L files include the target file, L is a positive integer, and the first configuration file is fixedly set. By pre-setting the first configuration file in the electronic device, and determining to read the target file in the first pointer offset mode or the second pointer offset mode based on the first configuration file when reading the file, the use requirement of the file is better met, so as to improve the efficiency of reading the file and improve the user experience.

[0008] With reference to the first aspect, in some implementations of the first aspect, the electronic device is configured with a second configuration file, and the target file is read in the first pointer offset mode in a case where the target parameter of the target file meets the first condition, including: the target file is read in the first pointer offset mode in a case where the target file is included in the second configuration file; wherein the second configuration file includes identifiers of M files, the target parameters of the M files each meet the first condition, the M files include the target file, M is a positive integer, and the second configuration file is updated by the electronic device at a preset time. By pre-setting the second configuration file in the electronic device, and determining to read the target file in the first pointer offset mode or the second pointer offset mode based on the second configuration file when reading the file, or, the first configuration file and the second configuration file can be combined to determine to read the target file in the first pointer offset mode or the second pointer offset mode, the user requirement is better met, so as to improve the efficiency of reading the file and improve the user experience.

[0009] With reference to the first aspect, in some implementations of the first aspect, before the electronic device updates the second configuration file, the method further includes: counting target parameters of N files, N being a positive integer. The electronic device updates the second configuration file, including: in a case where target parameters of P files meet the first condition, the electronic device updates the second configuration file, wherein P is a positive integer, the P files are included in the N files, the second configuration file includes identifiers of the P files, and the P files and the M files are different. Before the electronic device updates the second configuration file, the target parameters of the N files are counted first, and in a case where P files in the N files meet the first condition, the second configuration file is updated according to the identifiers of the P files, so that the second configuration file can dynamically adjust the pointer offset mode based on the actual use of the user, has higher flexibility, and improves the user experience.

[0010] With reference to the first aspect, in some implementations of the first aspect, before reading the target file by using the first pointer offset mode, the method further includes: counting target parameters of one or more files, the one or more files including the target file; and ranking the one or more files based on the target parameters. In a case where the target parameter of the target file satisfies a first condition, reading the target file by using the first pointer offset mode includes: in a case where the target file is within a preset ranking range, reading the target file by using the first pointer offset mode. The method provided in the embodiments of the present application can select a file ranked within a preset range to use the first pointer offset mode in a case where the memory space of the electronic device is insufficient, reduce the case where the file reading fails due to too high memory occupation when reading the file, and improve the stability of the file system.

[0011] With reference to the first aspect, in some implementations of the first aspect, ranking the one or more files based on the target parameters includes: summing up calculation results of each parameter in the target parameters and sorting to obtain the ranking of the one or more files; and the calculation result of each parameter includes one or more of the following: a product of the size of the file and a first weight, a product of the pointer offset of the file and a second weight, a product of the offset frequency of the file and a third weight, and a product of the usage frequency of the file and a fourth weight. By summing up the target parameters of the file and the respective weights corresponding thereto, the file size, the pointer offset, the offset frequency, and the usage frequency are comprehensively considered, and based on the respective weights, a file that is more suitable for the first pointer offset mode is selected from the one or more target files, thereby improving the stability of the file system of the electronic device.

[0012] With reference to the first aspect, in some implementations of the first aspect, the first pointer offset mode includes a fast seek mode, and the second pointer offset mode includes a normal seek mode. In the embodiments of the present application, for the target file, the pointer offset mode that is more suitable for the target file is selected from the fast seek mode and the normal seek mode, which can significantly improve the efficiency of reading the file by the file system and improve the user experience.

[0013] In a second aspect, an embodiment of the present application provides a file reading apparatus. The file reading apparatus can be an electronic device, or a chip or chip system in the electronic device. The file reading apparatus can include a processing unit. The processing unit can be a processor. The apparatus can further include a storage unit, which can be a memory. The storage unit is configured to store instructions, and the processing unit is configured to execute the instructions stored in the storage unit, so that the electronic device implements a file reading method described in the first aspect or any possible implementation of the first aspect. When the apparatus is a chip or chip system in the electronic device, the processing unit can be a processor. The processing unit is configured to execute the instructions stored in the storage unit, so that the electronic device implements a file reading method described in the first aspect or any possible implementation of the first aspect. The storage unit can be a storage unit (for example, a register, a cache, etc.) in the chip, or a storage unit (for example, a read-only memory, a random access memory, etc.) outside the chip in the electronic device.

[0014] In a third aspect, an embodiment of the present application provides an electronic device. The electronic device includes a processor and a memory. The memory is configured to store code instructions, and the processor is configured to execute the code instructions to perform a method described in the first aspect or any possible implementation of the first aspect.

[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program or instructions. When the computer program or instructions are executed on a computer, the computer is caused to perform a method described in the first aspect or any possible implementation of the first aspect.

[0016] In a fifth aspect, an embodiment of the present application provides a computer program product including a computer program. When the computer program is executed on a computer, the computer is caused to perform a method described in the first aspect or any possible implementation of the first aspect.

[0017] In a sixth aspect, an embodiment of the present application provides a chip or chip system. The chip or chip system includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected by a line. The at least one processor is configured to execute a computer program or instructions to perform a method described in the first aspect or any possible implementation of the first aspect. The communication interface in the chip can be an input / output interface, a pin, or a circuit, etc.

[0018] In a possible implementation, the chip or chip system described in the present application further includes at least one memory. The at least one memory stores instructions. The memory can be a storage unit (for example, a register, a cache, etc.) in the chip, or a storage unit (for example, a read-only memory, a random access memory, etc.) of the chip.

[0019] It should be understood that the second aspect to the sixth aspect of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation manners are similar, which will not be repeated. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 A structural schematic diagram of an electronic device hardware structure provided by an embodiment of the present application is shown in the figure.

[0021] Figure 2 A software structure block diagram of an electronic device of an embodiment of the present application is shown in the figure.

[0022] Figure 3 A schematic diagram of a cluster chain provided by an embodiment of the present application is shown in the figure.

[0023] Figure 4 A schematic diagram of a file index table provided by an embodiment of the present application is shown in the figure.

[0024] Figure 5 A flowchart of a file reading method provided by an embodiment of the present application is shown in the figure.

[0025] Figure 6 A schematic diagram of an updating file operation table method provided by an embodiment of the present application is shown in the figure.

[0026] Figure 7 A flowchart of another file reading method provided by an embodiment of the present application is shown in the figure.

[0027] Figure 8 A structural schematic diagram of a chip provided by an embodiment of the present application is shown in the figure. DETAILED DESCRIPTION

[0028] In order to clearly describe the technical solutions of the embodiments of the present application, the following briefly introduces some terms and technologies involved in the embodiments of the present application:

[0029] 1. File pointer: a pointer used to indicate the current file operation position. For example, when a file is opened using a file system, the file system will create a file pointer, which can be used to indicate the position of the current reading or writing file.

[0030] 2. File pointer offset: an operation used to indicate moving the file pointer from the current position to another position in the file. For example, in a file system, the file pointer offset can be realized by a normal seek mode or a fast seek mode.

[0031] It should be understood that for larger files, for example, a font file or a UI resource file, the file can be split into multiple clusters when stored, and each cluster stores part of the data of the file. In a possible scenario, multiple clusters of one file can be distributed at different locations in the storage space.

[0032] The normal seek mode is a cluster-by-cluster offset mode, and the file system can realize the offset of the file pointer in the cluster-by-cluster mode.

[0033] The fast seek mode is a fast positioning offset mode. When the electronic device performs a file opening or file initialization operation, the fast seek mode can read and cache the cluster chain table information of the file in advance, and the cluster chain table information can include the start position and length of each cluster chain of the file. When the file pointer needs to be moved, the fast seek mode can quickly position the cluster at the target position by using the cached cluster chain table information.

[0034] 3. Other terms

[0035] In the embodiments of the present application, the same items or similar items with basically the same functions and effects are distinguished by using "first", "second", and the like. For example, the first chip and the second chip are only used to distinguish different chips, and do not limit the sequence. Those skilled in the art can understand that "first", "second", and the like do not limit the number and execution sequence, and "first", "second", and the like do not necessarily mean different.

[0036] It should be noted that in the embodiments of the present application, the words "exemplarily" or "for example" are used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplarily" or "for example" in the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. Rather, the words "exemplarily" or "for example" are intended to present the relevant concept in a specific manner.

[0037] In the embodiments of the present application, "at least one" means one or more, and "multiple" means two or more. The association relationship of the associated objects is described by "and / or", which means that there can be three kinds of relationships, for example, A and / or B, which can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after it. "At least one of the following" or similar expressions means any combination of these items, including any combination of single item or multiple items. For example, at least one of a, b, or c can represent a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, and c can be single or multiple.

[0038] 4. Electronic device

[0039] The electronic device of the embodiments of the present application can include a handheld device with a face recognition function, a vehicle-mounted device, etc. For example, some electronic devices are: a mobile phone, a tablet computer, a palm computer, a notebook computer, a mobile internet device (MID), a wearable device, a virtual reality (VR) device, an augmented reality (AR) device, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical surgery, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a cellular phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (WLL) station, a personal digital assistant (PDA), a handheld device with a wireless communication function, a computing device or other processing device connected to a wireless modem, a vehicle-mounted device, a wearable device, a terminal device in a 5G network, or a terminal device in a future evolved public land mobile network (PLMN), etc., and the embodiments of the present application are not limited thereto.

[0040] By way of example and not limitation, in the embodiments of the present application, the electronic device can also be a wearable device. The wearable device can also be referred to as a wearable smart device, which is a general term for devices that are designed and developed by applying wearable technology to daily wear, such as glasses, gloves, watches, clothing, and shoes, etc. The wearable device is a portable device that is directly worn on the body or integrated into the clothes or accessories of the user. The wearable device is not only a hardware device, but also a device that realizes powerful functions through software support and data interaction and cloud interaction. The general wearable smart device includes a device with full functions and large size, which can realize complete or partial functions without relying on a smart phone, such as a smart watch or smart glasses, etc., and a device that focuses on a certain application function and needs to cooperate with other devices such as a smart phone, such as various smart wristbands and smart jewelry for monitoring vital signs, etc.

[0041] In addition, in the embodiments of the present application, the electronic device can also be a terminal device in an internet of things (IoT) system. The IoT is an important part of future information technology development, and its main technical feature is to connect objects through communication technology and network, so as to realize the intelligent network of man-machine interconnection and object-object interconnection.

[0042] The electronic device in the embodiments of the present application can also be referred to as a terminal device, a user equipment (UE), a mobile station (MS), a mobile terminal (MT), an access terminal, a subscriber unit, a subscriber station, a mobile station, a remote station, a remote terminal, a mobile device, a user terminal, a terminal, a wireless communication device, a user agent or a user apparatus, etc.

[0043] In the embodiments of the present application, the electronic device or each network device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system layer. The hardware layer includes central processing units (CPUs), memory management units (MMUs), memories (also known as main memories), and other hardware. The operating system can be any one or more computer operating systems that implement business processing through processes, such as Linux operating systems, Unix operating systems, Android operating systems, iOS operating systems, or windows operating systems, etc. The application layer includes browsers, address books, word processing software, instant messaging software, etc.

[0044] The file system of the electronic device can be used to store, manage and read various files, such as font library files, UI resource files, configuration files, log files, etc. The font library file can include a collection of multiple strings. The UI resource file can include various materials and resources required for the interface display of the electronic device, such as icons, pictures, colors, fonts, etc. When reading a file, the file system can use a normal seek method or a fast seek method to perform file pointer offset.

[0045] It can be understood that when the file system reads a file using the normal seek mode, the time for opening the file and initializing the file is short, and the memory occupied is small. However, if the normal seek mode is used for file pointer offset of a large file, since multiple clusters in the file are distributed at different positions in the storage space, the file system needs to traverse multiple clusters distributed at different positions, and the normal seek mode is traversed cluster by cluster, so that the file pointer offset is large, and thus when the file is read, a long time may be consumed, the file is read slowly, and the reading efficiency of the file system is reduced.

[0046] When the file system reads a file using the fast seek mode, the reading speed is fast. However, since the electronic device uses the fast seek mode to read and cache the cluster chain table information of the file in advance when opening the file or initializing the file, the time for opening the file and initializing is long, and the memory occupied is large. If the frequency of file reading is high, the file needs to be frequently opened and closed, and the cluster chain table information of the file needs to be cached every time the file is read, so that in this case, the file may be read slowly, the memory resource of the electronic device is occupied too high, and the reading efficiency of the file system is reduced.

[0047] To solve the above technical problems, the embodiment of the present application provides a file reading method, which determines the file pointer offset mode used when reading a file by judging the file size, file pointer offset size, file pointer offset frequency and / or file single opening time length of the file to be read. In this way, the file system selects the appropriate file reading mode according to the actual situation of each file, which can reduce the memory occupation of the electronic device, and can read the file content faster, improve the efficiency of reading the file, and thus improve the user experience.

[0048] Figure 1 The structure schematic diagram of the electronic device 100 provided by the embodiment of the present application is shown in FIG. 1. As shown in FIG. 1, the electronic device 100 includes a processor 101, a memory 102, a storage 103, a communication interface 104, a display 105, and a sensor 106. Figure 1As shown, the electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headset jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0049] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different component arrangements. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0050] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP) and a coprocessor (CP), etc. The application processor includes an application program framework layer, a hardware abstraction layer, a kernel layer, etc. of the software architecture adopted by the electronic device 100; the coprocessor includes a sensor hub, etc. Different processing units can be independent devices, or can be integrated in one or more processors.

[0051] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor.

[0052] Understandably, if the electronic device uses the fast seek method for file pointer offset, the processor 110 will cache the cluster list information stored in the internal memory 121 in advance during the file opening or file initialization phase when reading the file. Furthermore, based on the cached cluster list information, the processor 110 can quickly offset the file pointer to the cluster containing the target location when offsetting the file pointer.

[0053] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can be used to store cluster list information.

[0054] It should be understood that Figure 1 The connection relationships between the modules shown are merely illustrative and do not constitute a limitation on the connection relationships between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of various connection methods described in the above embodiments.

[0055] Figure 2 This is a software structure block diagram of an electronic device 100 according to an embodiment of this application. For example... Figure 2 As shown, the layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0056] The application layer can include a series of application packages. For example... Figure 2As shown, the application package can include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. applications.

[0057] The application framework layer provides application programming interface (API) and programming framework for the applications of the application layer. The application framework layer includes some pre-defined functions. For example, Figure 2 As shown, the application framework layer can include window manager, resource manager, notification manager, content provider, file system, etc.

[0058] The file system provides an interface for basic file operations of the electronic device 100, for example, can include open file interface, close file interface, read and write file interface, and delete file interface, etc.

[0059] Optionally, the file system can also include a cluster chain table interface, which can be used to obtain the cluster chain table information of the file from the storage space.

[0060] The Android runtime includes a core library and a virtual machine. The Android runtime is responsible for the control and management of the Android system.

[0061] The core library contains two parts: one part is the function function that the java language needs to call, and the other part is the core library of Android.

[0062] The application layer and the framework layer run in the virtual machine. The virtual machine executes the java files of the application layer and the framework layer into binary files. The virtual machine is used to perform object lifecycle management, stack management, thread management, security and exception management, and garbage collection functions. For example, in the embodiment of the present application, the virtual machine can judge the offset mode of the file use based on the file pointer offset frequency, the file opening period or the file size and other indicators.

[0063] The system library can also be called the Native layer, and the Native layer can include multiple function modules. For example: media library, function library, graphics processing library (such as OpenGL ES), etc.

[0064] HAL is an abstract layer structure between the kernel layer and the Android runtime. The hardware abstraction layer can be a package of hardware drivers, providing a unified interface for the call of the upper layer application.

[0065] The kernel layer is the layer between hardware and software. The kernel layer can include display drivers, camera drivers, audio drivers, battery drivers, Bluetooth drivers, CPU drivers, USB drivers, etc.

[0066] It should be noted that the embodiments of this application are only illustrated using the Android system. In other operating systems (such as Windows, real-time operating systems (RTOS), iOS, etc.), as long as the functions implemented by each functional module are similar to those in the embodiments of this application, the solution of this application can also be implemented.

[0067] The methods of this application will be described in detail below through specific embodiments. The following embodiments can be combined with each other or implemented independently, and the same or similar concepts or processes may not be described again in some embodiments.

[0068] Based on the above embodiments, it can be understood that during file operations using electronic devices, the appropriate file pointer offset method may differ depending on factors such as file size and frequency of use. Therefore, before introducing the specific method of this application, we first analyze the applicable scenarios for file pointer offset using the normal seek and fast seek methods. The specific process is as follows.

[0069] It should be understood that when a file system stores or manages files, in order to save storage space, a file may be fragmented and stored across multiple clusters in the storage space. Each cluster stores a portion of the file's data, and the partial data stored in multiple clusters together constitutes the complete data of a file. Therefore, when reading a file, the file system needs to read the file based on the link relationships between the corresponding file's multiple clusters. In a file system, the link relationships between multiple clusters of a file can also be called cluster chains.

[0070] For example, Figure 3 This is a schematic diagram of a cluster chain provided for an embodiment of this application. (See attached diagram.) Figure 3 As shown, if the cluster chain of file A is cluster chain A, and this cluster chain A is numbered 1, 2, 3, 4, 45, 46 in sequence, it can be understood that the various parts of the data in this file are fragmented and stored sequentially on clusters numbered 1, 2, 3, 4, 45, 46 according to their order of appearance in the file. It should be understood that... Figure 3 The pointer in the file points to the location where the current processor 110 is reading the file.

[0071] If the file A is read by using the normal seek mode, during the process of reading the file A by the processor 110, the pointer is sequentially offset backward according to the order of the clusters in the cluster chain A, and during the process of offsetting, the processor 110 continuously performs input / output operations with the storage space. For example, if the target position of the pointer offset is the cluster with the cluster number 45, the pointer needs to sequentially traverse the clusters with the cluster numbers 1, 2, 3, 4 and 45 from the starting cluster, i.e., the cluster with the cluster number 1, until the target position is reached.

[0072] It can be understood that when the file system reads a file by using the normal seek mode, if the file is small, the multiple clusters in which the data of the file is distributed are less, and when the clusters are sequentially traversed until the cluster with the target position is found, a large amount of time will not be consumed. However, if the file is large, the multiple clusters in which the data of the file is distributed are more, and the multiple clusters are more dispersedly distributed at various positions of the storage space, and since the processor 110 and the storage space need to perform multiple input / output operations during the process of the file pointer offset, when the clusters are sequentially traversed until the cluster with the target position is found, a large amount of time will be consumed.

[0073] If the file A is read by using the fast seek mode, the processor 110 can pre-cache the cluster chain table information of the file A, and then based on the cluster chain table information, the cluster in which the target position of the file pointer offset is located can be acquired, so that the file pointer is quickly positioned.

[0074] Optionally, in the file system, the cluster chain table information of a file can be stored in a file index table. For example, Figure 4 A schematic diagram of the file index table provided by the embodiment of the present application is shown in FIG. 2. It can be understood that the file index table corresponding to the cluster chain A is shown in FIG. 2. Figure 4

[0075] In the file index table, the cluster number is used to indicate the starting cluster number in a continuous cluster number, and the length is used to indicate the number of continuous clusters. For example, for the cluster chain A, the continuous cluster numbers are 1, 2, 3, 4, 45 and 46.

[0076] It can be understood that for the continuous cluster numbers 1, 2, 3 and 4, the starting cluster number is 1, and the number of continuous clusters is 4, so 1 and 4 are stored in the file index table. Similarly, for the continuous cluster numbers 45 and 46, the starting cluster number is 45, and the number of continuous clusters is 2, so 45 and 2 are stored in the file index table.

[0077] In combination with Figure 4 ​For example, if the processor 110 reads the file A using the fast seek mode, when the processor 110 receives the instruction of reading the file A, the processor 110 can obtain the file index table based on the cluster chain table information of the file A and store the file index table in the cache of the processor 110. If the file pointer is offset during the reading process, the processor 110 can obtain the cluster where the target position is located based on the file index table in the cache.

[0078] It can be understood that, when the file system reads the file using the fast seek mode, the processor 110 needs to store the cluster chain table information of the file in the cache in advance, so that the time of the opening and initialization stage of the file is relatively long. In addition, since the cluster chain table information needs to be cached, a large amount of memory of the processor 110 is occupied.

[0079] Based on the above analysis process, the normal seek mode and the fast seek mode are compared, and the following analysis results can be obtained.

[0080] The normal seek mode does not need to cache the cluster chain table information, so that the time of the opening and initialization stage of the file is short, and the memory occupied is small, which is suitable for files with a large number of opening and closing times. However, when a large file is read, the clusters of the file are distributed in different positions of the storage space, and the frequent input / output operations between the processor 110 and the storage space in the cluster traversal process will consume a large amount of time in the file pointer offset process.

[0081] The fast seek mode needs to cache the cluster chain table information, so that the time of the opening and initialization stage of the file is long, and the memory space of the processor 110 needs to be occupied, which is not suitable for files with a large number of opening and closing times. However, since the target cluster can be quickly located when the pointer is offset, the frequent input / output operations are not needed in the file pointer offset process, so that the time consumed in reading a large file or a file with a large number of offsets is less.

[0082] On the other hand, the fast seek mode can cache the cluster chain table information in the opening and initialization stage of the file, and can be used during the opening of the file, so that the fast seek mode can also be applied to a file that is opened for a long time.

[0083] Therefore, it can be understood that the normal seek mode is suitable for reading a small file, or a file with a large number of opening and closing times, or a file with a small number of offsets. The fast seek mode is suitable for reading a large file, or a file that is opened for a long time, or a file with a large number of offsets.

[0084] Based on the above analysis process, it can be understood that the factors affecting the selection of the file pointer offset mode include: file size, file pointer offset difference, file pointer offset frequency, and / or file single opening duration.

[0085] wherein the file size refers to the total number of bytes of the file. The larger the file, the more clusters its data can be distributed in, resulting in more clusters to be traversed for file pointer offset operation. For smaller files, fewer clusters are traversed, and normal seek mode can be used for file pointer offset. For larger files, more clusters are traversed, and fast seek mode can significantly reduce the time of pointer offset.

[0086] For example, a smaller file such as a log file with a size of 10 KB, its data can be distributed in a small number of clusters, and normal seek mode can quickly complete pointer offset, but if fast seek mode is used, it will consume time during file opening and initialization stage, and its efficiency of reading the file can be less than that of using normal seek mode. A larger file such as a video file with a size of 2 GB, its data is distributed in a large number of clusters, and fast seek mode can quickly locate the target position, reducing the time of pointer offset.

[0087] The file pointer offset difference refers to the distance of the file pointer moving from the current position to the target position, which can be expressed in the number of bytes in the offset process. For smaller offset difference, fewer clusters are traversed, and normal seek mode can be used for file pointer offset. For larger offset difference, more clusters are traversed, and fast seek mode can significantly reduce the time of pointer offset.

[0088] For example, a file with a smaller offset difference, such as a text file, is offset from the beginning of the file to the position of a paragraph, and the offset difference is, for example, 2 KB. It can be understood that the offset difference of reading the text file is small, and normal seek mode can quickly complete pointer offset. A file with a larger offset difference, such as a video file, is offset from the beginning of the file to the middle of the movie, and the offset difference can be, for example, 1 GB. It can be understood that the offset difference of reading the video file is large, and fast seek mode can quickly locate the target position, reducing the time of pointer offset.

[0089] The file pointer offset frequency refers to the frequency of movement of the file pointer in the file, and can also be understood as the number of file pointer offset operations per unit time. For a file with a low offset frequency, the pointer offset operation is less, and the normal seek mode can be used for file pointer offset. For a file with a high offset frequency, the pointer offset operation is more, and the fast seek mode can reduce the time of each offset and improve the efficiency of reading the file.

[0090] For example, a file with a low offset frequency can be a configuration file of an application, which is read once when the application is started, and the offset frequency is low, so the normal seek mode can be used. The electronic device reads a file with a high offset frequency, for example, a video editing application reads a video software, and the pointer offset operation may need to be frequently performed during video editing, and the fast seek mode can significantly improve the file reading efficiency.

[0091] The single file opening duration can be used to indicate whether the file remains open for a long time during the running of the electronic device. For a long-term open file, the fast seek mode can cache the cluster chain table information during the file opening and initialization stage, and the cluster chain table information in the cache can be used during the file opening, reducing the time of pointer offset. For example, a database file remains open for a long time during the running of the system, and the use of the fast seek mode can significantly reduce the time of pointer offset, and can improve the efficiency of reading the file.

[0092] In an embodiment of the present application, a configuration file can be pre-installed in the electronic device, and the configuration file can include the file identifier of the file and the file pointer offset mode applicable thereto. The file system of the electronic device can determine the file pointer offset mode based on the configuration file when reading the file. The file identifier is a mark or information for uniquely identifying the file, and the file identifier can be a file name, etc.

[0093] In some scenarios, the configuration file can also be referred to as a whitelist. Optionally, the whitelist can be a fast seek whitelist, or the whitelist can also be a normal seek whitelist. It should be understood that if the whitelist is a fast seek whitelist, the fast seek whitelist can include a set of pre-defined file identifiers, and the files corresponding to these file identifiers are determined to use the fast seek mode for file pointer offset.

[0094] Correspondingly, if the whitelist is a normal seek whitelist, the normal seek whitelist can also include a set of pre-defined file identifiers, and the files corresponding to these file identifiers are determined to use the normal seek mode for file pointer offset.

[0095] In a possible implementation, the first configuration file can be preset in the electronic device.

[0096] Optionally, the first configuration file can be determined by the developer according to the usage of each file, by analyzing and evaluating the file pointer offset mode applicable to each file. For example, the usage of the file can be the frequency of reading the file by the user, the opening time, etc.

[0097] It should be understood that the electronic device can include files in various applications, such as social applications, text editing applications, video applications, etc. The usage of files can be different when used in different types of applications, for example, some files can be read frequently, and some files can be opened for a long time. For example, in a desktop application, there can be UI resource files such as icons or pictures that occupy a large amount of memory. When the user frequently switches to the desktop, the UI resource files of the desktop application will be repeatedly read, which can also be understood as a high frequency of file pointer offset of the UI resource files.

[0098] Therefore, the file pointer offset mode applicable to the files of different applications can be set based on the file size and in combination with the usage of the files. For example, the fast seek mode is used for file pointer offset of the UI resource files that are large and have a high frequency of file pointer offset.

[0099] Optionally, the first configuration file can also be used to determine the file pointer offset mode applicable to each file by the electronic device or the cloud server based on the usage information of the files. The usage information of the files can include the file size, the frequency of file pointer offset, the file pointer offset difference, and / or the file opening time, etc.

[0100] For example, after the electronic device or the cloud server obtains the file identifier and the corresponding file size, the frequency of file pointer offset, the file pointer offset difference, and / or the file opening time, etc., if the file size, the frequency of file pointer offset, the file pointer offset difference, and / or the file opening time of the file exceed the corresponding threshold values, respectively, it can be determined that the fast seek mode is applicable to the file pointer offset of the file.

[0101] Optionally, the two implementation methods described above can be used in combination. It should be understood that when the two methods are used to determine the file pointer offset mode, if the file pointer offset modes determined by the two methods are different, the file pointer offset mode determined by the first implementation method can be used preferentially, or the file pointer offset mode determined by the second implementation method can be used preferentially, and the embodiments of the present application are not limited.

[0102] It can be understood that, since the developers of various applications can be more familiar with the use of files by respective applications, the file pointer offset mode determined by the first implementation method can be more in line with the expectations of the developers, improve the running efficiency of the applications, and make the reading of files more reliable.

[0103] It can be understood that, since the use of files by various applications can be different, the file pointer offset mode determined based on the use information of the files in the actual application process of the electronic device can better reflect the use of the files in the actual application process. Therefore, the file pointer offset mode determined by the second implementation method can be more in line with the use of the files by the user, and the user experience can be improved.

[0104] In another possible implementation, the second configuration file can be pre-stored in the electronic device. The second configuration file can be generated based on a file operation table stored locally by the electronic device. The file operation table can store the mapping relationship between the file identifier of a file and the file size, the file pointer offset difference, the file pointer offset frequency, and / or the single opening duration of the file when the file was last read.

[0105] It should be understood that the file size, the file pointer offset difference, the file pointer offset frequency, and / or the single opening duration in the file operation table stored locally by the electronic device are updated in real time based on the actual use of the electronic device by the user, and the second configuration file generated based on the file operation table is also updated as the file operation table changes.

[0106] Optionally, the second configuration file can be loaded into the electronic device each time the electronic device is powered on, or according to a preset period.

[0107] Optionally, when reading a file, one of the first configuration file and the second configuration file can be used, or the first configuration file and the second configuration file can be used in combination to determine the file pointer offset mode.

[0108] When the first configuration file and the second configuration file are used in combination to determine the file pointer offset mode, if the file pointer offset modes determined by the two configuration files conflict, the file pointer offset mode determined by the first configuration file can be selected as the standard, or the file pointer offset mode determined by the second configuration file can be selected as the standard, and the embodiments of the present application are not limited.

[0109] It can be understood that the first configuration file is a file pointer offset mode determined by the developers based on the use of files by various applications, in combination with the use of files in different electronic devices and / or by different users in the actual application process.

[0110] Therefore, the file pointer offset mode determined according to the first configuration file is selected, which can be more suitable for the use requirement of the application, and can reduce the error adjustment of the file pointer offset mode due to the difference between the file reading by the user and the normal use, ensure the stability of the file pointer offset mode, and improve the user experience.

[0111] It can be understood that the second configuration file is the file pointer offset mode determined by the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of the file obtained by the electronic device when reading the file in the actual running process. Therefore, the file pointer offset mode determined according to the second configuration file is selected, which can update the file pointer offset mode in real time according to the actual use of the user, make the determination of the file pointer offset mode more flexible, accelerate the file reading efficiency, and improve the user experience.

[0112] For the convenience of understanding, the file pointer offset mode determined according to the first configuration file is selected as an example in combination with the second configuration file, and the first configuration file and the second configuration file are both fast seek white lists. The file reading method provided by the embodiments of the present application is introduced. It should be understood that if the file pointer offset mode determined according to the second configuration file is selected, or the first configuration file and / or the second configuration file is a fast seek white list or a normal seek white list, the implementation method is similar to the method used in the embodiments, which will not be described here. The process is introduced as follows.

[0113] Exemplarily, Figure 5 The flowchart of the file reading method 500 provided by the embodiments of the present application is shown. The method 500 can be executed by the file system of the electronic device, and the method 500 includes the following steps:

[0114] S501, in response to the instruction of the application program reading the target file, the file system initiates the task of reading the target file.

[0115] Exemplarily, the application program can call the file system in the like Figure 2 to instruct the file system to read the target file.

[0116] The application program can be various application programs in the application package in the embodiments. Figure 2 In the process of using the electronic device by the user, in response to the operation of the user on the electronic device, the application program initiates the task of reading the target file based on the user operation. The target file is a file that needs to be read by the application program, and the target file can be stored in the internal storage 121 of the electronic device.

[0117] Optionally, the operation of the user on the electronic device can include booting, starting the application program, or clicking the file reading button, etc.

[0118] For example, the operation of the user on the electronic device can be a boot operation, the application program can be a desktop application program, and the target file can be a UI resource file. After the boot operation of the user is triggered, during the booting process of the electronic device, the desktop application program needs to read the UI resource file to draw a user interface, and the desktop application program initiates a task of reading the UI resource file during the booting process, so that the desktop application program can load the UI resource file such as an icon or a picture on the user interface of the electronic device.

[0119] S502, the file system determines whether the file identifier of the target file exists in the first configuration file.

[0120] If the file identifier of the target file exists in the first configuration file, the file system performs S504, that is, it is determined that the file pointer offset mode of the target file is the fast seek mode.

[0121] If the file identifier of the target file does not exist in the first configuration file, the file system performs S503.

[0122] It can be understood that the first configuration file is a set of file identifiers that are set in advance, and the corresponding files of the file identifiers are determined to use the fast seek mode for file pointer offset in the development stage of the electronic device. It can also be understood that when the application program reads the files in the first configuration file, the fast seek mode is used for file pointer offset, and the reading speed is faster than that of the normal seek mode.

[0123] Therefore, if the file identifier of the target file that needs to be read by the application program exists in the first configuration file, it can be confirmed that the file pointer offset mode of the target file is the fast seek mode.

[0124] S503, the file system determines whether the file identifier of the target file exists in the second configuration file.

[0125] If the file identifier of the target file exists in the second configuration file, the file system performs S504, that is, it is determined that the file pointer offset mode of the target file is the fast seek mode.

[0126] If the file identifier of the target file does not exist in the second configuration file, the file system performs S505, that is, it is determined that the file pointer offset mode of the target file is the normal seek mode.

[0127] It should be understood that the use of the file can change constantly, and in order to adapt to the change of the use, the second configuration file can be updated in time based on the use information actually read by the electronic device. For example, the file using the fast seek mode can be determined based on the latest file size, file pointer offset difference, file pointer offset frequency and / or file single opening duration stored locally by the electronic device during the booting of the electronic device, or according to a preset period, so that the file system determines a more suitable file pointer offset mode.

[0128] S504, the file system determines that the file pointer offset mode of the target file is the fast seek mode.

[0129] It should be understood that based on the analysis result of the fast seek mode in the above, when reading the target file with large file size, or large file pointer offset difference, or high file pointer offset frequency, the fast seek mode can quickly locate the cluster where the target position is based on the cached cluster chain table information, saving the time consumed in the file pointer offset process.

[0130] And when reading the target file that is opened for a long time, using the fast seek mode can cache the cluster chain table information in advance in the opening and initialization stage of the file, and the cluster chain table information can be used during the opening of the file. Compared with the normal seek mode, it is more appropriate to use the fast seek mode to read the target file that is opened for a long time for file pointer offset.

[0131] S505, the file system determines that the file pointer offset mode of the target file is the normal seek mode.

[0132] Correspondingly, based on the analysis result of the normal seek mode in the above, when reading the target file with small file size, or small file offset times, or small file offset difference, using the normal seek mode for file pointer offset will not consume a lot of time. Therefore, the fast seek mode can not be used to reduce the time consumed in the opening or initialization stage of the target file.

[0133] And when reading the file with more switching times, since the normal seek mode does not need to cache the cluster chain table information in the opening or initialization stage of the file, it is more appropriate to use the normal seek mode for file pointer offset.

[0134] S506, the file system reads the target file and obtains the use information of the target file.

[0135] That is, the file system reads the target file based on the determined file pointer offset mode, and acquires the file size, file pointer offset difference, file pointer offset frequency and / or file single opening duration of the target file in the process of reading the file.

[0136] Illustratively, if the determined file pointer offset mode is the normal seek mode, the file system can sequentially call the open file interface, the read / write file interface and the close file interface to operate on the target file, so as to complete the task of reading the target file by the application program.

[0137] Alternatively, if the determined file pointer offset mode is the fast seek mode, the file system can sequentially call the open file interface, the cluster chain table interface, the read / write file interface and the close file interface to operate on the target file, so as to complete the task of reading the target file by the application program.

[0138] It should be understood that in order to update the second configuration file, the file system can acquire the latest file size, file pointer offset difference, file pointer offset frequency and / or file single opening duration of the target file. Therefore, after the file system reads the target file based on the determined file pointer offset mode, the file size, file pointer offset difference, file pointer offset frequency and / or file single opening duration of the current reading target file can be acquired as usage information for subsequent updating of the second configuration file.

[0139] Optionally, the file system can acquire the file size, file pointer offset difference, file pointer offset frequency and / or file single opening duration of the target file by creating a timer that constantly triggers an interrupt. The specific process is as follows.

[0140] S1, initialize a timer object in the file system, and set the trigger interval time of the timer. For example, trigger once per second.

[0141] S2, when the timer triggers an interrupt, an interrupt function can be called to acquire the file size, file pointer offset difference, file pointer offset frequency and / or file single opening duration of the target file.

[0142] Optionally, the interrupt function for acquiring the file size can acquire the file size of the target file by calling the open file interface of the file system. It should be noted that the file size can be acquired once when the file is opened.

[0143] Optionally, the interrupt function for acquiring the file pointer offset difference can record the current file pointer position before each file pointer movement. After the file pointer moves, the position of the moved file pointer is recorded, and then the byte difference between the current position and the target position is calculated, which is the file pointer offset difference.

[0144] Optionally, the interrupt function for obtaining the file pointer offset frequency can obtain the file pointer offset frequency by counting the number of file pointer offset operations in a certain time window. The number of file pointer offset operations can be obtained by a counter, and the value of the counter is increased by one each time the file pointer is offset.

[0145] Optionally, the interrupt function for obtaining the single file opening duration can record the opening timestamp when the file is opened and record the closing timestamp when the file is closed. The single file opening duration is obtained by calculating the difference between the closing timestamp and the opening timestamp.

[0146] It can be understood that S501 to S505 are used to determine the file pointer offset mode of the target file in this reading, and S506 to S509 are used to update the file operation table in the local storage, so that the file size, file pointer offset difference, file pointer offset frequency and / or single file opening duration in the second configuration file are the latest reading target file usage information when the second configuration file is loaded next time.

[0147] Therefore, in this embodiment, S501 to S505 can be executed separately to determine the file pointer offset mode of the target file without relying on the execution of S506 to S509; or S501 to S505 can be used in combination with S506 to S509 to more comprehensively confirm the file pointer offset mode of the target file.

[0148] If S501 to S505 and S506 to S509 are used in combination, S501 to S505 and S506 to S509 can be executed in sequence or in parallel, that is, the execution process of S501 to S505 and the execution process of S506 to S509 are not distinguished by execution order, thereby improving the efficiency and accuracy of determining the file pointer offset mode.

[0149] S507, after the target file reading is completed, the file system determines whether to add the file identifier of the target file to the second configuration file.

[0150] If the file size of the target file is greater than or equal to the threshold A, the file pointer offset difference is greater than or equal to the threshold B, the file pointer offset frequency is greater than or equal to the threshold C, and the single file opening duration is greater than or equal to the threshold D, the file system executes S508, that is, the file system adds the file identifier of the target file to the second configuration file.

[0151] If the file size of the target file is less than the threshold A, the file pointer offset difference is less than the threshold B, the file pointer offset frequency is less than the threshold C, or the single file opening duration is less than the threshold D, the file system executes S509.

[0152] The threshold value A, the threshold value B, the threshold value C and the threshold value D can be preset values. For example, the threshold value A can be 30 MB, the threshold value B can be 5 MB, the threshold value C can be 10,000 times per day, and the threshold value D can be 30 minutes per time. The specific values of the threshold value A, the threshold value B, the threshold value C and the threshold value D can be set according to actual conditions, and the embodiments of the present application are not limited.

[0153] It can be understood that if the file size of the target file is greater than or equal to the threshold value A, the file pointer offset difference is greater than or equal to the threshold value B, the file pointer offset frequency is greater than or equal to the threshold value C, and the file single opening duration is greater than or equal to the threshold value D, the target file is suitable for using the fast seek mode for file pointer offset, and the file identifier of the target file is added to the second configuration file, so that the file pointer offset mode of the target file can be quickly determined as the fast seek mode when the target file is read next time.

[0154] It should be understood that if the file identifier of the target file exists in the original second configuration file, the file identifier of the target file can not be added to the second configuration file, so as to prevent the file identifier of the duplicate target file from appearing in the second configuration file.

[0155] In another implementation, when determining whether to add the file identifier of the target file to the second configuration file, the proportion of the actual offset amount of the file pointer to the required offset amount during the file pointer offset process can also be used for judgment.

[0156] For example, if the task of reading a file is a task of reading a video initiated by a video player, the cluster chain corresponding to the video is cluster chain A in the cluster chain in the video. During video playback, there can be a case of user playback of the video, in which case the file pointer can need to be offset from a later position in the cluster chain to an earlier position in the cluster chain. Figure 3

[0157] For example, the file pointer needs to be offset from the cluster with the cluster number 4 to the cluster with the cluster number 3. However, since the normal seek mode is used for file pointer offset, that is, the file pointer can only be offset in the order of the cluster chain from front to back. It can be understood that if the normal seek mode is used for file pointer offset, the actual offset process of the file pointer is from the cluster number 4, 45, 46, 1, 2, 3 in turn.

[0158] ​It can be understood that if the file pointer offset is performed using the normal seek mode, the actual file pointer offset and / or the required file pointer offset are greatly different. For such files, the fast seek mode can be used to perform the file pointer offset. That is, when the file pointer offset is performed using the normal seek mode, the ratio of the actual file pointer offset and the required file pointer offset during the file pointer offset process can be recorded, and if the ratio of the actual file pointer offset and the required file pointer offset is greater than or equal to a threshold E, the identifier of the file is added to the second configuration file.

[0159] wherein the threshold E is a preset value. Exemplarily, the threshold E can be that the ratio of the actual file pointer offset and the required file pointer offset is 100:1. For example, if the ratio of the actual file pointer offset and the required file pointer offset is 101:1 during the file pointer offset process, the identifier of the file is added to the second configuration file.

[0160] It can be understood that in actual operation, the file pointer offset mode can be determined based on one or more of the arrangement combinations of the file size, the file pointer offset difference, the file pointer offset frequency, the file single opening duration, and / or the ratio of the actual file pointer offset and the required file pointer offset.

[0161] S508, the file system adds the file identifier of the target file to the second configuration file.

[0162] S509, the file system updates the file operation table.

[0163] wherein the file operation table stores the mapping relationship of the file identifier, the file size, the file pointer offset difference, the file pointer offset frequency, and / or the file single opening duration.

[0164] As mentioned above, the second configuration file can be generated and loaded into the file system based on the locally stored file operation table during the booting process of the electronic device or according to a preset period. It can be understood that in order to realize that the file pointer offset mode stored in the second configuration file loaded each time is determined based on the latest file size, file pointer offset difference, file pointer offset frequency, and / or file single opening duration, the file operation table stored in the local storage space needs to be updated with the user's usage.

[0165] Therefore, after the reading of the target file ends, the file system can update the file operation table based on the file size, the file pointer offset difference, the file pointer offset frequency, and / or the file single opening duration of the target file read at this time.

[0166] Optionally, in order to reduce the input / output operations between the file system and the local storage in the process of updating the file operation table, and reduce the running efficiency of the file system due to frequent input / output operations, the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of the target file in this reading can be written into the cache, and the file operation table in the local storage can be updated based on the file identifier and the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration in the cache when the electronic device is idle or according to a preset period.

[0167] In order to facilitate understanding, the process of updating the file operation table is introduced below.

[0168] As shown in Figure 6 , when the system of the electronic device is running, the file system can determine whether the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of the file all exceed the respective corresponding thresholds, and the currently used file pointer offset mode is the normal seek mode.

[0169] If the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of the file all exceed the respective corresponding thresholds, it can be understood that the file is suitable for the fast seek mode, but the currently used file pointer offset mode is the normal seek mode, and it can be understood that the data in the file operation table corresponding to the file needs to be updated, so that the fast seek mode can be used when the file is read next time.

[0170] If it is determined that the data in the file operation table corresponding to the file needs to be updated, the mapping relationship of the file identifier, the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of the file is stored in the file operation intermediate table in the cache, and the file operation table in the local storage is updated based on the mapping relationship of the file identifier, the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of the file in the file operation intermediate table when the electronic device is idle.

[0171] Optionally, whether the electronic device is idle can be determined according to the usage rate of the processor and / or the memory usage rate of the electronic device, which is not limited here.

[0172] In some embodiments, there can be a situation that the memory space of the electronic device is insufficient, in which case, the fast seek mode can be selected for part of the files. For example, for the files with the file identifier in the second configuration file, the file system can obtain the target file that most needs to use the fast seek mode by combining the respective corresponding weights of the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration.

[0173] Optionally, for the plurality of files meeting the second configuration file, the file system acquires the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration of each file in the file operation table, and the respective corresponding weights, and acquires the fast seek score of each file.

[0174] Exemplarily, the respective corresponding weights of the file size, the file pointer offset difference, the file pointer offset frequency and / or the file single opening duration can be preset values. For example, the weight of the file size is 40%, the weight of the file pointer offset difference is 20%, the weight of the file pointer offset frequency is 20%, and the weight of the file single opening duration is 20%. The specific weight value can be set by the electronic device according to the actual situation, and the embodiment of the present application is not limited.

[0175] Further, the file system sorts the fast seek scores of all files in descending order based on the fast seek score of each file, determines that the file pointer offset mode of the file corresponding to the fast seek score in the top pre-set number of ranks is the fast seek mode, and updates the second configuration file.

[0176] Figure 7 A file reading method of an embodiment of the present application is shown. The method comprises:

[0177] S701, in the case where the target parameter of the target file meets the first condition, reading the target file by using the first pointer offset mode.

[0178] S702, in the case where the target parameter of the target file does not meet the first condition, reading the target file by using the second pointer offset mode.

[0179] Compared with the second pointer offset mode, the first pointer offset mode has the following characteristics: long time to open the file, large memory occupation and fast reading speed. The target parameter includes one or more of the following: size of the target file, pointer offset amount of the target file, offset frequency of the target file, and usage frequency of the target file.

[0180] In the embodiment of the present application, the target file can be any file in the electronic device, or it can also refer to the description of the target file in the foregoing, which will not be repeated here. Exemplarily, the target file can be a font file, a UI resource file, a configuration file, a log file, etc.

[0181] The target parameter is used to indicate the usage information when the file system reads the target file. The size of the target file can be used to indicate the total number of bytes of the target file. The pointer offset of the target file can be used to indicate the distance that the file pointer moves from the current position to the target position when the target file is read. The description of the file pointer offset difference in the foregoing can be referred to.

[0182] The offset frequency of the target file can be used to indicate the moving frequency of the file pointer in the file when the target file is read. The description of the file pointer offset frequency in the foregoing can be referred to. The usage frequency of the target file can be used to indicate the number of times of opening in a unit time when the electronic device reads the target file. It can also be understood as the file single opening duration in the foregoing. The longer the file single opening duration is, the higher the usage frequency is. The description of the file single opening duration in the foregoing can be referred to, and details are not described herein.

[0183] The first pointer offset manner can refer to the fast seek manner in the foregoing. The second pointer offset manner can refer to the normal seek manner in the foregoing. It should be noted that in the embodiments of the present application, the first pointer offset manner, for example, the fast seek manner, can significantly improve the reading speed when reading a target file that is large in size, or is long in opening, or has a large number of offset times. The second pointer offset manner, for example, the normal seek manner, has a faster reading speed when reading a target file that is small in size, or has a large number of opening and closing times, or has a small number of offset times.

[0184] The first condition can be used to determine whether the first pointer offset manner is used to read the target file. For example, the description of the first condition in the embodiments of the present application can be referred to. Figure 5 The first condition can be used to determine whether the first pointer offset manner is used to read the target file. For example, the description of the first condition in the embodiments of the present application can be referred to.

[0185] In the embodiments of the present application, one or more of the file size of the target file, the file pointer offset size, the file pointer offset frequency, and / or the file single opening duration are used to determine the file pointer offset manner when the target file is read. In this way, the file system can select a suitable file reading manner according to the actual situation of each file, can reduce the occupation of the memory of the electronic device, and can read the file content faster, thereby improving the efficiency of reading the file and enhancing the user experience.

[0186] Optionally, in the embodiments of the present application, Figure 7On the basis of the corresponding embodiment, the first condition comprises one or more of the following: the size of the target file is greater than or equal to a first threshold value, the pointer offset of the target file is greater than or equal to a second threshold value, the offset frequency of the target file is greater than or equal to a third threshold value, and the use frequency of the target file is greater than or equal to a fourth threshold value.

[0187] The first threshold value can be understood as a threshold value for judging the size of the target file, or can be Figure 3 The threshold value A in the corresponding embodiment. For example, the first threshold value can be 30MB. Correspondingly, the second threshold value can be understood as a threshold value for judging the pointer offset, or can be Figure 3 The threshold value B in the corresponding embodiment. For example, the second threshold value can be 5MB. The third threshold value can be understood as a threshold value for judging the offset frequency of the target file, or can be Figure 3 The threshold value C in the corresponding embodiment. For example, the third threshold value can be 10,000 times / day. The fourth threshold value can be understood as a threshold value for judging the use frequency of the target file, or can be Figure 3 The threshold value D in the corresponding embodiment. For example, the first threshold value can be 30 minutes / time.

[0188] In the embodiment of the application, the first condition can be that the target file simultaneously satisfies the size of the target file being greater than or equal to the first threshold value, the pointer offset of the target file being greater than or equal to the second threshold value, the offset frequency of the target file being greater than or equal to the third threshold value, and the use frequency of the target file being greater than or equal to the fourth threshold value, or can be a combination of any one or more of the target file satisfying the size of the target file being greater than or equal to the first threshold value, the pointer offset of the target file being greater than or equal to the second threshold value, the offset frequency of the target file being greater than or equal to the third threshold value, and the use frequency of the target file being greater than or equal to the fourth threshold value. Herein, no limitation is made.

[0189] In the embodiment of the application, when the electronic device determines that the target file satisfies the first condition, it can be understood that the fast seek mode is more appropriate when reading the target file, which can improve the efficiency of reading the file and thus improve the user experience.

[0190] Optionally, in the Figure 7 On the basis of the corresponding embodiment, the electronic device is configured with a first configuration file, and the target file is read in the first pointer offset mode in a case where the target parameter of the target file satisfies the first condition, comprising: in a case where the first configuration file includes the identifier of the target file, the target file is read in the first pointer offset mode; wherein the first configuration file includes the identifiers of L files, the target parameters of the L files each satisfy the first condition, the L files include the target file, L is a positive integer, and the first configuration file is fixedly set.

[0191] The first configuration file can include an identifier of the target file, or the first configuration file can include the identifier of the target file and a corresponding file pointer offset mode, where the file pointer offset mode can be a first pointer offset mode or a second pointer offset mode. The identifier of the target file can be a tag or information that uniquely identifies the target file, for example, the identifier can be a file name or a file path, etc.

[0192] Optionally, the first configuration file can be determined by the developer based on the use of each file, by analyzing and evaluating the file pointer offset mode suitable for each file, where the use of the file can be, for example, the frequency of reading the file by the user, the opening time, etc.

[0193] Alternatively, the first configuration file can be determined by the electronic device or the cloud server to count the use information of the file, and the file pointer offset mode suitable for each file. Wherein, the use information of the file can include file size, file pointer offset frequency, file pointer offset difference and / or file single opening duration, etc.

[0194] After determining the first configuration file based on the above two methods, the first configuration file can be pre-set in the electronic device, for example, the first configuration file is stored in the storage space of the electronic device.

[0195] In the embodiments of the present application, by pre-setting the first configuration file in the electronic device, and determining to use the first pointer offset mode or the second pointer offset mode to read the target file based on the first configuration file when reading the file, the use demand of the file is better met, thereby improving the efficiency of reading the file and improving the user experience.

[0196] Optionally, in Figure 7 Based on the corresponding embodiments, the electronic device is configured with a second configuration file, and in a case where the target parameter of the target file meets the first condition, the first pointer offset mode is used to read the target file, including: in a case where the second configuration file includes the identifier of the target file, the first pointer offset mode is used to read the target file; wherein the second configuration file includes identifiers of M files, the target parameters of the M files each meet the first condition, the M files include the target file, M is a positive integer, and the second configuration file is updated by the electronic device at a preset time.

[0197] Similar to the first configuration file, the second configuration file can also include the identifier of the target file, or the second configuration file can also include the identifier of the target file and the corresponding file pointer offset mode, which is not limited here.

[0198] Optionally, the second configuration file can be updated based on a size of the target file recorded when the electronic device last reads the target file, a pointer offset of the target file, a frequency of offset of the target file, and a frequency of use of the target file.

[0199] Optionally, the preset timing can be a period of counting the target parameters, can be a preset period, or can be updated when the electronic device is powered on or when the electronic device is idle, which is not limited here.

[0200] Optionally, whether the electronic device is idle can be determined according to an index such as a usage rate of a processor of the electronic device and / or a memory usage rate.

[0201] It should be understood that, due to the difference in the determination manners of the first configuration file and the second configuration file, the identification of the L files in the first configuration file and the identification of the M files in the second configuration file can be the same or different, and the value of L and the value of M can be the same or different.

[0202] It should be understood that, when the first configuration file is not pre-installed in the electronic device, the first pointer offset manner or the second pointer offset manner can be determined based on the second configuration file to read the target file. It can be understood that, based on the second configuration file to determine the first pointer offset manner or the second pointer offset manner to read the target file, the user's demand can be better met, that is, the second configuration file can dynamically adjust the file pointer offset manner according to the actual use of the user, has higher flexibility, speeds up the file reading efficiency, and improves the user experience.

[0203] Optionally, if the first configuration file and the second configuration file are configured in the electronic device, when reading the file, one of the first configuration file and the second configuration file can be used, or the first configuration file and the second configuration file can be used in combination to determine the file pointer offset manner.

[0204] When the first configuration file and the second configuration file are used in combination to determine the file pointer offset manner, if the file pointer offset manners determined by the two kinds of configuration files conflict, the file pointer offset manner determined by the first configuration file can be selected as the standard, or the file pointer offset manner determined by the second configuration file can be selected as the standard, which is not limited by the embodiments of the present application.

[0205] In the embodiments of the present application, by pre-installing the second configuration file in the electronic device, and based on the second configuration file to determine the first pointer offset manner or the second pointer offset manner to read the target file when reading the file, or the first configuration file and the second configuration file can be used in combination to determine the first pointer offset manner or the second pointer offset manner to read the target file, the user's demand can be better met, so as to improve the efficiency of reading the file and improve the user experience.

[0206] Optionally, before the electronic device updates the second configuration file, the method further includes: counting target parameters of N files respectively, N being a positive integer; and updating the second configuration file includes: in a case where target parameters of P files meet the first condition, updating the second configuration file, wherein P is a positive integer, P files are included in the N files, and the second configuration file includes identifiers of the P files, and the P files are different from the M files. Figure 7 Based on the corresponding embodiment, before the electronic device updates the second configuration file, the method further includes: counting target parameters of N files respectively, N being a positive integer; and updating the second configuration file includes: in a case where target parameters of P files meet the first condition, updating the second configuration file, wherein P is a positive integer, P files are included in the N files, and the second configuration file includes identifiers of the P files, and the P files are different from the M files.

[0207] It should be understood that the second configuration file is generated based on the size of the latest file, the pointer offset of the file, the offset frequency of the file and / or the use frequency of the file, and therefore, before the second configuration file is updated, the target parameters of the files of the electronic device also need to be counted.

[0208] The N files can be any N files in the electronic device. Before the second configuration file is updated, the target parameters of the N files can be counted, and if it is determined that target parameters of P files in the N files meet the first condition, it is determined that the P files are more suitable for using the first pointer offset mode for file pointer offset. Therefore, the identifiers of the M files originally stored in the second configuration file need to be updated to identifiers of the P files.

[0209] It can be understood that the use of the files in the electronic device by the user can change, for example, when the second configuration file is updated last time, the file u is suitable for using the second pointer offset mode for pointer offset, and when the update is performed this time, it is determined that the target parameter of the file u does not meet the first condition, and therefore, the identifier of the P files updated this time does not include the file u. Therefore, it can be understood that the identifiers of the P files and the M files can be the same or different, and the values of P and M can be the same or different.

[0210] In the embodiments of the present application, before the electronic device updates the second configuration file, the target parameters of N files are counted, and in a case where P files in the N files meet the first condition, the second configuration file is updated according to the identifiers of the P files, so that the second configuration file can dynamically adjust the pointer offset mode based on the actual use of the user, has higher flexibility, and improves the user experience.

[0211] Optionally, before the electronic device updates the second configuration file, the method further includes: counting target parameters of N files respectively, N being a positive integer; and updating the second configuration file includes: in a case where target parameters of P files meet the first condition, updating the second configuration file, wherein P is a positive integer, P files are included in the N files, and the second configuration file includes identifiers of the P files, and the P files are different from the M files. Figure 7 Based on the corresponding embodiment, before the electronic device updates the second configuration file, the method further includes: counting target parameters of N files respectively, N being a positive integer; and updating the second configuration file includes: in a case where target parameters of P files meet the first condition, updating the second configuration file, wherein P is a positive integer, P files are included in the N files, and the second configuration file includes identifiers of the P files, and the P files are different from the M files.

[0212] In a case where the target parameter of the target file meets the first condition, the target file is read by using the first pointer offset mode, including: in a case where the target file is within a preset ranking range, the target file is read by using the first pointer offset mode.

[0213] In the embodiments of the present application, there can be a case where the memory space of the electronic device is insufficient, in which case, before reading the target file, part of the files in the target file can be read by using the first pointer offset mode to save the memory of the electronic device.

[0214] It can be understood that the ranking position in the one or more file rankings can be used to indicate the degree of need for the target file to use the first pointer offset mode. Alternatively, the higher the degree of need, the higher the ranking position; or, the lower the degree of need, the lower the ranking position. Here, no limitation is made.

[0215] For example, after ranking the one or more files, the target file within the preset ranking range can be selected to use the first pointer offset mode. If the one or more file rankings are that the higher the degree of need, the higher the ranking position, the preset ranking range can be the target files ranked in the first preset number of positions, for example, the first 3 target files in the file ranking.

[0216] The method provided in the embodiments of the present application can select the file ranked in the preset range to use the first pointer offset mode in the case where the memory space of the electronic device is insufficient, reduce the case where the file reading fails due to too high memory occupation when reading the file, and improve the stability of the file system.

[0217] Optionally, in a case where the target parameter of the target file meets the first condition, the target file is read by using the first pointer offset mode, including: in a case where the target file is within a preset ranking range, the target file is read by using the first pointer offset mode. Figure 7 Based on the corresponding embodiments, based on the target parameter being one or more file rankings, including: summing up the calculation results of each parameter in the target parameter and sorting to obtain one or more file rankings; wherein the calculation results of each parameter include one or more of the following: the product of the size of the file and the first weight, the product of the pointer offset of the file and the second weight, the product of the offset frequency of the file and the third weight, and the product of the use frequency of the file and the fourth weight.

[0218] The first weight corresponds to the weight of the size of the file, for example, the first weight can be 40%; similarly, the second weight corresponds to the weight of the pointer offset of the file, for example, the second weight can be 20%; the third weight corresponds to the weight of the offset frequency of the file, for example, the third weight can be 20%; and the fourth weight corresponds to the weight of the use frequency of the file, for example, the fourth weight can be 20%. It should be understood that the specific values of the weights can be set by the electronic device according to the actual situation, and the embodiments of the present application do not make any limitation.

[0219] In the embodiments of the present application, the target parameters of the files and their respective corresponding weights are summed, multiple parameters such as file size, pointer offset, offset frequency and use frequency are comprehensively considered, and based on the respective corresponding weights, a file more suitable for the first pointer offset mode is selected from one or more target files, thereby improving the stability of the file system of the electronic device.

[0220] Optionally, in Figure 7 Based on the corresponding embodiments, the first pointer offset mode includes a fast seek mode, and the second pointer offset mode includes a normal seek mode.

[0221] The fast seek mode can refer to the description of the fast seek mode in the embodiments. Figure 4 The normal seek mode can refer to the description of the normal seek mode in the embodiments. Figure 4 The normal seek mode can refer to the description of the normal seek mode in the embodiments.

[0222] In the embodiments of the present application, for the target file, the pointer offset mode more suitable for the target file is selected from the fast seek mode and the normal seek mode, which can significantly improve the efficiency of the file system in reading the file and improve the user experience.

[0223] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.

[0224] The above mainly introduces the scheme provided by the embodiments of the present application from the method aspect. In order to realize the above functions, it contains the hardware structure and / or software module corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the method steps of each example described in the embodiments disclosed in the present text, the present application can be realized in the form of hardware or combination of hardware and computer software. Whether a certain function is executed by hardware or computer software driven hardware depends on the specific application and design constraints of the technical scheme. Professional technicians can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0225] The embodiments of the present application can divide the functions of the device implementing the method according to the above method examples into function modules. For example, each function module can be divided according to each function, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware or in the form of a software function module. It should be noted that the division of the modules in the embodiments of the present application is illustrative, and is only a logical function division. In actual implementation, another division manner can be used.

[0226] As Figure 8 Fig. 8 shows a structure diagram of a chip provided by the embodiments of the present application. The chip 800 includes one or more (including two) processors 801, a communication line 802, a communication interface 803 and a memory 804.

[0227] In some embodiments, the memory 804 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.

[0228] The method described in the embodiments of the present application can be applied to the processor 801 or implemented by the processor 801. The processor 801 can be an integrated circuit chip having a processing capability. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware or the instruction of software form in the processor 801. The processor 801 described above can be a general processor (for example, a microprocessor or a conventional processor), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, a discrete gate or transistor logic device, or a discrete hardware component, the processor 801 can implement or execute the disclosed processing-related methods, steps and logic block diagrams in the embodiments of the present application.

[0229] The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art, such as a random access memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable read-only memory (EEPROM). The storage medium is located in the memory 804, and the processor 801 reads the information in the memory 804 and combines the hardware to complete the steps of the above method.

[0230] The processor 801, the memory 804 and the communication interface 803 can communicate through the communication line 802.

[0231] In the above embodiments, the instructions stored in the memory for the processor to execute can be implemented in the form of a computer program product. The computer program product can be written in the memory in advance, or downloaded and installed in the memory in the form of software.

[0232] The embodiments of the present application also provide a computer program product including one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another, for example, the computer instructions can be transmitted from the site of one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL) or wireless (such as infrared, wireless, microwave, etc.)) way. The computer-readable storage medium can be any available medium that the computer can store or the data storage device such as server, data center, etc. integrated with one or more available media sets. For example, the available media can include magnetic media (such as floppy disk, hard disk or magnetic tape), optical media (such as digital versatile disc (DVD)), or semiconductor media (such as solid state disk (SSD)) and the like.

[0233] The embodiments of the present application also provide a computer-readable storage medium. The methods described in the above embodiments can be implemented all or partially by software, hardware, firmware or any combination thereof. The computer-readable medium can include computer storage medium and communication medium, and can also include any medium that can transfer computer programs from one place to another. The storage medium can be any target medium that can be accessed by a computer.

[0234] As a possible design, the computer readable medium can include a compact disc read-only memory (CD-ROM), a RAM, a ROM, an EEPROM, or other optical disk storage; the computer readable medium can include a magnetic disk storage or other magnetic disk storage device. Moreover, any connection line can also be properly referred to as a computer readable medium. For example, if software is transmitted from a website, a server, or other remote source using a coaxial cable, an optical fiber cable, a twisted pair, a DSL, or wireless technology (such as infrared, radio, and microwave), the coaxial cable, the optical fiber cable, the twisted pair, the DSL, or the wireless technology (such as infrared, radio, and microwave) is included in the definition of the medium. As used herein, a disk and a disc include a compact disc (CD), a laser disc, an optical disc, a digital versatile disc (DVD), a floppy disk, and a Blu-ray disc, where a disk usually reproduces data magnetically, while a disc reproduces data optically with a laser.

[0235] Embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as a combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the computer or other programmable data processing apparatus produce a device that implements the functions specified in the flowcharts and / or block diagrams. Figure 1 The functions specified in a flow or multiple flows and / or blocks Figure 1 The functions specified in a flow or multiple flows and / or blocks

Claims

1. A file reading method characterized by, The method is applied to an electronic device, and the method comprises: In a case where a target parameter of a target file meets a first condition, reading the target file by using a first pointer offset mode; In a case where the target parameter of the target file does not meet the first condition, reading the target file by using a second pointer offset mode; Compared with the second pointer offset mode, the first pointer offset mode has the following characteristics: long time for opening a file, large memory occupation, and fast reading speed, and the target parameter comprises one or more of the following: size of the target file, pointer offset amount of the target file, offset frequency of the target file, and usage frequency of the target file.

2. The method of claim 1, wherein, The first condition comprises one or more of the following: the size of the target file is greater than or equal to a first threshold value, the pointer offset amount of the target file is greater than or equal to a second threshold value, the offset frequency of the target file is greater than or equal to a third threshold value, and the usage frequency of the target file is greater than or equal to a fourth threshold value.

3. The method according to claim 1 or 2, characterized in that, The electronic device is configured with a first configuration file, and the reading of the target file by using the first pointer offset mode in the case where the target parameter of the target file meets the first condition comprises: In a case where the first configuration file comprises an identifier of the target file, the target file is read by using the first pointer offset mode; wherein the first configuration file comprises identifiers of L files, the target parameters of the L files each meet the first condition, the L files comprise the target file, L is a positive integer, and the first configuration file is fixedly set.

4. The method of any one of claim 3, characterized in that, The electronic device is configured with a second configuration file, and the reading of the target file by using the first pointer offset mode in the case where the target parameter of the target file meets the first condition comprises: In a case where the second configuration file comprises an identifier of the target file, the target file is read by using the first pointer offset mode; wherein the second configuration file comprises identifiers of M files, the target parameters of the M files each meet the first condition, the M files comprise the target file, M is a positive integer, and the second configuration file is updated by the electronic device at a preset time.

5. The method of claim 4, wherein, Before the electronic device updates the second configuration file, the method further comprises: Statistics of target parameters of N files, N being a positive integer; The updating of the second configuration file by the electronic device comprises: In a case where target parameters of P files meet the first condition, the second configuration file is updated by the electronic device, wherein P is a positive integer, the P files are included in the N files, identifiers of the P files are included in the second configuration file, and the P files are different from the M files.

6. The method of claim 1, wherein, Before the reading of the target file by using the first pointer offset mode, the method further comprises: Statistics of target parameters of one or more files, the one or more files comprising the target file; Ranking of the one or more files based on the target parameters; and Reading of the target file by using the first pointer offset mode. The first pointer offset mode includes a fast seek mode, and the second pointer offset mode includes a normal seek mode. The electronic device includes one or more processors and a memory; 7. The method of claim 6, wherein, The memory is coupled to the one or more processors, and the memory is configured to store computer program codes including computer instructions, and the one or more processors are configured to invoke the computer instructions to cause the electronic device to perform the method according to any one of claims 1-8. The chip system is applied to an electronic device, and the chip system includes one or more processors configured to invoke computer instructions to cause the electronic device to perform the method according to any one of claims 1-8. The computer readable storage medium includes computer instructions configured to cause an electronic device to perform the method according to any one of claims 1-8 when the computer instructions are run on the electronic device.

8. The method according to any one of claims 1-2, 4-7, characterized in that, The computer program product includes computer program codes configured to cause an electronic device to perform the method according to any one of claims 1-8 when the computer program codes are run on the electronic device.

9. An electronic device, comprising: ​ ​ 10. A chip system, characterized by ​ 11. A computer readable storage medium characterized by, ​ 12. A computer program product, characterised in that, ​

Citation Information

Patent Citations

  • Storage system, file storage and reading method and terminal equipment

    CN111506262A

  • Data operation method and device, computer equipment, and storage medium

    CN113821458A