Skip to content

The dining philosophers problem using threads, mutexes

Notifications You must be signed in to change notification settings

amine-za/Philosophers-1337

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Philosophers: I Never Thought Philosophy Would Be So Deadly

Summary

In this project, you will learn the basics of threading a process by implementing a simulation of philosophers at a dinner table. The project explores concepts such as thread creation and mutexes, presenting a unique challenge to manage resource sharing without deadlock.

Table of Contents

  1. Introduction
  2. Common Instructions
  3. Overview

Introduction

Philosophy (from Greek, philosophia, meaning "love of wisdom") involves exploring fundamental questions about existence, knowledge, values, and reasoning. This project illustrates a scenario in which philosophers engage in cycles of eating, thinking, and sleeping, demonstrating the need for synchronization and resource management.


Common Instructions

  • Language: This project is written in C.
  • Norm Compliance: The code must adheres to a specified coding norms.
  • Error Handling: The functions must not cause unexpected crashes (e.g., segmentation faults).
  • Memory Management: All dynamically allocated memory must be freed appropriately—no memory leaks allowed.
  • Makefile Requirements: A Makefile with the necessary compilation rules and flags.
  • Testing: Created test programs for development;

Overview

The simulation involves multiple philosophers sitting at a round table with a bowl of spaghetti. Each philosopher must eat, think, and sleep, managing access to shared resources (forks) carefully to avoid starvation.

Key Points:

  • Philosophers cannot communicate or know when another philosopher is about to die.
  • Each philosopher needs to eat to survive.
  • The simulation ends when a philosopher dies of starvation.

About

The dining philosophers problem using threads, mutexes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published