sectionThreads [813d6555]
-
Similar to a linux process that always run in the same memory
- own instruction pointer, and can be scheduled on different CPU's and executing different things on the same program
- shares the process structure (execpt stacks)
- linux threads have their own pid
- solaris is completely thread based
- in linux, a thread is a prococess without a thread
- created with the clone() system call
- treat as one process in some games, uses the thread group
getpid()will tell you some info- syn and locks!
- threads tend to be pretty fast, usually an async that does stuff in the background, and never switches off the task running state, spinning is TASK_RUN, but it's not waiting on IO but rather a lock
- biggest reason to use over a fork is because you can do the same memory
-
linux kernel only uses lightweight processes, or threads.
- Threads use
libcto transition to kernel space, but posix threads originate fromlibcandlibpthread. Note that the kernel only uses LWPs. However, at the kernel layer, since a userspace thread maps to a lwp, it doesn't really matter

- Threads use
-
Debugger commands
-
GDB
info threads-> list threadsthread <n>-> switches between threadsthread apply all bt-> backtraces
-
LLDB
thread listthread select 1thread backtrace all~/~bt all
-
-
Thread stacks
- each thread has its own stack to store data, and we can dump it like normal
-
Stack tracing a thread is when a function A calls function B, and function B has a return address to where function A called it.

-
Symbol files
- Symbols provide mappings between memory address ranges and associated symbol names, if you don't have the symbols, you just have the current function