This kernel implements (kernel) threads, is implemented simple scheduler, conditional variables, mutexes, semaphores, RWlocks, (kernel) timers.
Most inportant files:
sched.c .. Implementation of simple round robin scheduler (no priorities)
semaphore.c .. Implementation Semaphores, mutexes are based on it.
timers.c .. Implementation of timers
tqueue.c .. Implementation of cyclic queue, functions for sorted and unsorted manipulation \ this structure is used widely in kernel.
All parts are desctibed on the begining of corresponfing .c file
Scheduler is imlemented as a round robin. In the system is all the time queue of runnable threads. Scheduler check sleeping threads (via timers), kill zombies (if they could not be killed in time, they stop executing), and choose new tread to run. In system lives all the time system thread (id 0). Currently running thread is stored in global variable. Runnable threads are in queue. In system exists queue of zombies to kill (were detached or joined).
Thread is all the time living in the system in valid thread queue. Can be (bud it's not necessary) enqueued in some othrer thread, like runnable threads or queue of synchronization primitiv. Implementation allows to simply change number of quqeus where can be thread enqueud (for next grups) Thread contains also pointer to pointer to queue where is enqued, this allows us to pull it from queue where is enqueued.