0% found this document useful (0 votes)
26 views4 pages

Assignment 1 2

assignment 1

Uploaded by

emmanuel ouma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views4 pages

Assignment 1 2

assignment 1

Uploaded by

emmanuel ouma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

BCT/BAC/BIT: Distributed Databases

Assignments 1& 2

1. Suppose that your database system has failed. Describe

the database recovery process and the use of deferred-

write and write-through techniques. (3

marks)

Techniques Used in Database Recovery

1. Transaction Logging:
o Log file: Records all changes made to the database during a transaction.
o Types of logs:
▪ Undo log: Records before images of updated data.
▪ Redo log: Records after images of updated data.
2. Checkpointing:
o Periodically records the state of the database and the log file.
o Used to reduce recovery time after a failure.

I/O Techniques for Improved Recovery

1. Deferred-Write:
o Changes are first written to a buffer in memory.
o The buffer is written to disk at a later time, possibly when the buffer is full or when the
transaction commits.
o Advantages:
▪ Improves performance by reducing the number of disk I/O operations.
▪ Can reduce the impact of a system crash if the log is written to disk before the
data.
o Disadvantages:
▪ May result in data loss if the system crashes before the buffer is written to disk.
▪ Requires a write-ahead log (WAL) to ensure that the log is written to disk before
the data.
2. Write-Through:
o Changes are written to disk immediately after they are made.
o Advantages:
▪ Ensures that data is always consistent on disk.
▪ Reduces the risk of data loss in case of a system crash.
o Disadvantages:
▪ Can degrade performance by increasing the number of disk I/O operations.

Recovery Process Using Deferred-Write

1. Identify the last checkpoint: This determines the starting point for recovery.
2. Scan the log:
o Undo changes: For transactions that did not commit, undo the changes using the before
images recorded in the undo log.
o Redo changes: For transactions that committed but did not complete writing their
changes to disk, redo the changes using the after images recorded in the redo log.
3. Update the database: Apply the undone or redone changes to the database.

2. Discuss Distributed DBMS Architecture

- DBMS Standardization

- Architectural Models for DDBM’s

(4marks)

Distributed Database Management Systems (DDBMS) are systems where data is stored and
managed across multiple interconnected computers or nodes in a network. This offers several
advantages, including scalability, reliability, and improved performance.

DBMS Standardization

To ensure interoperability and compatibility between different DDBMS products, several


standards have been developed:
• SQL-92: This standard defines the syntax and semantics of SQL, the primary language used for
interacting with databases.
• ODBC (Open Database Connectivity): An API that allows applications to access various database
systems using a common interface.
• JDBC (Java Database Connectivity): A similar API for Java applications.
• ISO/IEC 12501: This standard defines the architecture of distributed databases.

Architectural Models for DDBMSs

There are primarily two architectural models for DDBMS:

1. Federated Database System:


o Characteristics:
▪ Independent DBMSs are interconnected through a federation layer.
▪ Each DBMS maintains its own autonomy and data integrity.
▪ Queries are typically translated and executed at the local DBMS.
o Advantages:
▪ Flexible and scalable.
▪ Can be implemented using existing DBMSs.
o Disadvantages:
▪ Performance can be affected due to query translation and data distribution.
▪ Limited data sharing and integration.
2. Distributed Database System:
o Characteristics:
▪ A single, integrated database is distributed across multiple nodes.
▪ A global schema is maintained.
▪ Queries can be executed across multiple nodes.
o Advantages:
▪ Improved performance through parallel processing.
▪ Enhanced data sharing and integration.
▪ Higher availability due to data replication.
o Disadvantages:
▪ More complex to design and implement.
▪ Requires careful management of data consistency and concurrency.

Subtypes of Distributed Database Systems:

• Partitioned Database: Data is divided into fragments and stored on different nodes based on
attributes or location.
• Replicated Database: Data is replicated across multiple nodes to improve availability and
performance.
• Hybrid Database: A combination of partitioned and replicated databases.

Factors to Consider When Choosing an Architectural Model:

• Data Distribution: How data is distributed across nodes.


• Query Processing: How queries are executed and optimized.
• Data Consistency: How data consistency is maintained across multiple nodes.
• Concurrency Control: How concurrent access to data is managed.
• Fault Tolerance: How the system handles failures and maintains availability.

3. Discuss Concurrency Control Algorithms

(3 marks)

Concurrency Control Algorithms (Brief)

Concurrency control algorithms ensure that multiple transactions can execute simultaneously
without interfering with each other.

• Pessimistic: Locks resources before accessing them.


• Optimistic: Assumes conflicts are rare and doesn't lock until ready to commit.
• Timestamp-Based: Uses timestamps to order transactions.
• Multiversion: Maintains multiple versions of data.

You might also like