buffer
蛋白储存buffer条件

蛋白储存buffer条件
1. 低温储存:蛋白应该以冷冻或低温的方式储存,通常在-
20°C或更低的温度下。
低温可以防止蛋白质降解、失活或产
生聚集。
2. pH适宜:选择适当的缓冲液来调节蛋白的pH值。
pH过高
或过低都可能导致蛋白质失活或聚集,因此应选择pH稳定的
缓冲液。
3. 高盐浓度:加入适当浓度的盐可以增加蛋白在储存过程中的稳定性,减少蛋白质聚集或失活的风险。
4. 防止冻融循环:频繁冻融会导致蛋白质的失活和降解。
因此,应该避免反复的冻结和解冻,一次性分装成适量的小份,以减少冻融次数。
5. 避光:蛋白质容易受到光照的影响而降解,所以应该避免阳光直射或强光照射。
6. 无菌条件:储存容器和使用过程中应保持无菌,以防止细菌或其他微生物的污染。
7. 添加保护剂:可以在蛋白储存buffer中添加一些保护剂,如甘油、蔗糖、D-己糖等,以增加蛋白质的稳定性和储存寿命。
尽管以上条件是通用的蛋白储存buffer条件,但具体的储存条件仍需根据具体蛋白质的特性和研究要求来确定。
Buffer(缓冲区)

# Name: Buffer.py # Description: Find areas of suitable vegetation which exclude areas heavily impacted by major roads # Author: ESRI
有关融合类型 ALL 和 LIST 的工作原理的详细信息,请参考融合工具的相关文档。
如果要素的缓冲距离是零,则要素将从缓冲过程中排除。
由于创建缓冲区所用算法的差异,左侧缓冲区或右侧缓冲区的缓冲区边与完全缓冲区创建的缓冲区边略有不同。两 者之间的差异在于输入要素的精度范围。
融合字段参数“添加字段”按钮仅在“模型构建器”中使用。在模型构建器中,如果前面的工具尚未运行或其派生 的数据不存在,则可能不会使用字段名称来填充融合字段参数。“添加字段”按钮可用于将所需字段添加到融合字段 列表,以完成“缓冲区”工具对话框。
如果将融合类型选项设置为 ALL 或 LIST,则“缓冲区”工具可创建非常大的多部分 (multipart) 面要素。当使 用的融合字段包含少量的唯一值或者在将所有面融合为单个面时尤其如此。如果面要素非常大,则在地图上绘制或 编辑要素时,可能会引起显示故障并降低性能。要避免这些潜在问题,可使用“缓冲区”工具输出的多部分 (multipart)至单部分(singlepart) 将较大的多部分要素分割为多个较小要素。
许可: 此可选参数不适用于 ArcView 或 ArcEditor 级别许可。
line_end_type (可选)
线输入要素末端的缓冲区形状。此参数对于面输入要素无效。
ROUND —缓冲区的末端为圆形,即半圆形。这是默认设 置。
缓冲流buffer的用途原理

缓冲流buffer的用途原理
缓冲流(BufferedStream)是数据流的一种封装,用于提高读写性能和减少系统调用次数。
它通过在内存中创建一个缓冲区来存储数据,然后将数据从缓冲区一次性读写到磁盘或网络中。
缓冲流的主要用途和原理如下:
1. 提高读写性能:由于磁盘或网络读写的速度相对较慢,而内存读写的速度相对较快,所以使用缓冲流可以减少磁盘或网络读写操作的次数,从而提高读写效率。
2. 减少系统调用次数:每次进行磁盘或网络读写操作时,系统都需要进行一定的额外开销,如寻址、访问权限检查等。
使用缓冲流可以将多个读写操作合并成一个,从而减少系统调用次数,提高效率。
3. 自动线程同步:缓冲流在多线程环境下具有自动线程同步的功能,可以在多个线程之间正确地协调读写操作,避免数据竞争和一致性问题。
缓冲流的工作原理如下:
1. 数据写入缓冲区:当需要写入数据时,缓冲流会将数据暂时写入内存中的缓冲区,而不是直接写入磁盘或网络。
2. 缓冲区满或手动刷新时,数据写入目标:当缓冲区满了,或者调用了缓冲流的刷新方法(如flush方法)时,缓冲流会将缓冲区中的数据一次性写入磁盘或网络中。
3. 数据读取缓冲区:当需要读取数据时,缓冲流会先将数据从磁盘或网络中读取到内存的缓冲区中。
4. 缓冲区空或手动填充时,数据读取目标:当缓冲区为空时,或者调用了缓冲流的填充方法(如readLine方法)时,缓冲流会从磁盘或网络中读取足够的数据填充缓冲区,然后返回需要的数据。
总之,缓冲流通过在内存中创建一个缓冲区,将数据暂时存储在缓冲区中,从而提高读写性能、减少系统调用次数,并提供自动线程同步的功能。
JAVA中的Buffer

JAVA中的Buffer⼀、属性Buffer有四个基本属性: 1、capacity 容量,buffer能够容纳的最⼤元素数⽬,在Buffer创建时设定并不能更改 2、limit buffer中有效位置数⽬,不能对超过limit中的区域进⾏读写。
3、position 下⼀个读或者写的位置 4、mark ⽤于记忆的标志位,配合reset()使⽤,初始值未设定,调⽤mark后将当前position设为值四者关系:0 <= mark <= position <= limit <= capacity2.直接与⾮直接缓冲区 字节缓冲区要么是直接的,要么是⾮直接的。
如果为直接字节缓冲区,则Java虚拟机会尽最⼤努⼒直接在此缓冲区上执⾏本机 I/O 操作。
也就是说,在每次调⽤基础操作系统的⼀个本机 I/O 操作之前(或之后),虚拟机都会尽量避免将缓冲区的内容复制到中间缓冲区中(或从中间缓冲区中复制内容)。
直接字节缓冲区可以通过调⽤此类的allocateDireact()⼯⼚⽅法来创建。
此⽅法返回的缓冲区进⾏分配和取消分配所需成本通常⾼于⾮直接缓冲区。
直接缓冲区的内容可以驻留在常规的垃圾回收堆之外,因此,它们对应⽤程序的内存需求量造成的影响可能并不明显。
所以,建议将直接缓冲区主要分配给那些易受基础系统的本机 I/O 操作影响的⼤型、持久的缓冲区。
⼀般情况下,最好仅在直接缓冲区能在程序性能⽅⾯带来明显好处时分配它们。
直接字节缓冲区还可以通过mapping将⽂件区域直接映射到内存中来创建。
Java平台的实现有助于通过JNI从本机代码创建直接字节缓冲区。
如果以上这些缓冲区中的某个缓冲区实例指的是不可访问的内存区域,则试图访问该区域不会更改该缓冲区的内容,并且将会在访问期间或稍后的某个时间导致抛出不确定的异常。
字节缓冲区是直接缓冲区还是⾮直接缓冲区可通过调⽤其isDirect()⽅法来确定。
学习笔记—Buffer的常用方法与实现

学习笔记—Buffer的常⽤⽅法与实现⽇常的学习笔记,包括 ES6、Promise、Node.js、Webpack、http 原理、Vue全家桶,后续可能还会继续更新 Typescript、Vue3 和常见的⾯试题等等。
Buffer参考⽂献缓冲区Buffer是暂时存放输⼊输出数据的⼀段内存。
JS没有⼆进制数据类型,⽽在处理TCP和⽂件流的时候,必须要处理⼆进制数据。
所以Node提供了⼀个Buffer对象来提供对⼆进制数据的操作。
Buffer表⽰固定内存分配的全局对象,也就是说要放到缓存区中的字节数需要提前确定。
⽽Buffer好⽐由⼀个8位字节组成的数组,可以有效的在JavasScript中表⽰⼆进制数据。
Buffer简单来说就是node中的16进制,但Buffer在内存的标识也会全部使⽤2进制来进⾏表⽰。
(注:⽬前以⽆法使⽤new Buffer()创建 Buffer 实例,会存在安全性等问题。
已被禁⽌使⽤。
)Buffer.allocBuffer代表的是内存,⼀旦声明好,就不能进⾏更改。
如果想要更改Buffer的⼤⼩,改⼩则对内存进⾏截取。
改⼤的话就需要创建⼀个更⼤的内存空间,将数据拷贝进⾏,也就是我们俗称的扩容。
这时候就可以⽤到Buffer类的内置⽅法,Buffer.alloc()。
Buffer.alloc(size[, fill[, encoding]]),表⽰分配size个字节的新Buffer。
如果fill为undefined,则Buffer将以零填充。
size:新的Buffer所需的长度。
fill:⽤于预填充新Buffer的值,默认值为0。
encoding:如果fill是字符串,则这就是它的编码。
默认值为utf8。
// 创建了⼀个指定长度的buffer实例let buf1 = Buffer.alloc(3); // 最⼩单位是 3字节console.log(buf1); // <Buffer 00 00 00>let buf2 = Buffer.alloc(6); // 单位是 6console.log(buf2); // <Buffer 00 00 00 00 00 00>Buffer.from上⼀篇⽂章中,我们曾经使⽤Buffer.from来创建过。
buffer商务用法

buffer商务用法JavaScript对字符串处理十分友好,无论是宽字节还是单字节字符串,都被认为是一个字符串。
Node中需要处理网络协议、操作数据库、处理图片、文件上传等,还需要处理大量二进制数据,自带的字符串远不能满足这些要求,因此Buffer 应运而生。
Buffer结构Buffer是一个典型的Javascript和C++结合的模块,性能相关部分用C++实现,非性能相关部分用javascript实现。
Node在进程启动时Buffer就已经加装进入内存,并将其放入全局对象,因此无需requireBuffer对象:类似于数组,其元素是16进制的两位数。
Buffer内存分配Buffer对象的内存分配不是在V8的堆内存中,在Node的C++层面实现内存的申请。
为了高效的使用申请来得内存,Node中采用slab分配机制,slab是一种动态内存管理机制,应用各种*nix操作系统。
slab有三种状态:(1) full:完全分配状态(2) partial:部分分配状态(3) empty:没有被分配状态Buffer的转换Buffer对象可以和字符串相互转换,支持的编码类型如下:ASCII、UTF-8、UTF-16LE/UCS-2、Base64、Binary、Hex字符串转Buffernew Buffer(str, [encoding]),默认UTF-8buf.write(string, [offset], [length], [encoding])Buffer转字符串buf.toString([encoding], [start], [end])Buffer不支持的编码类型通过Buffer.isEncoding(encoding)判断是否支持iconv-lite:纯JavaScript实现,更轻量,性能更好无需C++到javascript的转换iconv:调用C++的libiconv库完成Buffer的拼接注意"res.on('data', function(chunk) {})",其中的参数chunk是Buffer对象,直接用+拼接会自动转换为字符串,对于宽字节字符可能会导致乱码产生,解决方法:(1) 通过可读流中的setEncoding()方法,该方法可以让data事件传递不再是Buffer对象,而是编码后的字符串,其内部使用了StringEncoder模块。
buffer函数

buffer函数buffer函数是一个用于数据缓存的函数,它可以用来存储和操作任意类型的数据,包括文本、二进制、图像和音频等。
buffer函数广泛应用于计算机编程和系统开发领域。
本文将详细介绍buffer函数的概念、使用方法和典型应用场景。
一、概述buffer函数是Node.js提供的一个核心模块,用来处理二进制数据。
在Node.js中,数据通常以Buffer对象的形式进行传输和存储。
Buffer对象类似于整数数组(integer array),但是可以存储不同长度的数据类型。
它与JavaScript原生的数据类型不同,可以表示任意字节的数据,常常被用来处理网络流、文件系统操作、图片处理等。
Buffer函数本身是一个构造函数,用于生成新的Buffer对象。
Buffer对象有以下主要属性和方法:(1)length:返回Buffer对象的长度。
(2)toString(encoding):将Buffer对象转换为字符串,encoding为编码方式,默认为utf8编码。
(3)slice(start, end):返回一个新的Buffer对象,并复制原Buffer对象中指定范围内的数据。
二、使用方法Buffer函数的使用方法很简单,只需通过new关键字创建一个Buffer对象即可。
例如,创建一个长度为10个字节的Buffer对象,可以使用以下语句:var buf = new Buffer(10);这会创建一个长度为10的空的Buffer对象,可以通过以下语句向其中写入数据:buf.write("Hello");Buffer对象的内容为"H e l l o \0 \0 \0 \0 \0"。
需要注意的是,在Node.js版本6之后,Buffer对象的创建方法已经发生了变化。
在Node.js6及以上版本中,可以使用以下语句来创建Buffer对象:这会创建一个长度为10的空的Buffer对象,不同于采用new Buffer()创建对象的方法,在此方法下,所有的空间都将会被初始为0,避免了未知的数据的影响。
乒乓buffer原理

乒乓buffer原理乒乓buffer是一种常见的缓冲技术,它在计算机系统中起着非常重要的作用。
乒乓buffer的原理是通过交替使用两个缓冲区来实现数据传输的平滑流动,从而提高系统的效率和稳定性。
在计算机系统中,数据传输是一个非常常见的操作。
例如,在网络传输中,数据包需要从发送端传输到接收端;在磁盘读写中,数据需要从磁盘读取到内存或者从内存写入到磁盘。
这些数据传输过程中,如果没有合适的缓冲机制,就容易出现数据丢失、数据传输过慢等问题。
乒乓buffer的工作原理是通过交替使用两个缓冲区来实现数据传输的平滑流动。
具体来说,当一个缓冲区正在被写入数据时,另一个缓冲区可以同时被读取数据。
这样就避免了写入和读取操作的冲突,提高了数据传输的效率。
乒乓buffer的应用非常广泛。
在网络传输中,乒乓buffer可以用于实现流媒体的平滑播放,避免视频卡顿或者音频中断的情况发生。
在磁盘读写中,乒乓buffer可以用于提高读写速度,减少磁盘访问的时间。
在图形处理中,乒乓buffer可以用于实现双缓冲技术,避免屏幕闪烁或者画面撕裂的问题。
乒乓buffer的原理非常简单,但是实现起来需要考虑很多细节。
首先,需要确定两个缓冲区的大小,以及数据的读取和写入速度。
其次,需要设计合适的算法来实现数据的交替传输。
最后,需要考虑异常情况的处理,例如当一个缓冲区已满或者已空时,应该如何处理数据的丢失或者延迟。
乒乓buffer的原理虽然简单,但是在实际应用中起着非常重要的作用。
它可以提高系统的效率和稳定性,避免数据传输的冲突和延迟。
因此,在设计计算机系统或者开发软件时,乒乓buffer都是一个非常值得考虑的技术。
总结一下,乒乓buffer是一种通过交替使用两个缓冲区来实现数据传输的平滑流动的技术。
它可以提高系统的效率和稳定性,避免数据传输的冲突和延迟。
在实际应用中,乒乓buffer被广泛应用于网络传输、磁盘读写和图形处理等领域。
乒乓buffer的原理虽然简单,但是在实际应用中需要考虑很多细节,例如缓冲区的大小、数据的读写速度和异常处理等。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Storage and Buffer Manager Lab DescriptionFor “Database System Implementation”March, 2016TABLE OF CONTENTSINTRODUCTION (3)BUFFER AND FRAMES (3)B UFFER AND F RAME S IZES (3)BUFFER AND FRAME STORAGE STRUCTURES (3)PAGE FORMAT (4)FILE FORMAT (4)BUFFERING TECHNIQUE (4)HASHING TECHNIQUE (4)FILE STORAGE (5)CLASS DESIGN (5)D ATA S TORAGE M ANAGER (5)B UFFER M ANAGER (6)BUFFER INTERFACE FUNCTIONS (7)F IX P AGE(INT PAGE_ID, INT PROT) (7)F IX N EW P AGE() (7)U NFIX P AGE(INT PAGE_ID) (7)N UM F REE F RAMES() (7)S ELECT V ICTIM() (7)H ASH(INT PAGE_ID) (7)R EMOVE BCB(BCB* PTR, INT PAGE_ID) (8)R EMOVE LRUE LE(INT FRID) (8)S ET D IRTY(INT FRAME_ID) (8)U NSET D IRTY(INT FRAME_ID) (8)W RITE D IRTYS() (8)P RINT F RAME(INT FRAME_ID) (8)DATA STORAGE INTERFACE FUNCTIONS (8)O PEN F ILE(STRING FILENAME) (8)C LOSE F ILE() (9)R EAD P AGE(INT PAGE_ID) (9)W RITE P AGE(INT FRAME_ID, B F RAME FRM) (9)S EEK(INT OFFSET, INT POS) (9)G ET F ILE() (9)I NC N UM P AGES() (9)G ET N UM P AGES() (9)S ET U SE(INT PAGE_ID, INT USE_BIT) (9)G ET U SE(INT PAGE_ID) (10)EXPERIMENT SETUP (10)IMPLEMENTATION PLAN (11)IntroductionIn this project, we will implement a simple storage and buffer manager. The document addresses the storage and buffer manager. Buffer and frame sizes, buffer and frame storage structures, page formats, page storage structures, file formats, buffering techniques, hashing techniques, file storage structures, and interface functions for the disk space and buffer modules will be discussed . The particular technique is chosen from the material covered in class that are relevant to buffer and storage manager. Buffer and FramesBuffer and Frame SizesBuffer refers to the space in main memory. CPU can only access the contents present in main memory. The buffer consists of an array of frames. When a page is requested it is loaded up into memory in the buffer. Most commercial database management systems make the frame size the same as the size of a page in order to prevent external fragmentation. The same strategy is employed in the project. The buffer size by default will be set to 1024 for the project.Buffer and Frame Storage StructuresBuffer is made up of logical partitions called as frames.The frame will be stored in a globally defined structure, describing what a frame will look like. This structure will be defined as#define FRAMESIZE 4096struct bFrame{Char field [FRAMESIZE ];};The buffer array will store a series of frames that will store the pages that are loaded in it. This array will look as follows:#define DEFBUFSIZE 1024bFrame buf[DEFBUFSIZE]; // or the size that the user defined by the input parameterThis will be the space allocated for the buffer that will be accessed by the buffer manager and file and access methods to reference a required page.Page FormatIn this project, we need not refer to the detailed structure of a page. The only mattered information is the page_id and page_size. So you need not design page format.File FormatWe recommend using the directory based structure to organize the database file, as introduced in the class. Every file has a base page that contains a pointer to every page in the file. Each pointer in the base page sits in order for the pages. Data pages in this type of file do not have pointers, only records. The base page, or directory, must be consulted in order to get the next page in the file.The Directory Based file format was chosen because it seemed to suite itself to finding specific pages for the records that are requested. The directory base for the file will allow for quick access to the correct page without having to search a long list of pages to get to the correct one.Buffering TechniqueWe choose LRU as the only replacement policy in our lab. LRU always evicts the least-recently-used page from an LRU queue used to organize the buffer pages which are ordered by time of their last reference. It always selects as a victim the page found at the LRU position. The most important advantage of LRU is its constant runtime complexity. Furthermore, LRU is known for its good performance in case of reference patterns having high temporal locality, i.e., currently referenced pages have a high re-reference probability in the near future.Hashing TechniqueFor each frame in the buffer, a buffer control block must be kept. Each buffer control block, or BCB, contains a page_id, a frame_id, page_latch, fix_count, and dirty_bit. The page_ids are used as the key into a hashing function that will map the page_id to a BCB. Two hash tables must be kept: one to map page_ids to frame_ids and BCB’s and one that maps frame_ids to page_ids.We suggest using the simple Static Hashing technique. In Static hashing the number of buckets is fixed. If a bucket is full, an overflow chain is connected for the extra data entries. Using the key value, the hashing function maps it to a bucket. And to search within an individual bucket sequential search is used. The number of buckets does not change as time progresses .The Static hashing technique for hash tables. The hashing function will look like: H(k) = (page_id)%buffer_sizeBuffer Control Blocks will contain page_id, frame_id, latch, count, dirty_bit.The hash table for the page_id to BCB will look like: BCB hTable[BufferSize].The table for the frame_id to page_id will look like: int hTable[BufferSize].struct BCB{BCB();int page_id;int frame_id;int latch;int count;int dirty;BCB * next;};File StorageIn our project, we need only one physical file on the disk. All data in the database will be kept in this single file. This file will be kept in the working directory and will be named data.dbf. This file should always be found, even if it is empty, which it will be when the system is run for the first time.Class DesignData Storage Managerclass DSMgr{public:DSMgr();int OpenFile(string filename);int CloseFile();bFrame ReadPage(int page_id);int WritePage(int frame_id, bFrame frm);int Seek(int offset, int pos);FILE * GetFile();void IncNumPages();int GetNumPages();void SetUse(int index, int use_bit);int GetUse(int index);private:FILE *currFile;int numPages;int pages[MAXPAGES];};Buffer Managerclass BMgr{public:BMgr();// Interface functionsint FixPage(int page_id, int prot);void NewPage FixNewPage();int UnfixPage(int page_id);int NumFreeFrames();// Internal Functionsint SelectVictim();int Hash(int page_id);void RemoveBCB(BCB * ptr, int page_id);void RemoveLRUEle(int frid);void SetDirty(int frame_id);void UnsetDirty(int frame_id);void WriteDirtys();PrintFrame(int frame_id);private:// Hash Tableint ftop[DEFBUFSIZE];BCB* ptof[DEFBUFSIZE];};Buffer Interface FunctionsThese interface functions will provide an interface to the file and access manager above it. The functions required are:FixPage(int page_id)The prototype for this function is FixPage(Page_id) and it returns a frame_id. The file and access manager will call this page with the page_id that is in the record_id of the record. The function looks to see if the page is in the buffer already and returns the corresponding frame_id if it is. If the page is not resident in the buffer yet, it selects a victim page, if needed, and loads in the requested page.FixNewPage()The prototype for this function is FixNewPage() and it returns a page_id and a frame_id. This function is used when a new page is needed on an insert, index split, or object creation. The page_id is returned in order to assign to the record_id and metadata. This function will find an empty page that the File and Access Manager can use to store some data.UnfixPage(int page_id)The prototype for this function is UnfixPage(page_id) and it returns a frame_id. This function is the compliment to a FixPage or FixNewPage call. This function decrements the fix count on the frame. If the count reduces to zero, then the latch on the page is removed and the frame can be removed if selected. The page_id is translated to aframe_id and it may be unlatched so that it can be chosen as a victim page if the count on the page has been reduced to zero.NumFreeFrames()NumFreeFrames function looks at the buffer and returns the number of buffer pages that are free and able to be used. This is especially useful for the N-way sort for the query processor. The prototype for the function looks like NumFreeFrames() and returns an integer from 0 to BUFFERSIZE-1(1023).SelectVictim()SelectVictim function selects a frame to replace. If the dirty bit of the selected frame is set then the page needs to be written on to the disk.Hash(int page_id)Hash function takes the page_id as the parameter and returns the frame id.RemoveBCB(BCB* ptr, int page_id)RemoveBCB function removes the Buffer Control Block for the page_id from the array. This is only called if the SelectVictim() function needs to replace a frame. RemoveLRUEle(int frid)RemoveLRUEle function removes the LRU element from the list.SetDirty(int frame_id)SetDirty function sets the dirty bit for the frame_id. This dirty bit is used to know whether or not to write out the frame. A frame must be written if the contents have been modified in any way. This includes any directory pages and data pages. If the bit is 1, it will be written. If this bit is zero, it will not be written.UnsetDirty(int frame_id)UnsetDirty function assigns the dirty_bit for the corresponding frame_id to zero. The main reason to call this function is when the setDirty() function has been called but the page is actually part of a temporary relation. In this case, the page will not actually need to be written, because it will not want to be saved.WriteDirtys()WriteDirtys function must be called when the system is shut down. The purpose of the function is to write out any pages that are still in the buffer that may need to be written. It will only write pages out to the file if the dirty_bit is one.PrintFrame(int frame_id)PrintFrame function prints out the contents of the frame described by the frame_id.Data Storage Interface FunctionsThe current data file will be kept in the DSManager class. This file will be named as data.dbf.OpenFile(string filename)OpenFile function is called anytime a file needs to be opened for reading or writing. The prototype for this function is OpenFile(String filename) and returns an error code. The function opens the file specified by the filename.CloseFile()CloseFile function is called when the data file needs to be closed. The protoype is CloseFile() and returns an error code. This function closes the file that is in current use. This function should only be called as the database is changed or a the program closes.ReadPage(int page_id)ReadPage function is called by the FixPage function in the buffer manager. This prototype is ReadPage(page_id, bytes) and returns what it has read in. This function calls fseek() and fread() to gain data from a file.WritePage(int frame_id, bFrame frm)WritePage function is called whenever a page is taken out of the buffer. The prototype is WritePage(frame_id, frm) and returns how many bytes were written. This function calls fseek() and fwrite() to save data into a file.Seek(int offset, int pos)Seek function moves the file pointer.GetFile()GetFile function returns the current file.IncNumPages()IncNumPages function increments the page counter.GetNumPages()GetNumPages function returns the page counter.SetUse(int page_id, int use_bit)SetUse function looks sets the bit in the pages array. This array keeps track of the pages that are being used. If all records in a page are deleted, then that page is not really used anymore and can be reused again in the database. In order to know if a page is reusable, the array is checked for any use_bits that are set to zero. The fixNewPage function firsts checks this array for a use_bit of zero. If one is found, the page is reused. If not, a new page is allocated.GetUse(int page_id)GetUse function returns the current use_bit for the corresponding page_id.Experiment SetupIn our project, you are required to perform a trace-driven experiment to demonstrate your implemental result. The trace has been generated according to the Zipf distribution. There are total 500,000 page references in the trace, which are restricted to a set of pages whose numbers range from 0 to 49,999. Each trace record has the format as “x, ###”, where x is 0(read) or 1(write) and ### is the referenced page number. You are required to scan the trace file and print out the total I/Os between memory and disk. The buffer is supposed empty at the beginning of your experiment. All the 50,000 pages involved in the trace need to be first materialized in the disk, which corresponds to the directory-based file data.dbf.Implementation Plan。