Skip to content

This repository contains the Sudoku Solution Validator project, implemented to demonstrate the Producer-Consumer problem. This project leverages multi-threading to validate Sudoku solutions, utilising shared memory and file I/O management.

Notifications You must be signed in to change notification settings

RJTLM/producer-consumer-problem-c-OS-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README

Sudoku Solution Validator: Producer Consumer Problem

By Ryan Mackintosh

Directory Structure

OS/
├── Assignment/                 # Directory containing all source files and headers
│   ├── Solutions/                      # Directory containing sample solution files
│   │   ├── solution
│   │   ├── solution1
│   │   ├── solution2
│   │   ├── solution3
│   │   └── solution4
│   │
│   ├── Makefile                        # Makefile for building the project
│   ├── mssv.c                          # Main source file containing the entry point and thread management
│   ├── sudoku_setup.c                  # Memory management for Sudoku Solution Validator
│   ├── sudoku_setup.h                  # Header for memory management
│   ├── sudoku_solution_file_reader.c   # File IO management for reading Sudoku solutions
│   └── sudoku_solution_file_reader.h   # Header for file IO management
│
├── docs/                       # Documentation and additional notes
│   ├── SampleData/                     # Sample data for report
│   │   ├── EdgeCase1.JPG
│   │   ├── InvalidSolution.JPG
│   │   ├── InvalidSolutionInput.JPG
│   │   ├── UserInput1.JPG
│   │   ├── UserInput2.JPG
│   │   ├── ValidSolution.JPG
│   │   └── ValidSolutionInput.JPG
│   │ 
│   ├── declaration_of_originality.pdf  # Originality declaration
│   └── Report.md                       # Project report
│
└── README.md                   # Instructions on building and running the program

Build Instructions and Usege

  1. Make sure you are in OS/Assignment to build.

  2. Run make to build the project.

  3. Run the program with ./mssv Solutions/<solution_file> <delay>.

    • <solution_file> is file name that contains the sudoku e.g. solution2
    • <delay> is the delay in seconds (must be between 1 and 10).
  4. Run make clean to remove the compiled files.

    Run `make clean && make` for convenience and assurance of a clean build every time.
    

File Descriptions

  • mssv.c: Main program file that initializes threads and manages Sudoku validation.
  • sudoku_setup.c/h: Functions for initializing and freeing shared memory structures.
  • sudoku_solution_file_reader.c/h: Functions for reading Sudoku solutions from files.

Additional Documentation

  • Report.md: Contains the project report.
  • declaration_of_originality.pdf

Resources

I have used knowledge gained from UCP and OS to write the majority of this program. Where this is not the case, I have commented the source in the code.

About

This repository contains the Sudoku Solution Validator project, implemented to demonstrate the Producer-Consumer problem. This project leverages multi-threading to validate Sudoku solutions, utilising shared memory and file I/O management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published