From 5fd7ebaac1e94b84b282509cbcf9c69fbd57bb90 Mon Sep 17 00:00:00 2001 From: Arturs Artamonovs Date: Sat, 25 Nov 2023 12:02:55 +0000 Subject: Add procfs and kernel topic page --- md/notes/kernel/create_thread.md | 45 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 md/notes/kernel/create_thread.md (limited to 'md/notes/kernel/create_thread.md') diff --git a/md/notes/kernel/create_thread.md b/md/notes/kernel/create_thread.md new file mode 100644 index 0000000..87830b1 --- /dev/null +++ b/md/notes/kernel/create_thread.md @@ -0,0 +1,45 @@ +title:Create threads +keywords:kernel,linux,threads + +# Create threads + +State of kernel thread - include/linux/sched.h + +```c +/* Used in tsk->state: */ +#define TASK_RUNNING 0x00000000 +#define TASK_INTERRUPTIBLE 0x00000001 +#define TASK_UNINTERRUPTIBLE 0x00000002 +#define __TASK_STOPPED 0x00000004 +#define __TASK_TRACED 0x00000008 +/* Used in tsk->exit_state: */ +#define EXIT_DEAD 0x00000010 +#define EXIT_ZOMBIE 0x00000020 +#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD) +/* Used in tsk->state again: */ +#define TASK_PARKED 0x00000040 +#define TASK_DEAD 0x00000080 +#define TASK_WAKEKILL 0x00000100 +#define TASK_WAKING 0x00000200 +#define TASK_NOLOAD 0x00000400 +#define TASK_NEW 0x00000800 +#define TASK_RTLOCK_WAIT 0x00001000 +#define TASK_FREEZABLE 0x00002000 +#define __TASK_FREEZABLE_UNSAFE (0x00004000 * IS_ENABLED(CONFIG_LOCKDEP)) +#define TASK_FROZEN 0x00008000 +#define TASK_STATE_MAX 0x00010000 + +#define TASK_ANY (TASK_STATE_MAX-1) +``` + +## Links + + +https://www.linuxtoday.com/blog/kernel-threads/ +http://www.embeddedlinux.org.cn/EssentialLinuxDeviceDrivers/final/ch03lev1sec1.html +https://elixir.bootlin.com/linux/v6.1.21/source/include/linux/sched.h +https://elixir.bootlin.com/linux/v6.1.21/source/kernel/sysctl.c + + + + -- cgit v1.2.3