Notes Chapter 4

Wednesday, Sept. 10th, 2014

  • Started out with Moodle quiz on chapters 1, 2, and 3 (10 to 15 minutes).
  • Using the lectures slides and the link to the external tutorial on pthread, students worked on Activity 4.
  • Reviewed the concept of function pointer in C.
  • Discussed type casting in C.
  • Discussed how to pass multiple parameters into a thread, when pthread_create accepts a single parameter of type void *.
  • Discussed the danger of having a function return the address of an automatic variable.

Friday, Sept. 12th, 2014

  • More discussion on type casting in C.
  • Discussion of Activity 4.

Monday, Sept. 15th, 2014

  • Sample code for the semester in the ~cs315/F2014/code directory. Look at the three examples casting.cmythreads1.c, and mythreads2.c.
  • Threads: text, data, stack, and heap – what is shared, what is not shared.
  • Why it makes sense for threads to have separate stacks.
  • Comparison of multithreading models: many-to-one, one-to-one, many-to-many.
  • What happens to threads when: a process calls exit or exec.
  • Thread pools: avoids the overhead (run time) in creating threads; limits the number of active threads.
  • Thread unsafe library calls: how to spot them, how to avoid them. Looked at the man page for ctime(3).

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.