Giter Site home page Giter Site logo

philosophers's Introduction

Philosophers

The Dining Philosophers Problem is a classic synchronization problem in computer science that illustrates the challenges of resource allocation and deadlock avoidance in concurrent systems. The objective of this project is to simulate the dining behavior of philosophers sitting at a round table, where they alternate between eating, thinking, and sleeping. The goal is to implement a program that ensures the philosophers can eat without starvation and without causing deadlocks.

Key Features

  • Simulation of philosophers sitting at a round table with a bowl of spaghetti and forks
  • Implementation of rules for philosopher behavior, including eating, thinking, and sleeping
  • Prevention of deadlocks and starvation to ensure all philosophers can eat
  • Compliance with specific rules and requirements regarding thread or process management, argument parsing, and logging

Knowledge Gained

  • Understanding of concurrency and synchronization in concurrent systems
  • Implementation of multithreading or multiprocessing solutions using threads or processes
  • Use of synchronization primitives such as mutexes and semaphores to manage shared resources
  • Handling of command-line arguments and parsing
  • Logging and formatting of program output to display philosopher states and events accurately

Mandatory Part

In the mandatory part of the project, each philosopher is represented as a thread. The forks are placed between each pair of philosophers, and their state is protected using mutexes to prevent duplication and ensure exclusive access.

Bonus Part

In the bonus part, all forks are placed in the middle of the table, and their availability is managed using a semaphore. Each philosopher is represented as a process, with the main process orchestrating the simulation without participating as a philosopher.

philosophers's People

Contributors

y2kgunner avatar

Watchers

 avatar

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.