parallel processing - Multithreading Puzzles -


I am trying to come up with some programming puzzles focused on multi-threading. I am unable to come up with the problems, so far, many domain specific ones are there any decent programming puzzles for developers who are trying to learn the basic concepts of the multi threading application?

"post-text" itemprop = "text">

Many topics have been included on this link.

Edit:

Here are some direct links to the problems listed here, on that link, with their initial details.


The food philosophical problem has been invented by EW Dijkstra. Imagine that five philosophers have spent their thinking and future only. There is a circular table with five chairs in between the dining room. There is a large plate of spaghetti in the table, however, only five chopsticks are available, as shown in the following figure. Every philosopher thinks that when he is hungry, he sits down and raises two chopsticks that are closest to him. If a philosopher chopstick can lift both, then he eats for a while, after eating a philosophical meal, he puts the chopsticks and starts thinking. This problem is due to SS Patil in 1971. Suppose a cigarette requires three ingredients, tobacco, paper and match. Three chains are smokers, each of them has only one component with infinite supply. An agent who has supplied the eternal supply of all three ingredients, to make a cigarette, smoking two other materials in the tobacco (resp., Paper and match) paper and match (resp., Tobacco and match, and tobacco and paper) ) should be there. Agents and smokers share a table Agent randomly generates two ingredients and informs smokers who require these two materials. Once the material is taken from the table, the agent supplies one and two. On the other hand, every smoker waits for a notification of the agent, once it is notified, the smoker raises the material, creates a cigarette, smokes for a while, and is waiting for his next material . >

Suppose to submit our data to indicate the next available position and there is a circular buffer with two pointers and the next data is included to retrieve that location. See diagram below. There are two groups of threads, growers and consumers in each manufacturer's situation depositing data items and pushing the indicator forward, and each consumer extends the data object in position and moves the indicator forward.

Suppose there is a traveler and a roller castor car. Passengers have to wait again to ride in the car, which can catch up to a maximum of passengers, where C & LT; N. However, the car can go completely around the track, after finishing a ride, each passenger wanders around the amusement park before returning to roller coaster for another ride. Due to safety reasons, the car rides only the t-bar and then shot-off.

There are additional barriers to this:

  1. The car always rides the same passenger;
  2. No passenger will get out of the car while driving;
  3. Any passenger will jump on the car while driving;

On the images it depends on whether any passengers will not request another ride. Here a revised quote has been removed with image references.

Consider a narrow bridge which can allow three vehicles in the same direction at the same time. If there are three vehicles on the bridge, then any incoming vehicle will have to wait until the bridge becomes clear.

When one pulls out of the bridge, then we have to consider two cases. Case 1, there are other vehicles on the bridge; And the vehicle coming out of Case 2 is the last one on the bridge. In the first case, a new vehicle in the same direction should be allowed to move forward.

Case 2 is more complex and there are two sub-teachers in this case, the vehicle coming out is the last vehicle on the bridge. If there are vehicles waiting in the opposite direction, one of them should be allowed to move forward or, if a vehicle is not waiting in the opposite direction, then let the vehicle move forward by waiting in the same direction.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -