This repository contains Python implementations of three prominent Database Concurrency Control algorithms: Two-Phase Locking (2PL), Optimistic Concurrency Control (OCC), and Multi-Version Concurrency Control (MVCC). These algorithms play a crucial role in managing the concurrent access of transactions to a database to ensure consistency and isolation.
The Two-Phase Locking algorithm is a classic concurrency control protocol that uses locks to enforce consistency during the execution of transactions.
Optimistic Concurrency Control (OCC) is a concurrency control strategy employed in database management systems to facilitate concurrent access by multiple transactions. Unlike traditional locking mechanisms, OCC allows transactions to proceed without acquiring locks during their execution phase.
Multi-Version Concurrency Control (MVCC) is a sophisticated concurrency control mechanism widely employed in database management systems, offering a balance between high concurrency and data consistency. MVCC enables multiple versions of a database record to coexist concurrently, each associated with a specific transaction timestamp.
- Clone the github repository https://github.com/Enliven26/Tubes-IF3140.
- Move to the repository folder
cd local/path/to/Tubes-IF3140
- Move to src folder to run the program.
cd src
python main.py
atau
cd src
python test.py
R [TRANSACTION ID] [RESOURCE ID]
W [TRANSACTION ID] [RESOURCE ID]=[INTEGER UPDATE VALUE]
C [TRANSACTION ID]
cd src
python main.py
Note:
- File name is the file with location relative to the src/input folder.
- Extension in file name input is not required and all extension other than .txt will be overridden.
- Program will output transaction processes in the console.