/semaphore

operating seystem assignment . implementation of samaphore . language used is python

Primary LanguagePython

Semaphore Implementation in Python using Tkinter

This repository contains a Python implementation of a semaphore using the Django framework. It includes a graphical user interface built with Tkinter that allows users to enter the number of resources and threads, and start the execution.

Features:

  • Create a structure of semaphore and define the class 'semaphore' for synchronization.
  • Acquire and release functions are implemented to manage the allocation of resources to threads.
  • The graphical user interface is designed using Tkinter, providing an intuitive interface for users to interact with the application.
  • Threads are created and executed concurrently, sharing the counting semaphore.
  • The application displays the CPU status, waiting list, and allocation of resources dynamically as threads execute.

Usage:

  • Install the required dependencies by running the command 'pip install tkinter'.
  • Run the Python script to start the application.
  • Enter the number of resources and threads in the corresponding input fields.
  • Click the "Start" button to initiate the execution.
  • Observe the CPU status, waiting list, and allocation of resources in the graphical interface.

Please note that this implementation is primarily intended for educational purposes and may not encompass all aspects of a production-ready semaphore. It serves as a demonstration of the basic principles of synchronization using a semaphore in a multi-threaded environment

Contributions:

Contributions to the project are welcome! If you have any suggestions, bug fixes, or improvements, please feel free to open a pull request.

Feel free to explore the code, modify it to suit your needs, and further enhance its functionality.