CS139-lecture-20210928

Threads cont. #

How TCBs are mapped to the processes address space.

image_2021-09-28-13-45-15

User-level threads #

image_2021-09-28-13-48-16 image_2021-09-28-13-50-47 image_2021-09-28-13-52-47 image_2021-09-28-13-56-26

Multithreading models #

image_2021-09-28-13-57-10 image_2021-09-28-13-57-22

The bottleneck created by the many-to-one model can be alleviated in the one-to-one model.

image_2021-09-28-13-57-29 image_2021-09-28-13-57-34

The M:M model maintains slightly more user threads than kernel threads.

image_2021-09-28-14-04-37

So why do the biggest OSes use the one-to-one model? More cores in CPUs, more CPUs in general.

Thread libraries #

image_2021-09-28-14-08-23 image_2021-09-28-14-09-11 image_2021-09-28-14-09-50 image_2021-09-28-14-09-56 image_2021-09-28-14-10-01 image_2021-09-28-14-13-44 image_2021-09-28-14-13-48 image_2021-09-28-14-13-53 image_2021-09-28-14-13-58 image_2021-09-28-14-14-02

Implicit threading #

image_2021-09-28-14-16-43 image_2021-09-28-14-17-29 image_2021-09-28-14-23-08 image_2021-09-28-14-25-30 image_2021-09-28-14-25-35

Issues #

image_2021-09-28-14-27-29 image_2021-09-28-14-27-36

Single threaded image_2021-09-28-14-28-33
Multi-threaded has 2 possibilities image_2021-09-28-14-32-26 The child can either have 1 thread (the invoking thread), or all.

image_2021-09-28-14-36-12

Thread local storage is stuff like

  • stack allocated variables
  • parameters
  • return values
  • other things on stack

image_2021-09-28-14-36-47