Uninformed: Informative Information for the Uninformed

Vol 4» 2006.Jun

Next: Msgs Up: Basic Concepts Previous: Tasks   Contents


In Mach, a thread is an independent execution entity. Each thread has its own registers and scheduling policies. Each thread has access to all the elements within the task it is contained within.

On Mac OS X, a list of all the threads in a task can be obtained using the task_threads() function shown below.

	kern_return_t   task_threads
			(task_t                                    task,
			 thread_act_port_array_t            thread_list,
			 mach_msg_type_number_t*           thread_count);

The Mach API on Mac OS X provides a variety of functions for dealing with threads. Through this API, new threads can easily be created, register contents can be modified and retrieved, and so on.