How to Open Kernel?

How does the Linux kernel identify cycles or loops in its data structures?

  • I am going through Linux Kernel development by it a great read. I just wanted to know how Linux kernel will identify cycles in its Data Structure like linked list, doubly linked list  (which is possible in any system). Simple question will be what Algorithm Kernel implements to find circle Data Structure.

  • Answer:

    In short, it is a trade off between adding more code to account for a programmer error and simplicity. The onus is on the programmer to write correct code, which will avoid aforementioned loops in data structures.

Pradeep Singh Rautela at Quora Visit the source

Was this solution helpful to you?

Other answers

Adding to Praddep's Answer. One example which can be understand as kernel never try to detect cycle is : It never checks for dead lock condition. For example if you take a lock on some resources, and further in that code again you try to take the same lock. This is infinite cycle, and kernel won't do anything for this, untill watch dog comes in picture and crashes your system.

Rahul Garg

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.