Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Reading Writing a Physical Block - Database Management - Lecture Slides, Slides of Introduction to Database Management Systems

Reading a physical Block, Writing a physical Block, Limitation of biosdisk, Extended BIOS functions, Highest biosdisk capacity, Highest IDE capacity, LBA Translation Method are the main points in this lecture.

Typology: Slides

2011/2012

Uploaded on 11/03/2012

dharmaraaj
dharmaraaj 🇮🇳

4.4

(65)

153 documents

1 / 17

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Lecture 26
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Reading Writing a Physical Block - Database Management - Lecture Slides and more Slides Introduction to Database Management Systems in PDF only on Docsity!

  • Lecture

Reading/Writing a physical Block

  • BiosDisk(int cmd, int drive, int head, int track, int sector, int nsects, void * buffer); Cmd 0 = disk reset 1 = disk status (status of last disk operation) 2 = disk read 3 = disk write 4 = disk verify 5 = disk format

Reading Writing a physical Block

#include <bios.h> #include <dos.h> FILE *fp; unsigned char buf[512]; unsigned char st[60]; unsigned char headno[10]; unsigned char secno[10]; unsigned char trackno[10]; void main (void) { int i ; for (i=0;i<512;i++) buf[i]=0;

Cont…

gets(st); fp=fopen(st,"wb"); printf("Head "); gets(headno); puts (headno); printf("\nsector "); gets(secno); puts(secno); printf("\ntrack "); gets(trackno); puts(trackno);

Limitation of biosdisk

  • Biosdisk() calls int 13H/0/1/2/3/4/
  • Details of 13H services used by Biosdisk()
  • On Entry AH = service # AL=No. of sectors BX = offset address of data buffer CH = track # CL = sector # DH = head/side # DL = Drive # ES = Segment Address of buffer.

Limitation of biosdisk()

  • Large sized disk are available now with thousands of tracks
  • But this BIOS routine only is capable of accessing a max. of 1024 tracks.
  • Hence if a large disk is being used not whole of the disk can be accessed using this routine.

Extended BIOS functions

BIOS IDE Limit

Max Sec 63 255 63

Max heads

256 16 16

Max Capacity

1024 65536 1024

Highest biosdisk() capacity

  • Hence the highest capacity of disk can be accessed using bios functions is
  • 63x16x1024x512= 504 MB approx.

LBA Translation Method

  • Each unique combination of three parameters is assigned a unique index as shown below
  • Firstly all the sectors of a cylinder are indexed for head=0, then when whole track has been indexed the sector in the track of same cylinder with head =1 are indexed and so on up till the end of all heads When done with one cylinder the same is repeated for the next cylinder till the end of cylinders

LBA Translation method

Cylinder head sec 0 0 1 = 0 0 0 2 = 1 0 0 3 = 2 …. …. … …. 0 0 63 = 62 0 1 1 = 63 0 1 2 = 64 …. …. … …. 0 2 1 = 126

LBA to CHS translation

  • Conversely LBA address can be translated into CHS address cylinder = LBA / (heads_per_cylinder * sectors_per_track)

temp = LBA % (heads_per_cylinder * sectors_per_track)

head = temp / sectors_per_track sector = temp % sectors_per_track + 1

Disk Address Packet

Offset Size Description 0 Byte Size, Should not be less than 16

1 Byte Reserved 2 Byte No. of blocks to transfer, Max value no greater than 7FH 3 Byte Reserved 4 Double Word

Far address of buffer

8 Quad word

LBA address