I take this question of the The Linux Programming Interface:
I want someone to explain the under line statement because it sounds complex to me couldn't understand anything
30-1 Modify the program (thread_incr.c) so that each loop in the thread’s start function outputs the current value of glob and some identifier that uniquely identifies the thread.
Run the program, redirecting output to a file, and then inspect the
file to see what happens to glob as the kernel scheduler alternates execution between the
two threads.
Code:
A Linux and Unix System Programming page 652 exercise 30.1
30-1 Modify the program (thread_incr.c) so that each loop in the thread’s start function outputs the current value of glob and some identifier that uniquely identifies the thread.
Code:
The unique identifier for the thread could be specified as an argument to the pthread_create()
call used to create the thread. For this program, that would require changing the argument
of the thread’s start function to be a pointer to a structure containing the unique identifier
and a loop limit value.
file to see what happens to glob as the kernel scheduler alternates execution between the
two threads.