Hi,

I am trying to find an accurate way to distinguish between kernel threads and user processes

I've started looking at ps code because I thought ps knows how to distinguish between kernel threads and user processes (square brackets on kernel threads),
but then I discovered that square brackets means that the process arguments cannot be located (usually it means that it's a kernel thread but not always, and I need an accurate method)

maybe some flag in /proc/[pid]/ ... or preferably some system call

Please help

Thanks,
Amir