The simulation times number of data blocks and longest read


One of the most important properties of database transaction management is consistency.

Synchronization of the reads and writes of data is a crucial step in achieving consistency. In this lab, please use SimPy to simulate database transaction reading and writing.

Your project should randomly generate read and write events that will read or write a set of data for a period of time.

The simulation times, number of data blocks, and longest read or write time period are set at the beginning of the simulation.

The simulation time needs to be at least 2xnumber of data blocks x longest read or write time Strategy 1: typically reader and writer: This is the typical strategy where there are multiple readers and a single writer Read Request: if there is no write lock on the data, then grant read lock for the period of time requested.

If there is a write lock, then wait till the read lock is free and it is the reader's turn. Write Request: if there is no write lock on the data, then grant write lock for the period of time requested.

If there is a write lock, then wait till the write lock is free and it is the writers' turn. Lab A: Utilizing this strategy there is still a chance for starvation.

Please suggest and implement a solution that would avoid starvation. Strategy 2: invalid dirty write This approach assumes that the likelihood of write conflict is rare.

Thus, locks to read or write are not acquired, but rather the timestamp of the last read/write is used.

If the time stamp of the last read/write is after the start of the current write, the write is invalidated and the write transaction is reattempted.

Lab B: please implement this strategy and run the simulation to see how many data blocks do you need to reduce the average percent (at least 10 runs) write invalid events to below 5% * If you are working on this project by yourself, you may choose either part A or B. SimPY is a simulation package that you can install after you have setup your Python environments.

Anaconda is a simple Python package with most of the libraries and packages installed. SimPY can be installed via "pip install simpy" after conda install.

Examples of interests includes: Resources: Store (Event Latency and Process Communication) and Shared events: Move Renege.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: The simulation times number of data blocks and longest read
Reference No:- TGS02879079

Expected delivery within 24 Hours