Object Oriented Programming Phase 2 Summary

       Finally got through the second stage of oo, although the quality of the completion can only be said to be unsatisfactory, but it is not invalid, it can be regarded as barely reaching the goal QVQ

 

The fifth assignment - multi-thread elevator

1. Program Analysis

 

 

The personal reflection

       The first is the fifth multi-thread elevator operation. This is the worst one of my three operations. The first time I came into contact with multi-threading was really confusing. . . And because the foundation laid by the previous elevator operation was not very good, this multi-threaded operation was more laborious to complete, and in the end, it became more and more chaotic and collapsed. . . The final result is that there were 3 errors in the public test, and 11 bugs were hung in the mutual test. It is true that my code this time is relatively bad, and in many cases there will be all kinds of inexplicable confusion, so the testers put all my normal functions. All branches reported bugs orz

       Thread design: The Main thread is destroyed after starting each thread, the Simulatoar thread processes the request for processing the input, the Dispacher thread continuously scans the request queue and sends the request to the processing queue of each elevator, and the three newElevator threads each process themselves and are assigned to the request queue.

 

The sixth homework - ifttt

1. Program Analysis

 

 

The personal reflection

       The sixth homework ifttt is the instruction book, which is difficult to understand, but after I slowly figured out the whole logical idea, it feels much better than the multi-threaded elevator. It may also be partly because of the familiarity with multi-threading. , when the directory depth is too large, a crash occurs when the file is read, and only one error occurs in the mutual test. The reason is that there may be some garbled characters in the output due to encoding problems.

       Thread design: The Main thread processes the request input, establishes a Trigger thread for each valid request to perform corresponding monitoring operations, and the Summary and Detail threads write the recorded content to the file every 1 second.

 

The seventh assignment - taxi dispatch

1. Program Analysis

 

 

The personal reflection

 

      The seventh taxi dispatch was also not done well. . . Mainly because it started relatively late and finally didn't have time to correct it, so I hurriedly handed in a semi-finished product.

 

  Thread design: Main scans the map for related records, creates 100 taxi threads, creates a new Dispacher thread for each valid request for related scheduling processing, creates a new Responsive thread in each Dispacher thread and lets the Dispacher thread sleep After 3 seconds, the Responsive thread records all the taxis that can respond. After 3 seconds, the Dispacher thread determines the taxi that will respond to the request, changes the status of the responding taxi, and modifies the task attribute of the taxi.

 

Guess you like

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