What is the equivalent of "task_struct" in linux's <linux/sched.h> for Mac OS?
I want to understand the Process Control block of Mac OS and Linux. For Lionux it was pretty strightforward, there was a post here asking about the same thing and someone replied to go take a look at "task_struct" in <linux/sched.h>. However i am finding it more difficult to find the equivalent information for Mac OS, someone in apple’s developer forum asked a similar question and got told to look at proc_info.h and proc.h, but i am lost as to which struct i should be looking at. Is there a task_struct equivalent in Mac OS?
I know nothing of Mac OS but… a couple about FreeBSD. Hope it will match.
You got it right looking at the task_struct
in Linux because it’s the basic unit of scheduling in Linux.
The basic unit of scheduling in FreeBSD is the thread
.
Linux represents processes (and threads) by task_struct
structures.
A single-threaded process in Linux has a single task_struct
.
A single-threaded process in FreeBSD has a proc
struct, a thread
struct, and a ksegrp
struct.
(The ksegrp
is a "kernel scheduling entity group.")
At the end of the day both OSes schedule threads, where a thread is a thread
structure in FreeBSD, and a task_struct
in Linux.
Therefore, yes indeed, follow the advice and first have a look to proc.h