struct tcb *thread_create(struct thread_info *tinfo)This function call is used to create a new thread. tinfo is the pointer to the thread description block of the new thread. The following is the declaration of the thread_info structure.
struct thread_info { void *(*run) (void *); void *arg; unsigned int type; unsigned int stack_size; int readyTime; int execTime; int deadline; struct thread_info *recov_info; }
The new thread starts executing at the function run, with the argument arg. The thread terminates when it returns from this start function5.2.
This field holds the type information of the thread. It can be one of PERIODIC, APERIODIC, RECOVERY, IDLE_THREAD or BOTTOM_HALF thread. This type information is not used by the kernel directly. It's for the user defined scheduler object to use this field for making proper scheduling decisions. For example a typical scheduler would give highest priority to the bottom half handler thread, since that thread is responsible for executing all bhalf handlers and recovery functions. On the other hand the idle thread should be the least priority thread.