Giter Site home page Giter Site logo

jean-xavierr / 42philosophers Goto Github PK

View Code? Open in Web Editor NEW
13.0 1.0 1.0 222 KB

This project is an introduction to the basics of process threading, and how work on the same memory space.

C 92.50% Makefile 7.50%
42 42school philosophers multithreading

42philosophers's Introduction

Philosophers - @42Born2code

Philosophers an individual project at 42 about introduction to the basics of process threading, and how work on the same memory space. And learn about mutexes, semaphores, and shared memory.

Introduction

In computer science, the dining philosophers problem is an example problem often used in concurrent algorithm design to illustrate synchronization issues and techniques for resolving them.

It was originally formulated in 1965 by Edsger Dijkstra as a student exam exercise, presented in terms of computers competing for access to tape drive peripherals. Soon after, Tony Hoare gave the problem its present formulation

More informations

Project duration : 1 week โณ

Tips and good methodology to do the project at the bottom of the readme

Installation ๐Ÿ–ฅ

To test the project, go to one of the folders philo_one, philo_two or philo_three and make a make. Then, you can test the project using an executable.

usage :

./philo_one number_philosopher time_to_die time_to_eat time_to_sleep [number_of_time_each_philosophers_must_eat] arguments in square brackets are not required (number_of_time_each_philosophers_must_eat)

exemple :

./philo_one 4 500 200 200

I made a visual option, which makes it possible to have a prettier display, which reduces performance a little. To use it, add the option -v after the executable, this option is only available on philo_zero (philo zero is identical to philo one, but it can handle the [-v] option)

exemple :

./philo_zero -v 4 500 200 200

alt text

Tips project

โš ๏ธ Warning: Don't copy/paste code you don't understand: it's bad for you, and for the school. I have put my login in a lot of files to encourage you doing your own version. Have fun !

Philo_one Thread and Mutex (good resolution diagram)

alt text

In build

Project documentation ๐Ÿ“š

Use pthread (pthread_create | pthread_join) EN video

Thread & Mutex EN video

Semaphore EN video

Fork explain in FR or Fork Wiki EN

To do list

  • ReadMe
  • Philo_one
  • Philo_two
  • Philo_three
  • Testing script

Contributing, Question or suggestions ?

42Slack : jereligi

42Intra : jereligi

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Thanks for reading this read me, advice or corrections are welcome

42philosophers's People

Contributors

jean-xavierr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

amouhtal

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.