In computing and Operating Systems, a thread is a stream of execution of programmed instructions.
A thread is associated with an execution context that includes the thread stack along with the values of key registers that determine the thread’s stack pointer, address space and other associated context.
Context switching
Pintos
Preemptive scheduling and synchronization
Two threads modifying the same address in memory will result in non-deterministic behavior
Methods of synchronization
If you so wanted, you could run pintos on straight up x86 hardware, but to make your life easier, we are using hardware emulators:
For the threads project, you’ll be working entirely under the threads directory of the pintos starter code
“make” in pintos/src/threads
To run, run
“make check” in pintos/src/threads/build
- 7/27 tests should pass off the bat
pintos run
Implement priority scheduling
All cases:
Priority donation (problem: priority inversion):
All threads with priority above L will run before H
Donation:
when H starts waiting on the lock that L is holding, it temporarily donates its priority to L such that L runs with H’s priority until it releases lock L
Handle: