Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.73 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.73 KB

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.