I was literally learning "Dining Philosopher's Problem" for my upcoming semester until I saw this notification!! You literally read my mind, professor....
I’ve covered this recently on my course but you’re still a godsend to anyone who studies CS or has an interest in it. I’m glad you have your own channel, had been saying it for a long time on android authority
Professor Sims - another excellent explanation and whilst I am tempted to continue heaping praise on you I find myself overwhelmed with a desire to eat.
loved how you started the video right to the point ! Your computer is already running multiple processes at the same time. Loved it! catches attention and you immediately start to think!
Thanks Gary! It's a very good visualization of some of the complex systems cpus have to work with. I now understand a little better what modifying the cpu scheduler on a custom kernel does in Android 😊
Agreed! Just a small gesture like including diverse faces in an example goes a long way to help underrepresented folks feel welcome! Thank you, @Gary Explains !
If I may add about what atomic means:As the ancient Greeks believed that atoms are fundamental building blocks and can not be further broken into smaller components. In Computer science, Atomic operation must be completed from start till finish. For example if the locking operation is 5 lines of code then they must all be completed from start till finish. there my be no interups accepted, context switching by the scheduler or anything till the whole thing is complete. Thats why atomic operations have to be very short.
Great explanation, but I've never seen someone eat a meal with two forks. Seen plenty of people eat a meal with two chopsticks, however, I've never seen someone eat a meal with one chopstick. Maybe chopsticks are more appropriate for this illustration?
LOL. I have never met a group of philosophers who when dining didn't have enough cutlery in the first place! I don't think the type of cutlery used is really the issue here!
You have described the request as a polling mechanism but it’s more of a queuing mechanism handled by the scheduler isn’t it? Maybe the waiter should write down the request.
In which part am I describing as a polling mechanism, in the description of the problem or the solution? If it is the former, then that is the whole point there is no scheduler nor is there a queue. Such things form part of possible solutions.
Thank you, thank you very much! You explained it very good! English is not my native language. It would be great if you could add some key words (few titles of your speech) so it would be easier:) have a nice day!
Sir, you have presented a simple solution for beginners. But in real life system the requests are random and concurrent. How would the 'waiter' here deal with random requests? Also u have provided a solution that is not starvation free as the philosopher lets down the fork is he doesn't get the second one. In a real world situation, there might be a very resource hungry process that might run for a long time. In such a scenario the other process or philosopher might starve to death. Is there a concurrent solution without essentially using locks? (Maybe using semaphores or monitors). I know this is way beyond the limits of youtube and the type of videos you do, but would be great if you coukd answer or refer me to some place where i can find answer. ( I have a course on Parallel and Concurrent programming running)
It doesn't matter if the requests are random and concurrent. I was presenting the requests in order to demonstrate what would happen, but the principle is still the same. As for resource hungry processes that is beyond the scope of the Dining Philosophers illustration, as here the main point is how to avoid deadlock. Having said that I did hint at the problem of the 5th philosopher not getting a shot at asking for the forks. There are various different solutions to this, one of which is to assign the requests for forks with a priority. Dijkstra suggested a solution that doesn't use locks called the "Resource hierarchy solution."
Interesting, but it does not seem the waiter solves the problem. Instead of all picking up the left fork at the same time, now they will all be asking the waiter at the same time for permission and the 5 concurrent requests will cause a different lock.
I understand why you say that, but no. As I said towards the end of the video the locking mechanism is atomic, which means that only one philosopher can be granted the lock and allowed to pickup forks. There is a slightly deeper level which I didn't discuss which is what happens when a philosopher doesn't get a lock, but it is enough to say (at this level) that deadlock doesn't occur.
I see what you mean, but I’m talking about the problem in general.. The monitor giving locks does not seem to solve anything because if requests keep colliding with each other he will not have received a request to give a lock to. Seems like you would need some kind of randomly generated wait period before retry
Good video, but explaining this with chopsticks makes much more sense because you acutally need two of them to eat. Have to replace the pizza with something asian of course :-)