Dining-Philosophers Problem In C (Linux) -- 2

$ 60.00 — 70.00 USD
N philosophers spend their lives thinking and eating.

They share a common circular table surrounded by N chairs, each belonging to one philosopher.

In the center of the table, there is a bowl of rice, and the table is laid with N single chopsticks.

If a philosopher is not eating, he is thinking, and if he feels hungry he must pick up the two chopsticks that are closest to him one at a time.
He can only eat if he has two chopsticks.

After eating he must put down his After eating he must put down his chopsticks and start thinking again.

How can we model the behavior of each philosopher such that we provide maximum overlap of eating philosophers and id avoid: Deadlock, Indefinite waiting?
Solve the above problem by writing a multi-threaded C using synchronization tools (Event counts, Locks, Condition variables, and/or Monitors) except Semaphores to solve a typical synchronization problem.
Such that the solution satisfies all the following three conditions:
• Maximum number of concurrent philosophers can eat at the same time.
• No possibility of deadlock.
• No possibility of starvation.

The program must allow the user to specify the number of philosophers, N, as a command line parameter.
Also, it must use the following files to generate its graphical output:
a.
DiningTable.o library of functions you need to include in the program for graphical output.
b.
DiningTable.h contains declarations and documentation of all functions in the above library.
c.
Rice.bmp the image of a bowl of rice to be drawn on the dining table.

The program must call function init(N) at its start, and must call function finish() before it exits. Each philosopher goes through the following states: thinking, hungry, and eating, repeatedly, in an endless loop.
In the loop, a philosopher shall have random time delays simulating the times he spends eating and thinking.
Since you are using an endless loop, the program shall respond to a ctrl-c signal by ending the loop, cleaning up, and exiting.
All requirements are in the attached file

Similar Freelance jobs:

Linux Distro
Hi everyone! I'm looking for a embedded systems engineer someone with vast knowledge on C++, QT, Kirigami UI Framework, Maui Project Framework these frameworks and knowledge in this language would be of great help in my creation a device I'm engineering. Other important areas of expertise: KDE Plasma, Calamares Installer, Kubuntu Invite will need to sign NDA. Thank you!
Full Description of Linux Distro
Build Me A Fast Proof Of Stake Cryptocurrency
I am looking for an expert at creating cryptocurrencies to develop a fast Proof of Stake cryptocurrency using its own customized network like EOS and XRP. This means that the transaction time between receiving and sending the crypto should be about 5 seconds. I will provide more information about the project in private with whoever is interested in taking on this job.
Full Description of Build me a fast Proof of Stake Cryptocurrency
Stm32 Gui Touchgfx
Realization of a demonstrator on ST STM32F769I-DISCO board (4'' 480x800). STM32Cube - FreeRTOS – TouchGFX The application is defined (screens, sequences to screen or function). Reading one sensors on usart and other messages on canbus (defined messages). Show informations on GUI. Sending messages on canbus (defined messages). Save user's parameters in flash. Source full project Stm32Cube/gfx to deliver. Option: add bootloader IAP on USB to allow the program update (there are 2 flash banks of 1MB. Application is less than…
Full Description of STM32 GUI TouchGFX
Vpn App (v2ray+trojan+shadowsocksr) 5 O.s (ios+android+windows+mac+linux)
smooth and fast VPN using protocols: V2ray-trojan-ssr vpn app with my own Ui & a basic backend panel using php+mysql i need app for (ios + android + windows + mac + linux ) = minimum $1500 / maximum $5000 for whole project, official programing language only ! not flutter-xcode-react,js...! Microsoft studio = windows version Android studio = android version Swift = ios//mac version C ,c++ = linux version i provide: Ui + panel template + servers + openSource vpn…
Full Description of VPN APP (V2ray+trojan+shadowsocksR) 5 O.S (ios+android+windows+mac+linux)
Software Designing
I need a good and efficient software which should be helpful and I can get a good rate of selling it.
Full Description of Software designing
Prediction Of Frequency Application Using Gui With Trained Neural Network
Hi, i am postgraduate student from malaysia, i need someone that can help me to build gui application to predict frequency using trained neural network (save in .mat file), i have the trained neural network, i only need someone that can help me with the coding to load the .mat file in GUI.
Full Description of Prediction of frequency application using GUI with trained…
A Secure Relay Mail Server Tasks -- 2
Hi i currently have a virtualmin mail server. but it is lacking security and monitoring. - enable secure mail relay. and improve mail relay security, it should block ips who are trying to use mail relay multiple times. - wordpress should be able to use the mail relay via smtp. - improve mail rating in mail tester: https://www.mail-tester.com/ - I am also getting an email from google saying there is an issue with damrc. https://support.google.com/a/answer/2466580 - i am not able…
Full Description of A secure relay Mail server tasks -- 2
Move Wordpress Website From One Host To Another
The task is to move one wordpress website from one host to another and make it perfectly work on the new host. I have access to both hosts. both via ftp and via controlpanel. Full access to Files and DB. Info: we could not get it to work on the new host - no DB found even though we configured it in the wp.config. So I am looking for someone who can fix this. Actually we moved it already to…
Full Description of Move Wordpress website from one host to another
Setup Postgresql Replication
We run a customer service environment where we use postgresql as db. We need help configuring master slave environment. Read more in attached specification. Give an estimate of costs and write down your qualifications. Thanks /Dan Erik Ollas (Sweden)
Full Description of Setup PostgreSQL replication
Bash Scripting: Website Scraping
Need to screen scrape a website using wget and curl and then manipulate/format some data in a useful way (such as a table) using tools like SED and AWK. Those are the only requirements
Full Description of Bash Scripting: Website Scraping
© 2006 — 2026 hirelancer.com is an affiliate website, listing the freelance projects. We are collaborating with other sites like getFreelancer.com. Feel free to bid on any project and good luck! You will need register first, before bidding or posting projects. Basic memberhsip is always free. We might earn commissions from referring you. You will never ever pay additional fees for we referred you.