Starting from:

$25

NF20210 - Assignment 2 - Solved

 


 
Exercise 1: Free Blocks                                                                                                  (10 Points)

Disk space managers use either a block list or a block bitmap to reference free and full database blocks on disk.

a)    Name both an advantage and drawback for each concept.

b)    Let’s say your database occupies 8192MB; all blocks are sized 16KB, and we use a block bitmap: how many KB are needed to reference all blocks?

c)    As block bitmaps are pretty small (see 1b), we can usually keep them in main memory. A single byte has 8 bits, so we store all bits in a byte array. Write some efficient Java code that checks if a particular block is free (i.e., the corresponding bit is 0), and that sets the bit at a given position in a byte array:

boolean blockFree(byte[] bitmap, int blockNr) { ... } void markBlock(byte[] bitmap, int blockNr, boolean free) { ... }

Use the class provided called Assignment02Group00.java and change “Group00” according to your group number. You can find the group number that was assigned to you on the course website. Submit only your modified source file.
Ï
Exercise 2: Buffer Management: OS vs DB                                                                       (4 Points)

Databases and Operating Systems share a number of concepts when it comes to the efficient access of data on hard disks.

a)    Invest some time for browsing books and web pages, and compile similarities between:

•    the virtual memory concept of operating systems and

•    the buffer management of databases

b)    Invest some more time and get creative: if you would write your own database...

•    would you rely on the existing OS features, or rather write your own buffer management?

•    what are the reasons for your choice?
-
Exercise 3: Measuring Performance                                                                                 (6 Points)
-
Run the Test class PerformanceTest.java in assignment02.zip a couple of times and take note about the reported run times.

a)    Describe in your own words what calculation the method measures. You can use mathematical notation if necessary.

b)    What do you observe regarding the reported run times? Try to find an explanation for what you observed.

c)    How would you fix the performance measurements? You do not need to submit code, but you can use examples to make your point.

More products