13.07.2015 Views

13.1 through 13.5, 13.10 and 13.11

13.1 through 13.5, 13.10 and 13.11

13.1 through 13.5, 13.10 and 13.11

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

13.4 Placinq File Records on Disk475\<strong>and</strong>Br,.l D arenultiple,till runcan run!'SSOr lShen the,rired toonce its,sor canrique isi blocks_>A;SA----->_'.'->mefrom disk to memory. Double buffering perrnits continuous reading or writing ofdata on consecutive disk blocks, which elirninates the seek time <strong>and</strong> rotational delayfor all but the first block transfer. Moreover, data is kept ready for processing, thusreducing the lvaiting time in the programs.13.4 Placing File Records on DiskIn this section, we define the concepts of records, record types, <strong>and</strong> files. Then rvediscuss techniques for placing file records on disk.13.4.1 Records <strong>and</strong> Record TypesData is usuallystored in the form of records. Each record consists of a collection ofrelated data values or items, where each value is formed of one or more bytes ar-rdcorresponds to a particular field of the record. Records usually describe entities <strong>and</strong>their attributes. For example, an EMPLOYEE record represents an employee entity,<strong>and</strong> each field value in the record specifies some attribute of that employee, such asName, Birlh date, Salary, or Supervisor. A collection of field names <strong>and</strong> their correspondingdata types constitutes a record type or record format definition. A datatype, associated with each field, specifies the types of values a field can take.The data type of a field is usually one of the st<strong>and</strong>ard data types used in programming.These include nuneric (integer, long integer, or floating point), string ofcharacters (fixed-length or varying), Boolean (having 0 <strong>and</strong> I or TRUE <strong>and</strong> FALSEvalues only), <strong>and</strong> sometimes specially coded date <strong>and</strong> time data types. The numberof bytes required for each data type is fixed for a given computer system. An integermayrequire4bytes,alonginteger8bytes,arealnumber4bytes,aBooleanlbyte,a date l0 bytes (assuming a format of YY\Y-MM-DD), <strong>and</strong> a fixed-length string ofk characters k bytes. Variable-length strings may require as many bytes as there arecharacters in each field value. For exampie, an EMPLOYEE record type may bedefined-using the C progran-rrning language notation-as the following structure:structIi^hrrchar'in+employee{n^m6r ?n I .ssn[9]ic^l^rrr.int job_code;char department [ 20 ] ;In recent database applications, the need may arise for storing data items that consistof large unstructured objects, which represent images, digitized video or audiostreams, or free text. These are referred to as BLOBS (Binary Large Objects). ABLOB data item is typically stored separately from its record in a pool of disk blocks,<strong>and</strong> a oointer to the BLOB is included in the record.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!