operating systems [b05008d3]
Tags: computers
- dedis.cs.yale.edu/2010/det/
- research.cs.wisc.edu/htcondor/description.html
- lwn.net/Articles/293575/
- www.dragonflybsd.org/cgi/web-man?command=sys_checkpoint§ion=2
- www.dragonflybsd.org/cgi/web-man?command=checkpoint§ion=ANY
- ithare.com/bringing-architecture-of-operating-systems-to-xxi-century-part-iv-first-draft/
1. Major Parts
1. Major Parts
- Isolation between processes
- Mobility (for mobile)
- Security
- Minimizing the overhead
-
Syscalls transition the privilage level
- syscalls are like any regular procedure calls, but with a trap instruction
- kernel agrees to put syscalls on well known locations
1.1. Trapping and untrapping for syscalls
1.1. Trapping and untrapping for syscalls
- Process needs to save the program counter (PC)/instruction pointer (IP) which stores the address of the next instructino to be executed (for resuming)
- Some flags about resuming execution on the CPU state
- All of them get written onto a stack on the kernel side, which then pops back up
1.2. Limited Direct Execution
1.2. Limited Direct Execution
- At boot kernel initializes a trap table
- When running a process, kernel sets up a trap and return of trap to switch back and forth to do syscalls
2. Forms of Concurrency Bugs
2. Forms of Concurrency Bugs
- Atomicity violations
- Order violation
-
Classical deadlock bugs
-
Conditions for a deadlock
- Mutual exclusion
- Hold and wait
- No preemption
- Circular wait
-
3. Threads [813d6555]
3. Threads [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
4. Concurrent Forward Progress
4. 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?