You are viewing a single comment's thread.

view the rest of the comments →

0
1

[–] TeranNotTerran 0 points 1 point (+1|-0) ago 

Kernels are loaded with linked lists. Or especially, doubly linked lists. That said, I've never had to use one.

Not familiar with UML. Looks strange and there's diagrams, so I probably won't be able to understand it.

Recursion... I think it's necessary sometimes, but it really confuses me and I feel iffy about it. I like it more in assembly where you're already jumping anyway, and most of it is pretty recursive. It's more natural. But in higher level languages like C or Python, it's pretty darn strange. That said, I don't know enough to say for sure if it's good or bad. As it stands now, I certainly don't prefer it.

Actually, hmm. Recursive functions are probably a lot more complicated to understand. You have to think of each pass through the code, with different state, and predict each case.

0
1

[–] lmkevin [S] 0 points 1 point (+1|-0) ago 

Kernels have linked lists? I certainly was not aware of this... where do they use them?

0
2

[–] Antikaon 0 points 2 points (+2|-0) ago  (edited ago)

Check these out:

Kernel Newbies discussion of the Linux kernel's linked list API: https://kernelnewbies.org/FAQ/LinkedLists

From the Linux kernel 4.9 src (Linux/include/linux/list.h) http://lxr.free-electrons.com/source/include/linux/list.h

Linked lists are used in various places in the kernel and in device drivers. They're fast and efficient.

0
0

[–] TeranNotTerran ago 

Process tables, or whatever you want to call them. Although it's a doubly linked list, child to parent and parent to child(ren)?

At least on FreeBSD. This may be the older version of the book, but the newer one is quite the read. I haven't read the older copy.

https://books.google.com/books?id=KfCuBAAAQBAJ&pg=PA803&lpg=PA803&dq=freebsd+process+table+linked+list&source=bl&ots=u9z0ovNf07&sig=6C1XE-7GXkvK6ZCq4RPwnpRj__o&hl=en&sa=X&ved=0ahUKEwj1guSYgNvRAhXn24MKHdvEDXUQ6AEIGjAA#v=onepage&q=freebsd%20process%20table%20linked%20list&f=false

Looks like they would use queue() as a helper, though: https://forums.freebsd.org/threads/38827/