File read/write method

文档序号:1741664 发布日期:2019-11-26 浏览:21次 中文

阅读说明:本技术 文件读写方法 (File read/write method ) 是由 双小川 关宁 滕树鹏 刘攀 田文波 邱源 王茂森 白亮 韦杰 于 2019-08-28 设计创作,主要内容包括:本发明提供了一种文件读写方法,本发明针对嵌入式操作系统,利用SSD的控制器和DMA功能,使用操作系统信号量和循环缓冲区资源,提出了一种提高星载嵌入式系统读写文件速度的方法,以期解决目前星载计算机系统读写文件速度受制于单个SSD控制器的DMA速度,进而提高星载计算机系统IO性能。本发明为持续大量的读写操作提供支持,发挥操作系统信号量、调度算法优势,降低星载嵌入式系统的处理器使用。本发明针对星载嵌入式系统,能够有效提高SSD读写速度,对于实现数据的高速访问和存储提供保证。(The present invention provides a kind of file read/write methods, the present invention is directed to embedded OS, utilize the controller and DMA function of SSD, use operating system semaphore and circular buffering area resource, propose a kind of method for improving spaceborne embedded system reading and writing of files speed, to solve the DMA speed that current board computer system reading and writing of files speed is limited by single SSD controller, and then improve board computer system IO performance.The present invention provides support to continue a large amount of read-write operation, plays operating system semaphore, dispatching algorithm advantage, and the processor for reducing spaceborne embedded system uses.The present invention is directed to spaceborne embedded system, can effectively improve SSD read or write speed, provides guarantee for the high speed access and storage of realizing data.)

1. a kind of file read/write method characterized by comprising

Step S1, for current spaceborne embedded system carry SSD, wherein according to the multiple SSD of speed index carry, guarantee reading There are multiple SSD when write operation, provide the controller of the SSD;

Step S2 creates read/write function for each SSD, and what the read/write function operated is the virtual address of each SSD, wherein Function is write in the read/write function, the data for realizing the segmentation memory of spaceborne embedded system are removed by controller DMA It moves in SSD;Reading function in the read/write function is moved by controller DMA to spaceborne embedding for realizing the data in SSD The segmentation memory of embedded system;

Step S3, while the corresponding controller DMA of controller for starting each SSD write function by described in write operation, The data-moving of the segmentation memory is carried to the data in SSD by the reading function into SSD, or in read operation In the segmentation memory, wherein the size of the segmentation memory is equal to size of data/SSD of the memory of spaceborne embedded system Number, it is described segmentation memory offset address be spaceborne embedded system memory data move base address sovolin before control The size of memory is segmented described in the * of device position;

Step S4 waits the controller DMA of all SSD controllers to terminate;

Step S5 is repeated cyclically step S3 and step S4 according to read-write demand.

2. file read/write method as described in claim 1, which is characterized in that the controller of the SSD is two or more.

3. file read/write method as described in claim 1, which is characterized in that wait the controller DMA of all SSD controllers Terminate, comprising:

For read or write, the end variable of a controller DMA is introduced for each controller, when all controller DMA are complete Cheng Hou, primary read-write are just completed.

4. file read/write method as claimed in claim 3, which is characterized in that be directed to read or write, draw for each controller Into the end variable of a controller DMA, after the completion of all controller DMA, primary read-write is just completed, comprising:

The end variable that read-write is completed, after the completion of all controller DMA, complement mark ability set are introduced for each SSD.

5. file read/write method as described in claim 1, which is characterized in that while the controller for starting each SSD is corresponding Controller DMA, comprising:

During largely read-write data, continuity starts controller DMA.

6. file read/write method as described in claim 1, which is characterized in that create read/write function, the read-write for each SSD Function operation be each SSD virtual address,

When each SSD virtual address is converted into physical address, its logically and physically address of cache is determined by the FTL controller of SSD Relationship.

Technical field

The present invention relates to a kind of file read/write methods.

Background technique

After board computer system uses embedded OS, enable to Integrated Electronic System soft using file system The exploitation of part is more flexible and convenient.The documentation function for making full use of embedded OS to provide, facilitates development and application program. User program need to only pay close attention to the realization of read-write technology, it is not necessary to worry that I/O resource limits.

As satellite application load quantity is promoted, spaceborne computer reading and writing of files speed need to be improved.The spaceborne meter of integrated electronics Calculation machine is only improved IO performance, is just able to satisfy satellite overall performance index.

Embedded file system has a wide range of applications in aerospace spaceborne computer, and in existing realization technology, mainly Lower two kinds of implementations other than having:

1, easy file system is realized using FPGA control memory, but can not be with existing embedded OS interface Docking, application software interface are more difficult;

2, using file system, but the read-write demand of high speed load data can not be matched.

Summary of the invention

The purpose of the present invention is to provide a kind of file read/write methods.

To solve the above problems, the present invention provides a kind of file read/write method, comprising:

Step S1, for current spaceborne embedded system carry SSD, wherein according to the multiple SSD of speed index carry, guarantee In read-write operation, there are multiple SSD, provide the controller of the SSD;

Step S2 creates read/write function for each SSD, and what the read/write function operated is the virtual address of each SSD, In, function is write in the read/write function, the data for realizing the segmentation memory of spaceborne embedded system pass through controller DMA It moves into SSD;Reading function in the read/write function, is moved by controller DMA to spaceborne for realizing the data in SSD The segmentation memory of embedded system;

Step S3, while the corresponding controller DMA of controller for starting each SSD write letter by described in write operation Number is removed the data-moving of the segmentation memory the data in SSD by the reading function into SSD, or in read operation Be transported in the segmentation memory, wherein it is described segmentation memory size be equal to spaceborne embedded system memory size of data/ SSD number, it is described segmentation memory offset address be spaceborne embedded system memory data move base address sovolin before The size of memory is segmented described in location of controls *;

Step S4 waits the controller DMA of all SSD controllers to terminate;

Step S5 is repeated cyclically step S3 and step S4 according to read-write demand.

Further, in the above-mentioned methods, the controller of the SSD is two or more.

Further, in the above-mentioned methods, the controller DMA of all SSD controllers is waited to terminate, comprising:

For read or write, the end variable of a controller DMA is introduced for each controller, when all controllers After the completion of DMA, primary read-write is just completed.

Further, in the above-mentioned methods, for read or write, introduce a controller DMA's for each controller Terminate variable, after the completion of all controller DMA, primary read-write is just completed, comprising:

The end variable that read-write is completed, after the completion of all controller DMA, complement mark ability set are introduced for each SSD.

Further, in the above-mentioned methods, while starting the corresponding controller DMA of controller of each SSD, comprising:

During largely read-write data, continuity starts controller DMA.

Further, in the above-mentioned methods, read/write function is created for each SSD, the read/write function operation is each The virtual address of SSD,

When each SSD virtual address is converted into physical address, its logically and physically address is determined by the FTL controller of SSD Mapping relations.

Compared with prior art, the present invention is directed to embedded OS, using the controller and DMA function of SSD, uses Operating system semaphore and circular buffering area resource propose a kind of side for improving spaceborne embedded system reading and writing of files speed Method, to solve the DMA speed that current board computer system reading and writing of files speed is limited by single SSD controller, Jin Erti High board computer system IO performance.The present invention provides support to continue a large amount of read-write operation, play operating system semaphore, Dispatching algorithm advantage, the processor for reducing spaceborne embedded system use.The present invention is directed to spaceborne embedded system, can be effective SSD read or write speed is improved, provides guarantee for the high speed access and storage of realizing data.

Detailed description of the invention

Fig. 1 is the schematic diagram of the spaceborne embedded system reading and writing of files of one embodiment of the invention;

Fig. 2 is the flow chart of the read-write SSD of one embodiment of the invention;

Fig. 3 is the flow chart continuously read and write using semaphore of one embodiment of the invention.

Specific embodiment

In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.

As shown in Figure 1 to Figure 3, the present invention provides a kind of file read/write method, comprising:

Step S1, for current spaceborne embedded system carry SSD, wherein according to the multiple SSD of speed index carry, guarantee In read-write operation, there are multiple SSD, provide the controller of the SSD;

Here, SSD is solid state drive (Solid State Disk or Solid State Drive);

It is multiple according to speed index carry for spaceborne embedded system carry SSD, guarantee that there are multiple in read-write operation SSD, it is ensured that multiple SSD controllers will not influence each other;

Step S2 creates read/write function for each SSD, and what the read/write function operated is the virtual address of each SSD, In, function is write in the read/write function, the data for realizing the segmentation memory of spaceborne embedded system pass through controller DMA It moves into SSD;Reading function in the read/write function, is moved by controller DMA to spaceborne for realizing the data in SSD The segmentation memory of embedded system;

Here, reading or writing is realized by controller DMA, spaceborne embedded system processing device resource is saved;

It is all to need spaceborne embedded system memory and SSD interaction data, require the virtual address and control using SSD Device DMA, realizes data interaction by controller DMA, reduces computing resource for spaceborne embedded system;

Step S3, while the corresponding controller DMA of controller for starting each SSD write letter by described in write operation Number is removed the data-moving of the segmentation memory the data in SSD by the reading function into SSD, or in read operation It is transported in the segmentation memory, wherein the size (segsize) of the segmentation memory is equal to the memory of spaceborne embedded system Size of data (size)/SSD number (n), the offset address of the segmentation memory are the data of the memory of spaceborne embedded system Move the size (segsize) for being segmented memory before the sovolin of base address described in location of controls *;

Here, each small block data and SSD are interacted by decomposing bulk memory data, guarantee the parallel work of multiple SSD Make, it is whole to improve spaceborne embedded system read or write speed;

It introduces interaction data memory block and is segmented DMA, make full use of memory, operating system semaphore and cyclic buffer money Source, plays multiple SSD parallel performances, and multiple improves reading and writing of files speed;

Step S4 waits the controller DMA of all SSD controllers to terminate;

Here, because starting a controller DMA of SSD number (n) simultaneously, after needing to wait for all controller DMA, once Read-write operation just terminates;

Step S5 is repeated cyclically step S3 and step S4, guarantees the speed of reading and writing of files according to read-write demand.

Here, the present invention is believed using the controller and DMA function of SSD using operating system for embedded OS Number amount and circular buffering area resource, a kind of method for improving spaceborne embedded system reading and writing of files speed is proposed, to solve Board computer system reading and writing of files speed is limited by the DMA speed of single SSD controller at present, and then improves spaceborne computer System IO performance.The present invention provides support to continue a large amount of read-write operation, and it is excellent to play operating system semaphore, dispatching algorithm Gesture, the processor for reducing spaceborne embedded system use.The present invention is directed to spaceborne embedded system, can effectively improve SSD reading Writing rate provides guarantee for the high speed access and storage of realizing data.

In one embodiment of file read/write method of the invention, the controller of the SSD is two or more.

Here, for using spaceborne file system of multiple SSD as storage medium, at least need two or more be Multiple SSD provide the controller of parallel work-flow, and be doubled and redoubled read or write speed, to guarantee the read or write speed of high speed.

When using spaceborne file system of multiple SSD as storage medium, at least guarantee to provide for spaceborne embedded system Multiple storage mediums, it is ensured that software read-write can be with parallel work-flow.

In one embodiment of file read/write method of the invention, in step S4, the controller of all SSD controllers is waited DMA terminates, comprising:

For read or write, the end variable of a controller DMA is introduced for each controller, when all controllers After the completion of DMA, primary read-write is just completed.

Here, introducing the logic for guaranteeing that all controller DMA are completed, it is ensured that all data files are complete in spaceborne file system Whole property.For read or write, the end variable of a controller DMA is introduced for each controller, when all controller DMA are complete Cheng Hou, primary read-write are just completed.Only all DMA terminate to be only complete read/write function, prevent because each SSD deadline is different It causes, influences the correctness for reading and writing data.

In one embodiment of file read/write method of the invention, for read or write, a control is introduced for each controller The end variable of device DMA processed, after the completion of all controller DMA, primary read-write is just completed, comprising:

The end variable that read-write is completed is introduced for each SSD, after the completion of all controller DMA, complement mark ability set, It ensure that the integrality of a data interaction.

In one embodiment of file read/write method of the invention, in step S3, while the controller for starting each SSD is corresponding Controller DMA, comprising:

During largely read-write data, continuity starts controller DMA.

Here, using in spaceborne embedded system semaphore and cyclic buffer, guarantee read-write data continuity and just True property.

In one embodiment of file read/write method of the invention, step S2 creates read/write function, the read-write for each SSD Function operation is in the virtual address of each SSD,

When each SSD virtual address is converted into physical address, its logically and physically address is determined by the FTL controller of SSD Mapping relations.

Here, realizing the balanced physical address that uses, realization load balancing by the controller of SSD;

In conclusion the present invention is capable of providing for running embedded OS environment, further spaceborne embedded system System reading and writing of files speed, improving spaceborne embedded system IO performance has positive reference, has in space industry preferable Practical engineering application value.

Specifically, design principle and mentality of designing of the invention mainly includes following two parts, specifically:

(1) thought of parallel computation is utilized, provide DMA starting memory address for each SSD and moves size, when all DMA terminates, and completes a read-write operation;

(2) using the semaphore of spaceborne computer embedded OS and cyclic buffer, guarantee that continuous high-efficient is completed Single reads and writes SSD.

Specifically, as shown in Figure 1 to Figure 3, a kind of spaceborne embedded system reading and writing of files speed of raising provided by the invention Method comprise the following steps that

Step 1, for the storage medium of spaceborne computer embedded file system --- SSD creates three physics and sets It is standby, it is identified by embedded OS, is physically ensured of that parallel there are three SSD;

Step 2 creates read/write function for SSD, function operation be SSD virtual address, write function and realize spaceborne insertion Formula Installed System Memory data are moved by controller DMA to SSD, are read function and are realized that SSD data are moved by controller DMA to spaceborne Embedded system memory.Read-write is realized by controller DMA, and spaceborne embedded system processing device resource is saved;

Step 3, while starting the controller DMA of SSD controller, the data-moving of segmentation memory to SSD (writing) or from SSD is carried to memory (reading);The size (segsize) for being segmented memory is equal to size of data (size)/SSD number (3) of memory, The offset address for being segmented memory is that internal storage data moves base address bonus point section memory size (segsize);

Step 4 waits the DMA of all SSD controllers to terminate, because starting SSD a DMA of number (3) simultaneously, needs to wait for After all DMA, one time read-write operation just terminates;

Step 5 is repeated cyclically step three and four, guarantees the speed of reading and writing of files according to read-write demand.

This method introduces memory partitioning algorithm, reduces the data volume of single DMA read-write.Start multiple DMA simultaneously, it is parallel complete At read-write operation, after all DMA, primary read-write is completed.Memory partitioning algorithm provides starting memory for the DMA of each SSD Address and move size, after the completion of all DMA, primary read-write is completed, it is ensured that the integrality of primary read-write data;

For continuous a large amount of read-writes, provided using the semaphore of spaceborne computer embedded OS, cyclic buffer etc. Source repeats memory segmentation read-write, realizes the I/O operation of a large amount of high speeds.

In conclusion mode of the present invention significantly improves spaceborne embedded system reading and writing of files speed in a manner of parallel work-flow SSD Degree, to improve spaceborne embedded system IO performance.File system read-write is used compared to traditional On-board software development mode, it should The speed of On-board software reading and writing of files can be greatly improved in kind mode, have stronger engineering practice value.

Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other The difference of embodiment, the same or similar parts in each embodiment may refer to each other.

Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These Function is implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Profession Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered Think beyond the scope of this invention.

Obviously, those skilled in the art can carry out various modification and variations without departing from spirit of the invention to invention And range.If in this way, these modifications and changes of the present invention belong to the claims in the present invention and its equivalent technologies range it Interior, then the invention is also intended to include including these modification and variations.

9页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:图像处理装置和图像处理方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类