CN103198021B - A kind of method improving solid state disk data transmission efficiency - Google Patents
A kind of method improving solid state disk data transmission efficiency Download PDFInfo
- Publication number
- CN103198021B CN103198021B CN201310135328.XA CN201310135328A CN103198021B CN 103198021 B CN103198021 B CN 103198021B CN 201310135328 A CN201310135328 A CN 201310135328A CN 103198021 B CN103198021 B CN 103198021B
- Authority
- CN
- China
- Prior art keywords
- page
- node
- linked list
- circular linked
- full
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000005540 biological transmission Effects 0.000 title claims abstract description 16
- 238000000034 method Methods 0.000 title claims abstract description 12
- 239000007787 solid Substances 0.000 title claims description 22
- 230000002457 bidirectional effect Effects 0.000 claims abstract description 93
- 238000013500 data storage Methods 0.000 abstract description 2
- 230000003139 buffering effect Effects 0.000 abstract 1
- 238000013403 standard screening design Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 210000004556 brain Anatomy 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000035939 shock Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明涉及一种提高固态硬盘数据传输效率的方法,属于计算机数据存储技术领域。本发明方法通过采用一种基于双向循环链表实现的数据缓冲机制和一种仿堆栈型LRU(Least Recently Used,最近最少使用算法)缺页调度算法,有效解决了固态硬盘地址不对齐的问题,从而提高数据传输效率。The invention relates to a method for improving data transmission efficiency of a solid-state hard disk, belonging to the technical field of computer data storage. The method of the present invention effectively solves the problem of address misalignment of the solid-state hard disk by adopting a data buffering mechanism based on a bidirectional circular linked list and a stack-like LRU (Least Recently Used, least recently used algorithm) page fault scheduling algorithm, thereby Improve data transmission efficiency.
Description
技术领域technical field
本发明涉及一种提高固态硬盘数据传输效率的方法,用于解决固态硬盘地址不对齐的问题,属于计算机数据存储技术领域。The invention relates to a method for improving the data transmission efficiency of a solid-state hard disk, which is used for solving the problem of address misalignment of the solid-state hard disk, and belongs to the technical field of computer data storage.
背景技术Background technique
固态硬盘(Solid State Disk,SSD),是一种采用固态电子存储芯片阵列制成的硬盘,由控制单元和存储单元组成。与传统机械硬盘(Hard DiskDrive,HDD)相比,固态硬盘在读取速度、功耗、噪音、抗震性、体积、工作温度范围、容价比等方面均具有明显优势,被广泛应用于军事、车载、工控、视频监控、网络监控、网络终端、电力、医疗、航空、导航设备等领域。Solid State Disk (SSD) is a hard disk made of a solid-state electronic memory chip array, consisting of a control unit and a storage unit. Compared with traditional mechanical hard disk (Hard DiskDrive, HDD), solid-state hard disk has obvious advantages in reading speed, power consumption, noise, shock resistance, volume, operating temperature range, capacity-price ratio, etc., and is widely used in military, Vehicle, industrial control, video surveillance, network surveillance, network terminal, electric power, medical, aviation, navigation equipment and other fields.
根据存储介质的不同,固态硬盘分为两种,一种采用闪存(FLASH芯片)作为存储介质,另外一种采用动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)作为存储介质。其中,基于闪存的固态硬盘最大的优点是可移动,且数据保护不受电源控制,能够适应于各种环境。基于闪存的固态硬盘其内部构造简单,固态硬盘内主体是一块印制电路板(Printed Circuit Board,PCB),而这块PCB板上最基本的配件是控制芯片、内存芯片和用于存储数据的闪存芯片。其中,控制芯片是固态硬盘的大脑,其作用一是合理调配数据在各个闪存芯片上的负荷,二则是承担整个数据的中转,连接闪存芯片和外部SATA(Serial Advanced TechnologyAttachment)接口;内存芯片用于辅助主控芯片进行数据处理。According to different storage media, solid-state hard drives are divided into two types, one uses flash memory (FLASH chip) as the storage medium, and the other uses dynamic random access memory (Dynamic Random Access Memory, DRAM) as the storage medium. Among them, the biggest advantage of flash-based SSDs is that they are removable, and data protection is not controlled by the power supply, and can be adapted to various environments. The internal structure of solid-state hard disk based on flash memory is simple. The main body of solid-state hard disk is a printed circuit board (PCB), and the most basic accessories on this PCB board are control chip, memory chip and memory chip for storing data. flash chip. Among them, the control chip is the brain of the solid-state hard drive. Its function is to reasonably allocate the load of data on each flash memory chip, and the second is to undertake the transfer of the entire data, connecting the flash memory chip and the external SATA (Serial Advanced Technology Attachment) interface; Perform data processing on the auxiliary main control chip.
与传统的机械硬盘相比,固态硬盘的缺点是:①由于受到闪存擦写次数的限制,其使用寿命相对较短。传统的机械硬盘以扇区为单位,而固态硬盘通常以页为单位存储数据。为了延长固态硬盘使用寿命,绝大多数的固态硬盘都有磨损平衡的处理,即连续两次对同一逻辑地址的写入操作,在闪存进行写入操作的实际物理位置不同。②在对固态硬盘进行写操作时,若写操作的逻辑地址没有与固态硬盘的基本单位(页)对齐,可能出现数据从一个闪存页到另一个闪存页的搬移现象,即:在对固态硬盘进行写操作时,如果写操作的逻辑地址与固态硬盘的基本单位(页)不对齐时,首先需要将闪存中的写操作页读取到固态硬盘的内存中,然后在固态硬盘的内存中对该写操作页进行部分替换,再将内存中的该写操作页写回到固态硬盘中。如此操作,大量的时间被浪费在了简单而耗时的闪存数据搬移操作上,影响固态硬盘的传输效率和使用寿命。③主机的数据在写入闪存之前都要经过SDRAM(Synchronous Dynamic Random Access Memory,同步动态随机存储器)层,但目前的固态硬盘没有考虑这些数据的二次利用问题,导致有用数据白白浪费。Compared with traditional mechanical hard disks, the disadvantages of solid-state hard disks are: ① Due to the limitation of the number of erasing and writing of flash memory, its service life is relatively short. Traditional mechanical hard disks store data in units of sectors, while SSDs usually store data in units of pages. In order to prolong the service life of solid-state drives, most solid-state drives have wear-leveling processing, that is, two consecutive write operations to the same logical address, the actual physical location of the write operation in the flash memory is different. ②When writing to the solid-state hard disk, if the logical address of the write operation is not aligned with the basic unit (page) of the solid-state hard disk, data may be moved from one flash memory page to another, that is, when writing to the solid-state hard disk When performing a write operation, if the logical address of the write operation is not aligned with the basic unit (page) of the SSD, it is first necessary to read the write operation page in the flash memory into the memory of the SSD, and then write the page in the memory of the SSD. The write operation page is partially replaced, and then the write operation page in the memory is written back to the solid state disk. In this way, a lot of time is wasted on the simple and time-consuming flash memory data movement operation, which affects the transmission efficiency and service life of the solid state drive. ③The data of the host must go through the SDRAM (Synchronous Dynamic Random Access Memory) layer before being written into the flash memory, but the current solid-state hard disk does not consider the secondary use of these data, resulting in waste of useful data.
发明内容Contents of the invention
本发明的目的是为了解决目前已有固态硬盘在写操作的逻辑地址与固态硬盘的基本单位(页)不对齐时,造成传输效率不高的问题,提出一种提高固态硬盘数据传输效率的方法。本发明方法通过采用一种基于双向循环链表实现的数据缓冲机制和一种仿堆栈型LRU(Least Recently Used,最近最少使用算法)缺页调度算法,有效解决了固态硬盘地址不对齐的问题,从而提高数据传输效率。The purpose of the present invention is to solve the problem that the transmission efficiency of the existing solid-state hard disk is not high when the logical address of the write operation is not aligned with the basic unit (page) of the solid-state hard disk, and propose a method for improving the data transmission efficiency of the solid-state hard disk . The method of the present invention effectively solves the problem of address misalignment of the solid-state hard disk by adopting a data buffer mechanism based on a bidirectional circular linked list and a stack-like LRU (Least Recently Used, least recently used algorithm) page fault scheduling algorithm, thereby Improve data transmission efficiency.
本发明的目的是通过以下技术方案实现的。The purpose of the present invention is achieved through the following technical solutions.
一种提高固态硬盘数据传输效率的方法,用于主机与固态硬盘之间的数据传输,所述固态硬盘包括控制芯片、内存芯片和闪存芯片;其具体实施步骤为:A method for improving data transmission efficiency of a solid-state hard disk is used for data transmission between a host computer and a solid-state hard disk, and the solid-state hard disk includes a control chip, a memory chip and a flash memory chip; its specific implementation steps are:
步骤1:在固态硬盘的内存中创建1个空闲页双向循环链表、1个整页双向循环链表、1个零碎页双向循环链表和1个缓冲区。Step 1: Create a free page doubly linked list, a full page doubly linked list, a fragmented page doubly linked list and a buffer in the memory of the SSD.
所述空闲页双向循环链表有N个节点,N为正整数。所述空闲页双向循环链表中的每个节点包含1个指针。The free page bidirectional circular linked list has N nodes, and N is a positive integer. Each node in the free page bidirectional circular linked list contains a pointer.
所述整页双向循环链表和零碎页双向循环链表均为空。Both the full page bidirectional circular linked list and the fragmented page bidirectional circular linked list are empty.
所述整页双向循环链表和零碎页双向循环链表中的每个节点都有一个标志量(用符号Flag表示),用于表示该节点指向的缓存区中的页面是否修改过,设置Flag=0。Each node in the described full-page bidirectional circular linked list and fragmentary page bidirectional circular linked list has a sign quantity (expressed with symbol Flag), whether the page in the cache area that this node points to is modified, Flag=0 is set .
所述整页双向循环链表中的每个节点包含1个指针。Each node in the full-page doubly linked list contains 1 pointer.
所述零碎页双向循环链表中的每个节点包含2个指针,分别称为头指针和尾指针。Each node in the fragmented page bidirectional circular linked list contains 2 pointers, which are respectively called a head pointer and a tail pointer.
所述缓冲区的大小为所述固态硬盘的页面大小的N倍。The size of the buffer is N times the page size of the solid state disk.
步骤2:将步骤1中创建的缓冲区分为N个页面,每个缓冲区页面的大小与所述固态硬盘的页面大小相同;然后依次使所述空闲页双向循环链表第1个节点的指针指向缓冲区第1个页面的起始地址,使所述空闲页双向循环链表第2个节点中的指针指向缓冲区第2个页面的起始地址,以此类推,使所述空闲页双向循环链表第N个节点中的指针指向缓冲区第N个页面的起始地址。Step 2: Divide the buffer created in step 1 into N pages, and the size of each buffer page is the same as the page size of the solid-state disk; then make the pointer of the first node of the free page bidirectional circular linked list point to The starting address of the first page of the buffer, so that the pointer in the second node of the free page bidirectional circular linked list points to the starting address of the second page of the buffer, and so on, so that the free page bidirectional circular linked list The pointer in the Nth node points to the starting address of the Nth page of the buffer.
步骤3:当主机请求对所述固态硬盘进行读/写操作时,根据请求的读/写地址查找读/写操作页是否缓存在固态硬盘的缓存区中。Step 3: When the host requests to perform a read/write operation on the solid-state hard disk, check whether the read/write operation page is cached in the cache area of the solid-state hard disk according to the requested read/write address.
若固态硬盘的缓冲区中有该读/写操作页的缓存,则直接在该读/写操作页的缓存上进行读/写操作,并在写操作后,设置该节点的标志量Flag=1。If there is a cache of the read/write operation page in the buffer of the solid state disk, then directly perform the read/write operation on the cache of the read/write operation page, and after the write operation, set the flag value Flag=1 of the node .
若固态硬盘的缓冲区中没有该读/写操作页的缓存,则判断空闲页双向循环链表是否为空,如空闲页双向循环链表为空,则采用缺页调度算法进行缺页调度操作,然后执行步骤4的操作。如空闲页双向循环链表不为空,则执行步骤4的操作。If there is no cache of the read/write operation page in the buffer of the solid state disk, then judge whether the free page bidirectional circular linked list is empty, if the free page bidirectional circular linked list is empty, use the page fault scheduling algorithm to perform the page fault scheduling operation, and then Perform step 4. If the free page bidirectional circular linked list is not empty, then perform the operation in step 4.
所述缺页调度算法具体为:The page fault scheduling algorithm is specifically:
第a步:判断整页双向循环链表是否为空,如不为空,则从整页双向循环链表的尾部选择一个标志量Flag=1的节点,将该节点称为待写回整页节点;将该待写回整页节点中指针指向的缓冲区中的页内容写入固态硬盘的闪存中;然后为空闲页双向循环链表增加一个新节点,并使该新节点的指针指向待写回整页节点中指针指向的地址;再从整页双向循环链表中删除该待写回整页节点。如果整页双向循环链表为空,则执行第b步的操作。Step a: judge whether the full page bidirectional circular linked list is empty, if not empty, then select a node with a flag value Flag=1 from the tail of the full page bidirectional circular linked list, and this node is referred to as the full page node to be written back; Write the page content in the buffer pointed to by the pointer of the full page node to be written back into the flash memory of the solid state disk; then add a new node to the free page bidirectional circular linked list, and make the pointer of the new node point to the full page to be written back The address pointed to by the pointer in the page node; then delete the full page node to be written back from the full page bidirectional circular linked list. If the entire page of doubly linked list is empty, then perform the operation of step b.
第b步:从零碎页双向循环链表的尾部选择一个标志量Flag=1的节点,将该节点称为待写回零碎页节点;将该待写回零碎页节点中指针指向的缓冲区中的页内容写入固态硬盘的闪存中;然后为空闲页双向循环链表增加一个新节点,并使该新节点的指针指向待写回零碎页节点中指针指向的地址;再从零碎页双向循环链表中删除该待写回零碎页节点。Step b: select the node of a sign quantity Flag=1 from the tail of the fragmented page bidirectional circular linked list, and this node is referred to as the fragmented page node to be written back; Write the page content in the flash memory of the solid-state hard disk; then add a new node for the free page two-way circular linked list, and make the pointer of the new node point to the address pointed to by the pointer in the fragmented page node to be written back; then from the fragmented page two-way circular linked list Delete the fragmented page node to be written back.
所述缺页调度算法在进行缺页调度时,遵循堆栈型LRU替换原则,即从整页双向循环链表和零碎页双向循环链表的尾部开始向前选择一个节点进行缺页替换操作。The page fault scheduling algorithm follows the stack-type LRU replacement principle when performing page fault scheduling, that is, selects a node forward from the end of the full-page bidirectional circular linked list and the fragmented page bidirectional circular linked list to perform a page fault replacement operation.
步骤4:判断步骤3中所述对读/写操作页的操作是对该页的整页操作还是部分操作,如果是对整页操作,则从空闲页双向循环链表中摘出一个节点插入到整页双向循环链表,将该节点称为新增整页节点;然后根据步骤3中所述主机对固态硬盘进行读/写操作的地址,将该读/写操作页的内容从闪存中读入到新增整页节点中的指针指向的内存缓冲区页面;在该读/写操作页的缓存上进行读/写操作,并在写操作后,设置该节点的标志量Flag=1。如果进行的是部分操作,则从空闲页双向循环链表中摘出一个节点,并为零碎页双向循环链表增加一个节点,将该节点称为新增零碎页节点,使新增零碎页节点的头指针指向从空闲页双向循环链表中摘出的节点中指针指向的页面的起始地址;然后根据步骤3中所述主机对固态硬盘进行读/写操作的地址,将该读/写操作页的内容从闪存中读入到新增零碎页节点中头指针指向的内存缓冲区页面;在该读/写操作页的缓存上进行读/写操作,并在写操作后,设置该节点的标志量Flag=1;最后,使新增零碎页节点的头指针指向缓冲区中该读/写操作页的非空第一个字节的地址,使新增零碎页节点的尾指针指向该读/写操作页的非空最后一个字节的地址。Step 4: Determine whether the operation on the read/write operation page described in step 3 is an operation on the entire page or a part of the page. If it is an operation on the entire page, then extract a node from the free page bidirectional circular linked list and insert it into the entire page. Page bidirectional circular linked list, this node is called a new full page node; then according to the address of the host to read/write the solid state disk described in step 3, read the content of the read/write operation page from the flash memory into Add a memory buffer page pointed to by the pointer in the full page node; perform read/write operations on the cache of the read/write operation page, and set the flag value of the node to Flag=1 after the write operation. If a partial operation is performed, a node is extracted from the free page bidirectional circular linked list, and a node is added to the fragmented page bidirectional circular linked list, and this node is called a new fragmented page node, so that the head pointer of the newly added fragmented page node Point to the starting address of the page pointed to by the pointer in the node extracted from the free page bidirectional circular linked list; then according to the address of the host performing the read/write operation on the solid-state hard disk as described in step 3, the content of the read/write operation page is read from The memory buffer page pointed to by the head pointer in the newly added fragmented page node is read in the flash memory; the read/write operation is performed on the cache of the read/write operation page, and after the write operation, the flag value of the node is set to Flag= 1; Finally, make the head pointer of the newly added fragmented page node point to the address of the first non-empty byte of the read/write operation page in the buffer, and make the tail pointer of the newly added fragmented page node point to the read/write operation page The address of the non-null last byte of .
所述一种提高固态硬盘数据传输效率的方法,还包括:在固态硬盘的处于空闲状态时,将缓存区中的数据写入闪存的操作,其具体步骤为:The method for improving the data transmission efficiency of the solid-state hard disk also includes: when the solid-state hard disk is in an idle state, the operation of writing the data in the cache area to the flash memory, the specific steps are:
步骤a:检查零碎页双向循环链表,判断其中是否存在待转移整页节点,若存在待转移整页节点,则在整页双向循环链表的头部增加一个新节点,并使该新节点的指针指向待转移整页节点头指针指向的地址,再从零碎页双向循环链表中删除待转移整页节点。Step a: Check the bidirectional circular linked list of fragmented pages to determine whether there is a full page node to be transferred, if there is a full page node to be transferred, add a new node at the head of the full page bidirectional circular linked list, and make the pointer of the new node Point to the address pointed to by the head pointer of the full page node to be transferred, and then delete the full page node to be transferred from the bidirectional circular linked list of the fragmented page.
所述待转移整页节点是零碎页双向循环链表中头指针指向对应缓存区页面的起始地址,尾指针指向对应缓存区页面的结束地址的节点。The full-page node to be transferred is a node whose head pointer points to the start address of the corresponding buffer page in the bidirectional circular linked list of fragmented pages, and whose tail pointer points to the end address of the corresponding buffer page.
步骤b:从整页双向循环链表的尾部选择一个标志量Flag=1的节点,将该节点指向的页面数据写入固态硬盘的闪存中,并设置标志量Flag=0。当整页双向循环链表没有标志量Flag=1的节点时,在零碎页双向循环链表的尾部选取一个标志量Flag=1的节点,将该节点指向的页面数据写入固态硬盘的闪存中,并置标志量Flag=0。这样,当固态硬盘突然断电时,整页双向循环链表和零碎页双向循环链表中仅有少量Flag=1的节点指向的页面数据没有存储到固态硬盘的闪存中,可以在短时间内将缓存的数据写入固态硬盘,避免数据丢失。Step b: Select a node with flag value Flag=1 from the end of the full-page bidirectional circular linked list, write the page data pointed to by the node into the flash memory of the solid state disk, and set the flag value Flag=0. When the whole page bidirectional circular linked list does not have the node of flag quantity Flag=1, select a node of flag quantity Flag=1 at the tail end of fragmented page bidirectional circular linked list, write the page data pointed to by this node in the flash memory of solid-state hard disk, and Set flag quantity Flag=0. In this way, when the solid-state hard drive suddenly loses power, the page data pointed to by only a small number of nodes with Flag=1 in the full-page doubly-linked list and the fragmented-page doubly-linked list is not stored in the flash memory of the solid-state hard drive, and the cache memory can be cached in a short time. The data is written to the solid-state hard disk to avoid data loss.
有益效果Beneficial effect
本发明提出的一种提高固态硬盘数据传输效率的方法通过采用基于双向循环链表实现的数据缓冲机制和一种仿堆栈型LRU缺页调度算法,有效解决了固态硬盘地址不对齐的问题,从而提高数据传输效率。A method for improving the data transmission efficiency of solid-state hard drives proposed by the present invention effectively solves the problem of address misalignment of solid-state hard drives by adopting a data buffer mechanism based on a two-way circular linked list and a stack-like LRU page fault scheduling algorithm, thereby improving Data transfer efficiency.
具体实施方式detailed description
为了更好的说明本发明的技术方案,下面通过1个实施例,对本发明做进一步说明。In order to better illustrate the technical solution of the present invention, the present invention will be further described through an example below.
在主机和固态硬盘之间进行数据传输,固态硬盘包括控制芯片、内存芯片和闪存芯片。其中,闪存芯片采用三星K9LCG08U1M型芯片;固态硬盘的页大小为32KB。其具体实施步骤为:Data transmission is performed between the host computer and the solid-state hard disk, and the solid-state hard disk includes a control chip, a memory chip and a flash memory chip. Among them, the flash memory chip adopts Samsung K9LCG08U1M chip; the page size of the solid-state hard disk is 32KB. Its specific implementation steps are:
步骤1:在固态硬盘的内存中创建1个空闲页双向循环链表、1个整页双向循环链表、1个零碎页双向循环链表和1个缓冲区。Step 1: Create a free page doubly linked list, a full page doubly linked list, a fragmented page doubly linked list and a buffer in the memory of the SSD.
所述空闲页双向循环链表有128个节点。所述空闲页双向循环链表中的每个节点包含1个指针。The free page bidirectional circular linked list has 128 nodes. Each node in the free page bidirectional circular linked list contains a pointer.
所述整页双向循环链表和零碎页双向循环链表均为空。Both the full page bidirectional circular linked list and the fragmented page bidirectional circular linked list are empty.
所述整页双向循环链表和零碎页双向循环链表中的每个节点都有一个标志量Flag,用于表示该节点指向的缓存区中的页面是否修改过,设置Flag=0。Each node in the full-page doubly-linked list and the fragmented-page doubly-linked list has a flag quantity Flag, which is used to indicate whether the page in the cache area pointed to by the node has been modified, and Flag=0 is set.
所述整页双向循环链表中的每个节点包含1个指针。Each node in the full-page doubly linked list contains 1 pointer.
所述零碎页双向循环链表中的每个节点包含2个指针,分别称为头指针和尾指针。Each node in the fragmented page bidirectional circular linked list contains 2 pointers, which are respectively called a head pointer and a tail pointer.
所述缓冲区的大小为所述固态硬盘的页面大小的128倍,即4M。The size of the buffer is 128 times the page size of the solid state disk, namely 4M.
步骤2:将步骤1中创建的缓冲区分为128个页面,每个缓冲区页面的大小与所述固态硬盘的页面大小相同;然后依次使所述空闲页双向循环链表第1个节点的指针指向缓冲区第1个页面的起始地址,使所述空闲页双向循环链表第2个节点中的指针指向缓冲区第2个页面的起始地址,以此类推,使所述空闲页双向循环链表第128个节点中的指针指向缓冲区第128个页面的起始地址。Step 2: Divide the buffer created in step 1 into 128 pages, and the size of each buffer page is the same as the page size of the solid-state disk; then make the pointer of the first node of the free page bidirectional circular linked list point to The starting address of the first page of the buffer, so that the pointer in the second node of the free page bidirectional circular linked list points to the starting address of the second page of the buffer, and so on, so that the free page bidirectional circular linked list The pointer in the 128th node points to the starting address of the 128th page of the buffer.
步骤3:当主机请求对所述固态硬盘进行读/写操作时,根据请求的读/写地址查找读/写操作页是否缓存在固态硬盘的缓存区中。Step 3: When the host requests to perform a read/write operation on the solid-state hard disk, check whether the read/write operation page is cached in the cache area of the solid-state hard disk according to the requested read/write address.
若固态硬盘的缓冲区中有该读/写操作页的缓存,则直接在该读/写操作页的缓存上进行读/写操作,并在写操作后,设置该节点的标志量Flag=1。If there is a cache of the read/write operation page in the buffer of the solid state disk, then directly perform the read/write operation on the cache of the read/write operation page, and after the write operation, set the flag value Flag=1 of the node .
若固态硬盘的缓冲区中没有该读/写操作页的缓存,则判断空闲页双向循环链表是否为空,如空闲页双向循环链表为空,则采用缺页调度算法进行缺页调度操作,然后执行步骤4的操作。如空闲页双向循环链表不为空,则执行步骤4的操作。If there is no cache of the read/write operation page in the buffer of the solid state disk, then judge whether the free page bidirectional circular linked list is empty, if the free page bidirectional circular linked list is empty, use the page fault scheduling algorithm to perform the page fault scheduling operation, and then Perform step 4. If the free page bidirectional circular linked list is not empty, then perform the operation in step 4.
所述缺页调度算法具体为:The page fault scheduling algorithm is specifically:
第a步:判断整页双向循环链表是否为空,如不为空,则从整页双向循环链表的尾部选择一个标志量Flag=1的节点,将该节点称为待写回整页节点;将该待写回整页节点中指针指向的缓冲区中的页内容写入固态硬盘的闪存中;然后为空闲页双向循环链表增加一个新节点,并使该新节点的指针指向待写回整页节点中指针指向的地址;再从整页双向循环链表中删除该待写回整页节点。如果整页双向循环链表为空,则执行第b步的操作。Step a: judge whether the full page bidirectional circular linked list is empty, if not empty, then select a node with a flag value Flag=1 from the tail of the full page bidirectional circular linked list, and this node is referred to as the full page node to be written back; Write the page content in the buffer pointed to by the pointer of the full page node to be written back into the flash memory of the solid state disk; then add a new node to the free page bidirectional circular linked list, and make the pointer of the new node point to the full page to be written back The address pointed to by the pointer in the page node; then delete the full page node to be written back from the full page bidirectional circular linked list. If the entire page of doubly linked list is empty, then perform the operation of step b.
第b步:从零碎页双向循环链表的尾部选择一个标志量Flag=1的节点,将该节点称为待写回零碎页节点;将该待写回零碎页节点中指针指向的缓冲区中的页内容写入固态硬盘的闪存中;然后为空闲页双向循环链表增加一个新节点,并使该新节点的指针指向待写回零碎页节点中指针指向的地址;再从零碎页双向循环链表中删除该待写回零碎页节点。Step b: select the node of a sign quantity Flag=1 from the tail of the fragmented page bidirectional circular linked list, and this node is referred to as the fragmented page node to be written back; Write the page content in the flash memory of the solid-state hard disk; then add a new node for the free page two-way circular linked list, and make the pointer of the new node point to the address pointed to by the pointer in the fragmented page node to be written back; then from the fragmented page two-way circular linked list Delete the fragmented page node to be written back.
所述缺页调度算法在进行缺页调度时,遵循堆栈型LRU替换原则,即从整页双向循环链表和零碎页双向循环链表的尾部开始向前选择一个节点进行缺页替换操作。The page fault scheduling algorithm follows the stack-type LRU replacement principle when performing page fault scheduling, that is, selects a node forward from the end of the full-page bidirectional circular linked list and the fragmented page bidirectional circular linked list to perform a page fault replacement operation.
步骤4:判断步骤3中所述对读/写操作页的操作是对该页的整页操作还是部分操作,如果是对整页操作,则从空闲页双向循环链表中摘出一个节点插入到整页双向循环链表,将该节点称为新增整页节点;然后根据步骤3中所述主机对固态硬盘进行读/写操作的地址,将该读/写操作页的内容从闪存中读入到新增整页节点中的指针指向的内存缓冲区页面;在该读/写操作页的缓存上进行读/写操作,并在写操作后,设置该节点的标志量Flag=1。如果进行的是部分操作,则从空闲页双向循环链表中摘出一个节点,并为零碎页双向循环链表增加一个节点,将该节点称为新增零碎页节点,使新增零碎页节点的头指针指向从空闲页双向循环链表中摘出的节点中指针指向的页面的起始地址;然后根据步骤3中所述主机对固态硬盘进行读/写操作的地址,将该读/写操作页的内容从闪存中读入到新增零碎页节点中头指针指向的内存缓冲区页面;在该读/写操作页的缓存上进行读/写操作,并在写操作后,设置该节点的标志量Flag=1;最后,使新增零碎页节点的头指针指向缓冲区中该读/写操作页的非空第一个字节的地址,使新增零碎页节点的尾指针指向该读/写操作页的非空最后一个字节的地址。Step 4: Determine whether the operation on the read/write operation page described in step 3 is an operation on the entire page or a part of the page. If it is an operation on the entire page, then extract a node from the free page bidirectional circular linked list and insert it into the entire page. Page bidirectional circular linked list, this node is called a new full page node; then according to the address of the host to read/write the solid state disk described in step 3, read the content of the read/write operation page from the flash memory into Add a memory buffer page pointed to by the pointer in the full page node; perform read/write operations on the cache of the read/write operation page, and set the flag value of the node to Flag=1 after the write operation. If a partial operation is performed, a node is extracted from the free page bidirectional circular linked list, and a node is added to the fragmented page bidirectional circular linked list, and this node is called a new fragmented page node, so that the head pointer of the newly added fragmented page node Point to the starting address of the page pointed to by the pointer in the node extracted from the free page bidirectional circular linked list; then according to the address of the host performing the read/write operation on the solid-state hard disk as described in step 3, the content of the read/write operation page is read from The memory buffer page pointed to by the head pointer in the newly added fragmented page node is read in the flash memory; the read/write operation is performed on the cache of the read/write operation page, and after the write operation, the flag value of the node is set to Flag= 1; Finally, make the head pointer of the newly added fragmented page node point to the address of the first non-empty byte of the read/write operation page in the buffer, and make the tail pointer of the newly added fragmented page node point to the read/write operation page The address of the non-null last byte of .
当固态硬盘的处于空闲状态时,将缓存区中的数据写入闪存的操作,其具体步骤为:When the SSD is in an idle state, the operation of writing the data in the cache area to the flash memory, the specific steps are:
步骤a:检查零碎页双向循环链表,判断其中是否存在待转移整页节点,若存在待转移整页节点,则在整页双向循环链表的头部增加一个新节点,并使该新节点的指针指向待转移整页节点头指针指向的地址,再从零碎页双向循环链表中删除待转移整页节点。Step a: Check the bidirectional circular linked list of fragmented pages to determine whether there is a full page node to be transferred, if there is a full page node to be transferred, add a new node at the head of the full page bidirectional circular linked list, and make the pointer of the new node Point to the address pointed to by the head pointer of the full page node to be transferred, and then delete the full page node to be transferred from the bidirectional circular linked list of the fragmented page.
所述待转移整页节点是零碎页双向循环链表中头指针指向对应缓存区页面的起始地址,尾指针指向对应缓存区页面的结束地址的节点。The full-page node to be transferred is a node whose head pointer points to the start address of the corresponding buffer page in the bidirectional circular linked list of fragmented pages, and whose tail pointer points to the end address of the corresponding buffer page.
步骤b:从整页双向循环链表的尾部选择一个标志量Flag=1的节点,将该节点指向的页面数据写入固态硬盘的闪存中,并设置标志量Flag=0。当整页双向循环链表没有标志量Flag=1的节点时,在零碎页双向循环链表的尾部选取一个标志量Flag=1的节点,将该节点指向的页面数据写入固态硬盘的闪存中,并置标志量Flag=0。这样,当固态硬盘突然断电时,整页双向循环链表和零碎页双向循环链表中仅有少量Flag=1的节点指向的页面数据没有存储到固态硬盘的闪存中,可以在短时间内将缓存的数据写入固态硬盘,避免数据丢失。Step b: Select a node with flag value Flag=1 from the end of the full-page bidirectional circular linked list, write the page data pointed to by the node into the flash memory of the solid state disk, and set the flag value Flag=0. When the whole page bidirectional circular linked list does not have the node of flag quantity Flag=1, select a node of flag quantity Flag=1 at the tail end of fragmented page bidirectional circular linked list, write the page data pointed to by this node in the flash memory of solid-state hard disk, and Set flag quantity Flag=0. In this way, when the solid-state hard drive suddenly loses power, the page data pointed to by only a small number of nodes with Flag=1 in the full-page doubly-linked list and the fragmented-page doubly-linked list is not stored in the flash memory of the solid-state hard drive, and the cache memory can be cached in a short time. The data is written to the solid-state hard disk to avoid data loss.
Claims (2)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310135328.XA CN103198021B (en) | 2013-04-18 | 2013-04-18 | A kind of method improving solid state disk data transmission efficiency |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201310135328.XA CN103198021B (en) | 2013-04-18 | 2013-04-18 | A kind of method improving solid state disk data transmission efficiency |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103198021A CN103198021A (en) | 2013-07-10 |
| CN103198021B true CN103198021B (en) | 2015-08-05 |
Family
ID=48720602
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201310135328.XA Active CN103198021B (en) | 2013-04-18 | 2013-04-18 | A kind of method improving solid state disk data transmission efficiency |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103198021B (en) |
Families Citing this family (7)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103425602B (en) * | 2013-08-15 | 2017-09-08 | 深圳市江波龙电子有限公司 | A kind of method, device and the host computer system of data of flash memory storage equipment read-write |
| CN106557277B (en) * | 2015-09-30 | 2019-07-19 | 成都华为技术有限公司 | The reading method and device of disk array |
| CN106775477B (en) * | 2016-12-19 | 2021-01-01 | 湖南国科微电子股份有限公司 | SSD (solid State disk) master control data transmission management device and method |
| CN109117098A (en) * | 2018-09-27 | 2019-01-01 | 郑州云海信息技术有限公司 | A kind of method of improve data transfer performance in solid state hard disk |
| CN110232139B (en) * | 2019-06-13 | 2021-07-27 | 山东华翼微电子技术股份有限公司 | SOC data management method suitable for embedded software |
| CN111159075B (en) * | 2019-12-31 | 2021-11-05 | 成都海光微电子技术有限公司 | Data transmission method and data transmission device |
| CN115310618B (en) * | 2022-08-09 | 2024-07-19 | 北京百度网讯科技有限公司 | Quantum noise elimination method and device in quantum operation, electronic equipment and medium |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102156753A (en) * | 2011-04-29 | 2011-08-17 | 中国人民解放军国防科学技术大学 | Data page caching method for file system of solid-state hard disc |
| CN103049397A (en) * | 2012-12-20 | 2013-04-17 | 中国科学院上海微系统与信息技术研究所 | Method and system for internal cache management of solid state disk based on novel memory |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7356641B2 (en) * | 2001-08-28 | 2008-04-08 | International Business Machines Corporation | Data management in flash memory |
-
2013
- 2013-04-18 CN CN201310135328.XA patent/CN103198021B/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102156753A (en) * | 2011-04-29 | 2011-08-17 | 中国人民解放军国防科学技术大学 | Data page caching method for file system of solid-state hard disc |
| CN103049397A (en) * | 2012-12-20 | 2013-04-17 | 中国科学院上海微系统与信息技术研究所 | Method and system for internal cache management of solid state disk based on novel memory |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103198021A (en) | 2013-07-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103198021B (en) | A kind of method improving solid state disk data transmission efficiency | |
| US10628326B2 (en) | Logical to physical mapping | |
| CN103049397B (en) | A kind of solid state hard disc inner buffer management method based on phase transition storage and system | |
| CN103678169B (en) | A kind of method and system of efficiency utilization solid-state disk buffer memory | |
| CN103150258B (en) | Writing, reading and garbage collection method of solid-state memory system | |
| CN107368436B (en) | Flash memory cold and hot data separated storage method combined with address mapping table | |
| CN103984736B (en) | Efficient buffer management method for NAND flash memory database system | |
| CN107239230A (en) | The many hash tables of hop-scotch of the optimization of duplicate removal application are embedded for efficient memory | |
| US20170300423A1 (en) | Wear leveling in storage devices | |
| US20110231598A1 (en) | Memory system and controller | |
| CN103902669B (en) | A kind of separate type file system based on different storage mediums | |
| CN103838853B (en) | Mixed file system based on different storage media | |
| CN103136121A (en) | Cache management method for solid-state disc | |
| CN109918316B (en) | Method and system for reducing FTL address mapping space | |
| US9898413B2 (en) | Auto-adaptive system to implement partial write buffering for storage systems dynamic caching method and system for data storage system | |
| CN105094709A (en) | Dynamic data compression method for solid-state disc storage system | |
| CN113377690B (en) | Solid state disk processing method suitable for user requests of different sizes | |
| CN105389135A (en) | Solid-state disk internal cache management method | |
| CN105005510B (en) | Error correction protection architecture and method applied to solid state disk resistance-variable storing device caching | |
| CN109240944B (en) | A data read and write method based on variable length cache line | |
| US20100064095A1 (en) | Flash memory system and operation method | |
| CN103309815A (en) | Method and system for increasing available capacity and service life of solid state disc | |
| CN102999441B (en) | Fine granularity memory access method | |
| CN103488582B (en) | Write the method and device of cache memory | |
| CN102681792B (en) | Solid-state disk memory partition method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant | ||
| TR01 | Transfer of patent right |
Effective date of registration: 20191024 Address after: Room 10506, building C, Xi'an National Digital publishing base, No. 996, Tiangu 7th Road, office, Yuhua street, hi tech Zone, Xi'an City, Shaanxi Province Patentee after: Yaoyun Technology (Xi'an) Co.,Ltd. Address before: 100081 No. 5, Zhongguancun South Street, Haidian District, Beijing Patentee before: BEIJING INSTITUTE OF TECHNOLOGY |
|
| TR01 | Transfer of patent right | ||
| PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Method for improving data transmission efficiency of solid state disk Effective date of registration: 20210823 Granted publication date: 20150805 Pledgee: Xi'an investment and financing Company limited by guarantee Pledgor: Yaoyun Technology (Xi'an) Co.,Ltd. Registration number: Y2021610000214 |
|
| PE01 | Entry into force of the registration of the contract for pledge of patent right | ||
| PC01 | Cancellation of the registration of the contract for pledge of patent right |
Date of cancellation: 20221018 Granted publication date: 20150805 Pledgee: Xi'an investment and financing Company limited by guarantee Pledgor: Yaoyun Technology (Xi'an) Co.,Ltd. Registration number: Y2021610000214 |
|
| PC01 | Cancellation of the registration of the contract for pledge of patent right |