> I was wondering about the behavior of syscalls. It looks like Go always wraps syscall - whatever blocking or not - with calling entersyscallblock() and exitsyscall() later. The first one automatically detaches M from the P when exit tries to acquire the same P or move the G to the global queue. In the case of non-blocking syscall, why do we have to detach M from the P?
> Did I miss something?
For system calls that are absolutely known to never block, like
getuid, Go does not use entersyscall/exitsyscall. It just makes the
syscall.
But most system calls can block.
Ian