English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

can you give me an answer in form of visual basic program

2007-02-22 01:18:03 · 3 answers · asked by marvin 1 in Computers & Internet Programming & Design

3 answers

This is a classic example of concurrent multi-threaded programming, with potentials for deadlocking and race conditions. The first link cited gives a detailed example of how to program (in C) the "Dining Philosophers Problem" first proposed by E. W. Dijkstra. If you understand the concepts illustrated, you can try to translate the program to VB.

The article, however, does not offer any help on how to avoid a deadlock in your program. It does offer an example of how a deadlock can occur.

The second article cited offers an interesting exploration of concurrent programmng requirements.

Visual Basic is not a good programming environment for this type of problem. There are also hardware instruction requirements to consider, which affects both the choice of hardware platform and the programming environment. Such considerations are beyond the scope of simple VB programming.

2007-02-22 07:23:13 · answer #1 · answered by hevans1944 5 · 0 0

I don't know much VB, but I do know the dining philosophers problem. Essentially to solve the dining philosophers problems you have to use a few mutexs(one for each for essentially) to change it from a philosopher taking one fork at a time to taking both forks or no forks at a time. Essentially you would have the following functions-

Grab_Forks()
Release_Forks()

Where in Grab_Forks the philosopher would (you guessed it) grab both while in Release the philosopher would (you guessed it) release both. After finishing the philosopher would wait some amount of time philosophizing.

2007-02-22 01:29:26 · answer #2 · answered by Steve T 3 · 0 0

enable me make sparkling that each physique has a philosophy in existence, n so each physique human beings are philosophers in our own way. As for fixing issues in existence, it relies upon on the variety of a philosophy one believes in. As a pragmatist, i might attack the project (handy) head on and seek for a rapid and plausible answer. Delays in tackling an argument might arise with a realist or a naturalist. yet, despite the case, one can't generalize issues with philosophers basically cuz the tag applies.........

2016-09-29 11:22:53 · answer #3 · answered by faim 4 · 0 0

fedest.com, questions and answers