Artificial intelligent assistant

How is /proc/self implemented in Linux? I was tinkering around with the `/proc` filesystem in Linux, and I came across `/proc/self`, which is a symbolic link to the process directory of the current process. I would like to know how it is implemented. One solution would be to change that symlink on _every context switch_ , but that's obviously very expensive as it involves a disk access.

< is the current implementation.

The `proc` filesystem is entirely virtual, and is implemented so the internal VFS `readlink` delegates to the right place for special symlinks. So, it calculates what `self` points to when it is read / traversed, not every context switch.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 2df0117d8839d2721b76c413f43e7baf