diff options
author | Arturs Artamonovs <dos21h@gmail.com> | 2023-11-25 12:02:55 +0000 |
---|---|---|
committer | Arturs Artamonovs <dos21h@gmail.com> | 2023-11-25 12:02:55 +0000 |
commit | 5fd7ebaac1e94b84b282509cbcf9c69fbd57bb90 (patch) | |
tree | a6c2862b1ea0f06c06be2a68886b73cbea82359c /md/notes/kernel/create_thread.md | |
parent | c13284051093f0876e038fe65b99aba16d2578fd (diff) | |
download | md-content-5fd7ebaac1e94b84b282509cbcf9c69fbd57bb90.tar.gz md-content-5fd7ebaac1e94b84b282509cbcf9c69fbd57bb90.zip |
Add procfs and kernel topic page
Diffstat (limited to 'md/notes/kernel/create_thread.md')
-rw-r--r-- | md/notes/kernel/create_thread.md | 45 |
1 files changed, 45 insertions, 0 deletions
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 + + + + |