Where does OS X store the list of processes?
The ps command enumerates the mach kernel process listing in a similar manner to how many linux (which don't use mach kernel) expose this as the /proc filesystem. 

macOS and tvOS and iOS and watchOS all share the same underlying core OS:


Getting a list of currently running processes
iOS: Where is /proc/?
Getting list of pids and process names
Process list with name and VPRVT


If you want to see the source code - check out xnu section at https://opensource.apple.com/source/xnu/xnu-4570.41.2/