1/25
26 cards from the official Fall 2026 CS 544 Anki Compute deck. Python Thread creation and native ID examples corrected. Source: https://tyler.caraza-harter.com/cs544/f26/anki.html
There is one virtual address space per _______
process
A process is a running ______
program
Virtual memory maps to ______
physical memory
Which address space can contain "holes" (invalid addresses)
Virtual address spaces can have holes (physical address spaces do not -- they are contiguous)
What are three things that go in a virtual address space?
code stack heap
Which pointer indicates what code to execute next?
The "instruction pointer"
There is one stack per _____ and one heap per ______
thread, process
What is it called when the scheduler stops running one thread and starts running a different one?
A "context switch"
What are three states a thread can be in?
running, blocked, ready
What are some reasons a thread might be blocked?
waiting on user input, disk operations, network operations, timer sleep, etc.
How do you create and launch a thread object for running function f(x)?
t = threading.Thread(target=f, args=(x,)); t.start() [Corrected Python API: target and args belong in Thread(), not start().]
How do you wait for a thread t to finish running?
t.join()
How can you print a thread's ID?
For the calling thread: threading.get_native_id(). For a started Thread object t: t.native_id. [Corrected Python API.]
What is a "race condition"
A bug that only sometimes surfaces, depending on when context switches happened between threads
When might a context switch occur?
Between instructions -- a single line of code might correspond to multiple bytecodes or machine instructions, so it's important to note that context switches often occur in the middle of a line of code being executed.
What is a "race condition"?
A bug, where whether or not you get correct behavior depends on how threads get scheduled. Race conditions are tricky to test+debug because they're non-deterministic (not same behavior each time), and you might only see the incorrect behavior rarely (say one in a million times).
What is "deadlock"?
This is when threads can never make progress, because they each want to acquire a lock that will never be released. One example: t1 has A and t2 and B; t1 is waiting to additionally acquire B, and t2 is waiting to additionally acquire A. This will never happen because neither thread will release its first lock until it has acquired the second lock and done some work.
How can a thread (a) get a lock and (b) let go of it?
lock.acquire() lock.release()
How can you rewrite the following code so that the release will happen, even if an exception occurs? lock.acquire() # code with possible exception lock.release()
with lock: # code with possible exception
What do you call a section of code where certain interleavings with other code would be a problem?
critical section
What is "atomicity" in the context of multi-threaded programs?
If a thread is changing multiple things together, we never want to see (say from another thread) partial results, with only some changes made.
What is an "invariant"?
A rule that applies to the data, often something a human might know from context. For example, an invariant might be a list of ages cannot contain negative numbers. Some invariants are known by the system (for example, that the length of the list itself cannot be negative).
What is "consistency" in the context of threading?
All invariants are enforced.
If thread t1 holds a lock, what could happen? 1. we could context switch to another thread t2 2. another thread t2 could acquire the lock
(1) is possible, (2) is not
What happens in Python when you try to release a lock that has already been released?
There is an exception
What is the GIL?
Global Interpreter Lock