This repository contains experiments comparing synchronized operations with concurrent operations in threading. The goal is to explore the impact of synchronization mechanisms on shared data consistency in a multi-threaded environment.
Concurrency in programming introduces challenges related to shared resource access. This repository hosts a simulation project that explores the impact of synchronization on concurrent processes modifying a shared variable. The experiments aim to provide insights into the reliability and predictability of results in both synchronized and unsynchronized scenarios.
Before running the simulations, ensure that you have the following prerequisites installed:
- Python 3.x
- Multicore Environment
- Shared Variable:
X = 1000
- Processes/Threads: Random number of adders and subtractors
- Local Variables: Random number of iterations between 100-1000 for each process
The simulation without synchronization results in a final value of X
influenced by race conditions and uncontrolled access to the critical section.
Without Synchronization - Final value of X: ...
To run the simulations and explore the results:
- Clone the repository:
git clone https://github.com/Halasalhab/simple-synchronization-simulator
- Navigate to the project directory:
cd simple-synchronization-simulator
- Execute the simulation script:
python simulation.py
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix:
git checkout -b feature/new-feature
- Commit your changes:
git commit -m "Add new feature"
- Push to the branch:
git push origin feature/new-feature
- Open a pull request.