OO fifth, sixth and seventh assignment summary

fifth assignment

Algorithms and Implementations

This time the elevator has to use the system time for simulation, so it has overturned the previous rewrite. Finally, three elevator threads, one scheduling thread and one input thread are used.

Source code analysis diagram

Class Diagram

 

Method analysis

class analysis

As can be seen from the above figure, due to the multi-threading for the first time, the complexity of a single thread is too high, and the task distribution is not evenly enough.

BUG analysis

 This time I was tested a ctrl+z caused by the scanner's null pointer error, and I was very impressed. I hadn't considered the issue of judgment at the time of reading. Then there is the occasional problem of non-piggybacking in scheduling, which is related to the improper scheduling algorithm.

sixth assignment

Algorithms and Implementations

The main difficulty of this assignment is the first contact with file operations and how to recursively access folders. After discussion, I decided to use hashmap to store file information, which is better for comparison during recursive access. There are fewer threads and no security issues.

Source code analysis diagram

Class Diagram

 

Method analysis

 

class analysis

BUG analysis

No

The seventh homework

Algorithms and Implementations

Compared with the elevator, this operation is actually simpler. The general framework still refers to the elevator architecture, using the read-in thread, the allocation thread, and the taxi thread. The instructions are first read into the queue, and then assigned to the appropriate taxi. .

Source code analysis diagram

Class Diagram

 

Method analysis

 

 

class analysis

 

BUG analysis

No, but during the mutual test, it was found that the other party forgot to process the map information and read it directly. Also, when searching for the shortest path, the speed of bfs is relatively slow, and it should be improved in the future.

experience and experience

In the three assignments, my design architecture did not have too many thread security problems, which also led to my unclear understanding of locks. I only understood these things later in class experiments.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325104017&siteId=291194637