operating systems
Tags: computers
- https://dedis.cs.yale.edu/2010/det/
- https://research.cs.wisc.edu/htcondor/description.html
- https://lwn.net/Articles/293575/
- https://www.dragonflybsd.org/cgi/web-man?command=sys_checkpoint§ion=2
- https://www.dragonflybsd.org/cgi/web-man?command=checkpoint§ion=ANY
- http://ithare.com/bringing-architecture-of-operating-systems-to-xxi-century-part-iv-first-draft/
Threads
-
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
libc
to transition to kernel space, but posix threads originate fromlibc
andlibpthread
. 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 list
thread select 1
thread backtrace all~/~bt all
- GDB
- 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
Concurrent Forward Progress
- If your threads are preemptible, it’s possible that they, while being preempted for another task, might come back to having less resources than before, since the preemption task might take a different amount of resources. How do we fix this?