flâneur — a map of the web's best reading

Understanding threads | Pintos Documentation

cs162.org · 374 words · saved by 1 readers

The first step is to read and understand the code for the thread system. Pintos already implements thread creation and thread completion, a simple scheduler to switch between threads, and synchronization primitives (semaphores, locks, condition variables, and optimization barriers). Some of this code might seem slightly mysterious. You can read through parts of the source code to see what’s going on. If you like, you can add calls to printf() almost anywhere, then recompile and run to see what happens and in what order. You can also run the kernel in a debugger and set breakpoints at interesting spots, step through code and examine data, and so on. When a thread is created, the creator specifies a function for the thread to run, as one of the arguments to thread_create(). The first time the thread is scheduled and runs, it starts executing from the beginning of that function. When the function returns, the thread terminates. Each thread, therefore, acts like a mini-program running insi

Understanding threads | Pintos Documentation Skip to main content Menu Expand (external link) Document Search Copy Copied Pintos Documentation Understanding threads The first step is to read and understand the code for the thread system. Pintos already implements thread creation and thread completion, a simple scheduler to switch between threads, and synchronization primitives (semaphores, locks, condition variables, and optimization barriers). Some of this code might seem slightly mysterious. You can read through parts of the source code to see what’s going on. If you like, you can add calls

Explore this link on the map →

related reading