CS208 Introduction to Computer Systems Wednesday, 1 March 2023 + Buffer overflow details - Why can you call touch2/touch3 correctly and still get a seg fault? - Anything else? + pthreads_test.c - Get pthreads_test.c from the samples page - Get these class notes from the home page Questions to answer - What does p in pthreads stand for? - Compile the program. What is "-lpthread" for? How (if at all) is that related to the line #include in the source code? - Run it. What does the program do? - pthread_join - What does pthread_join do? - Try commenting out both pthread_join calls. Recompile and run. What happens and why? - (You'll want to uncomment those lines when you're done.) - pthread_mutex - What is this type for? - What does "mutex" stand for? - Try commenting out every line that contains the substring "lock" Recompile and run. What happens and why? ("Why" might be hard to get precise about.) - What is the role of the should_quit variable? Why not just use time_to_quit directly? - (Digression: What is "stdbool.h" for? Why would you care?) - (Digression: What does perror do? How does it decide what to print?) - Sum up - What is a thread? - How is a thread different from a process? - How can threads in the same process communicate with one another? Resources to use - man pthread_create, etc. - internet search - experimentation with the sample + The assignment + More: why threads?