Previous | Next --- Slide 107 of 129
Back to Lecture Thumbnails
kayvonf

Review questions:

  • Why did I change the program to use two threads of control?
  • "Wait, there's two threads of control?" (I only see one call to pthread_create). What's going on here?
  • Kayvon seems to be using thread of control and instruction stream somewhat interchangeably on this slide. Why?
legolas

Because there are two different cores which can run the operations independently.

pthread_create creates another thread the original thread is still alive.

My guess for this would be because we only have a single execution context on each core.

sboucher

I would add to @legolas's first point that the two cores can only process instructions from independent instruction. This is critical: without launching a second thread, the application will never see any benefit from the additional core.

Each of the two threads runs one of the lines commented with "do work."

A thread is a programming abstraction that maps at the hardware level to a single instruction stream: each thread has its own control path through the code, which determines the sequence of operations in its corresponding instruction stream.