IT3142 - Database Administration Assignment 3 - Fall 2020: Student ID: 004 Name:Amina Arif Batch:2 Program:BS - IT

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

IT3142 – Database Administration

Assignment 3 – Fall 2020


Last Saved by: Mustahsan Hammad Naqvi
Instructions:
Student ID : 004
1. Type your name and Student ID at the places mentioned
2. Save the document with your student ID Name:Amina Arif
a. 12001020016 Ahmad Ahsan.zip
3. Upload your assignment through http://lms.skt.umt.edu.pk
Batch:2
4. No marks would be awarded if Program:BS.IT
a. Assignment is copied
b. File is corrupt/does not open
c. Submitted through email/in-person
d. Files in ZIP/RAR file are other than .cpp files

Attempt each question. Marks are specified with each question. 10 – Marks

Q 1. Why is accessing a disk block expensive? Discuss the time components involved in accessing a
disk block.
The data is arranged in an order and then stored in a block of the disk is said to be known as
blocking. The data can be transferred from the disk to the main memory in units.
Accessing the data in the main memory is less expensive than accessing the data in the disk. This is
due to the following components.
 Seek time
Seek time is defined as the time taken to move the disk heads to the track on which a
desired block is located. 
 Rotational latency
Rotational delay is defined as the waiting time for the desired block to rotate under the disk
head; it is the time required for half a rotation on average and is usually less than seek time.
 Block transfer time
Transfer time is defined as the time to actually read or write the data in the block once the
head is positioned, that is, the time for the disk to rotate over the block. 
So, access to data on disk is several orders of magnitude slower than is access to data in main
memory.
IT3142 – Database Administration

Assignment 3 – Fall 2020


Optimization techniques besides buffering blocks in the main memory.

 Non-volatile write buffer. Use nonvolatile RAM to speed up disk writes drastically


(first write to nonvolatile RAM buffer and inform OS that writes completed).
 Scheduling: If several blocks from a cylinder need to be transferred, we may save
time by requesting them in the order in which they pass under the heads.
 File organization. Organize blocks on disk in a way that corresponds closely to the
manner that we expect data to be accessed. For example, store related information
on the same track, or physically close tracks, or adjacent cylinders in order to
minimize seek time. IBM mainframe OS's provide programmers fine control on
placement of files but increase programmer's burden.
 PC OSs or UNIX hides disk organizations from users. After sometime, a sequential file
may become fragmented. So in this case, fragmentation can be reduced, by making a
backup copy by the system and restore the whole disk. The restore operation writes
back the blocks of each file continuously. Some systems, such as MS-DOS, have
utilities that scan the disk and then move blocks to decrease the fragmentation.
 Log disk. Log disk is also an approach to reduce write. Here, a disk devoted to writing
a sequential log. And all access to the log disk is sequential, essentially eliminating
seek time, and several consecutive blocks can be written at once, making writes to
log disk several times faster than random writes.

Q 2. What are the reasons for having variable-length records? What types of separator characters are
needed for each?

There are many reasons to add a variable-length field to a record. With variable length records there is
no space wastage. Special separator characters among the records are used to delineate variable length
records.

Design the table as having variable record length and put the “comments” field at the end of the record,
Add a comments field to a fixed record length table with a length of for example 256 bytes. Put the
comments in a separate table and join the tables with an auto increment column in the memo table.
One can be if one or more fields are of variable length.

A second would be if one or more fields have multiple values for individual records with repeating field.
Or one or more fields in a record are optional. A user can separate records of variable lengthens using
certain characters like $,? or % these don’t appear as values in the field. But can instead be used to
terminate the length field. It can be difficult to determine where one starts and another ends which is
why we use these special characters to make endings.

You might also like