How does a single thread does the work of multiple threads?
问题 I have a program that is representing a car making factory. A queue holds the car parts to be made, each number represents a different part of the car, ex. 4 is window, we need 7 windows: queue(^: front, *: rear): [0^, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 7*] num_workers represent the number of workers who can work parallely(threads). This is the part of the main where I call the thread function. int num_work = num_cars * NUM_PARTS; int k=0; while(k<num_work){ for(int i=0;i<num