Git Product home page Git Product logo

simple-synchronization-simulator's Introduction

simple-synchronization-simulator

Overview

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.

Table of Contents

Introduction

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.

Prerequisites

Before running the simulations, ensure that you have the following prerequisites installed:

  • Python 3.x
  • Multicore Environment

Experimental Setup

Shared Variables and Processes

  • Shared Variable: X = 1000
  • Processes/Threads: Random number of adders and subtractors
  • Local Variables: Random number of iterations between 100-1000 for each process

Results

Without Synchronization

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: ...

Usage

To run the simulations and explore the results:

  1. Clone the repository: git clone https://github.com/Halasalhab/simple-synchronization-simulator
  2. Navigate to the project directory: cd simple-synchronization-simulator
  3. Execute the simulation script: python simulation.py

Contributing

If you'd like to contribute to this project, please follow these guidelines:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix: git checkout -b feature/new-feature
  3. Commit your changes: git commit -m "Add new feature"
  4. Push to the branch: git push origin feature/new-feature
  5. Open a pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.