I need the choice of vehicle and parking problems, including car parking information will increase continuously in the loop (the last parking results need to use in the next cycle), the vehicle need to choose and it is the closest distance carparking space successfully, but a parking space in a certain period can only have a car, at this stage to use if statements are already in the parking vehicles attribute judgment, if the latest space has been occupied by a car, is to find the next vehicle recently, therefore involves a large number of circulation situation, late in the program is run (most of the parking lot is full), a cycle time is very long,
So I'll find some related information, know the multithreaded this concept, idea is for every car to find the behavior of the vehicle in a new thread, in order to reduce the total running time, about using multithreading, have any good Suggestions? This idea is feasible?
CodePudding user response:
Not feasible, will cause two cars parked in the same parking space