Coder Social home page Coder Social logo

dining-philosophers's Introduction

Dining Philosophers

Problem

In ancient times, a wealthy philanthropist set up a university to accommodate five eminent philosophers. Each philosopher had a room in which they could carry out their professional activity of thinking. There was also a common dining room furnished with a circular table surrounded by five chairs, each one identified with the name of the philosopher who sat in it. The philosophers sat counterclockwise around the table. To the left of each philosopher lay a golden fork, and in the center, a bowl of spaghetti, which was constantly refilled. It was expected that a philosopher would spend most of their time thinking. However, when they felt hungry, they would go to the dining room, take the fork to their left and immerse it in the spaghetti. But the spaghetti was so tangled in nature that a second fork was required to bring it to the mouth. The philosopher, therefore, had to also take the fork to their right. When they finished, they had to put down both forks, get up from the chair, and resume thinking. Of course, a fork can be used by only one philosopher at a time. If another philosopher wishes to use it, they must wait until the fork is available again.

Only two philosophers can eat at any given time and consequently the output will look like this:

Gilles Deleuze esta comiendo.
Emma Goldman esta comiendo.
Emma Goldman ha finalizado de comer.
Gilles Deleuze ha finalizado de comer.
Judith Butler esta comiendo.
Karl Marx esta comiendo.
Judith Butler ha finalizado de comer.
Michel Foucault esta comiendo.
Karl Marx ha finalizado de comer.
Michel Foucault ha finalizado de comer.

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.