I made some adjustments to the initial version of my list, now it meets the requirements set out in Professor Maziero's material. I adjusted it to pass the tests, and I also decided to use readapt for C. Compilation together with the available test file seemed less problematic that way.
Revisiting the code for this list, I needed to revisit simpler lists that come before the double-chained circular one, so I was able to put together solid reasoning when coding.
It is a structure in which each node contains three parts: Value, pointer to the next node, and pointer to the previous node.
Allows bidirectional navigation, and to remove or add a node, it is only necessary to adjust the points of the previous and next node.
[head] <-> [nó1] <-> [nó2] <-> [tail]
It can be simply chained (one-sided direction) or double chained (this is what I'm using for the project).
The last node in the list is connected to the first, which means that the list does not have a natural ending point.
The list can be scrolled through indefinitely, because when it reaches the end, it returns to the beginning.
Using a circular doubly linked list makes the operating system have a circular scaling feature.
That said, after the last process is executed, the system returns to the first and continues execution.
Imagining that an operating system has three processes:
[P1] <-> [P2] <-> [P3] <-> [P1] ...
After P3 finishes its execution time, the list will return directly to P1, ensuring continuous execution.
The current operating system code can be found here.
The above is the detailed content of Dia - Reimplementing doubly linked circular list. For more information, please follow other related articles on the PHP Chinese website!