EECE-4029 Operating Systems Fall 2016
Kernel Threads

processes, mutex, semaphores, memory management, producer-consumer, files, deadlock, more..

Sample code and documentation

Archive:
   
kthreads.tar     All the code and documentation in a tar file
   
Makefiles:
   
Makefile     For kthread.c below
Makefile     For kthread_stop.c below
Makefile     For maxthreads.c below
Makefile     For prod-cons.c below
   
Code:
   
kthread.c     Elementary kthread creation
kthread_stop.c     Example use of kthread_stop and kthread_should_stop
maxthreads.c     Start a new kthread every second - when does the system give up?
prod-cons.c     Producer-consumer network of kthreads synchronized with semaphores
 
Documentation:
kthread_run     Wrapper for kthread_create
kthread_create     Create a kernel thread
wake_up_process     Wake up a process - usually used right after kthread_create
kthread_stop     Signal a thread to stop - signal is caught by kthread_should_stop - thread awakened if sleeping
kthread_should_stop     Catch the kthread_stop signal and return true if set, false otherwise
kthread_create_on_node     Create a kernel thread so that the stacks and task structs are placed on the correct NUMA node
kthread_create_on_cpu     Same as kthread_create_on_node except threads runs on cpu soecified
kthread_bind     Bind a just-created cpu to a thread
kthread_should_park     Should this kthread park now?
kthread_unpark     Unpark a thread
kthread_parkme     Used after kthread_should_park
kthread_freezable_should_stop     Should this freezable kthread return now?
kthread_data     Return data value specified on kthread creation
probe_kthread_data     Speculative version of kthread_data()
tsk_fork_get_node     Get info for task about to be created
queue_kthread_work     Queue kthread_work that was created with kthread_worker_create
flush_kthread_work     Flush kthread_work
flush_kthread_worker     Flush all current work on a kthread_worker
kthread_worker_fn     Function to process a kthread_worker