Skip to content

A Java-based restaurant functioning system that simulates kitchen and order operations using multithreading and synchronization. Demonstrates efficient handling of concurrent orders in a real-world restaurant workflow.

Notifications You must be signed in to change notification settings

Chamanthi17/Restaurant-functioning-using-multi-threading-and-synchronization

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍽️ Restaurant Functioning Using Multi-threading and Synchronization

This Java project simulates the functioning of a restaurant using multi-threading and synchronization primitives. The model handles essential restaurant operations such as:

Checking table availability

Assigning tables to customers in order of arrival

Managing cook availability

Tracking availability of menu items (burgers, fries, coke)

Coordinating concurrent tasks to satisfy customers efficiently

πŸ—‚οΈ Project Structure

Restaurantfolder/

β”œβ”€β”€ BurgerMachine.java # Thread managing burger preparation

β”œβ”€β”€ CokeMachine.java # Thread managing coke dispensing

β”œβ”€β”€ Cooks.java # Thread class representing cooks

β”œβ”€β”€ Diners.java # Thread class representing customers

β”œβ”€β”€ FriesMachine.java # Thread managing fries preparation

β”œβ”€β”€ Order.java # Order details and status

β”œβ”€β”€ OrderList.java # Collection of orders management

β”œβ”€β”€ Restaurant.java # Main restaurant operations & synchronization

β”œβ”€β”€ TableObject.java # Table data model

β”œβ”€β”€ Tables.java # Collection of table objects

App.java # Main application entry point

input1.txt # Sample input 1 (customer orders)

input2.txt # Sample input 2 (customer orders)

README.md # This file

Final presentation.pdf# Project presentation slides

πŸš€ How It Works

Multi-threading: Different threads simulate cooks, diners, and machines working in parallel.

Synchronization: Ensures that tasks like table assignment and food preparation happen in the correct order without conflicts.

Order Management: Orders are queued and processed in the order of arrival.

Resource Availability: Tables, cooks, and machines are shared resources synchronized to prevent race conditions.

βš™οΈ How to Run Locally

Compile all .java files:

javac Restaurantfolder/*.java

Run the main program:

java Restaurantfolder.App

The program reads input files (input1.txt, input2.txt) for orders. Make sure these files are in the same directory.

πŸ›  Concepts Demonstrated

Java Threads (extends Thread or implements Runnable)

Synchronization (synchronized, wait(), notify())

Shared resource management (tables, machines)

Producer-consumer model for order processing

Handling concurrent customer requests fairly

πŸ™‹β€β™€οΈ Author

Chamanthi Pyneni

This project deepened my understanding of Java concurrency and synchronization while simulating real-world restaurant operations in an engaging way.

About

A Java-based restaurant functioning system that simulates kitchen and order operations using multithreading and synchronization. Demonstrates efficient handling of concurrent orders in a real-world restaurant workflow.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages