Consider the following code where the same condition variable is used to make threads block in channel_send and channel_receive: 1. enum channel_status channel_send(channel_t* channel, void* data) 2. { 3. pthread_mutex_lock(&channel->mutex); 4. 5. while (buffer_current_size(channel->buffer) == buffer_capacity(channel->buffer)) { 6. pthread_cond_wait(&channel->cond_var, &channel->mutex); 7. } 8. 9. buffer_add(channel->buffer, data);10. pthread_cond_signal(&channel->cond_var);11. pthread_mutex_unlock(&channel->mutex);12.13. return SUCCESS;14. } 15. enum channel_status channel_receive(channel_t* channel, void** data)16. {17. pthread_mutex_lock(&channel->mutex);18. 19. while (buffer_current_size(channel->buffer) == 0) {20. pthread_cond_wait(&channel->cond_var, &channel->mutex);21. }22. 23. buffer_remove(channel->buffer, data);24. pthread_cond_signal(&channel->cond_var);25. pthread_mutex_unlock(&channel->mutex);26. 27. return SUCCESS;28. } Suppose Channel A has a capacity of 1 message and it is currently empty, with no waiting threads in send or receive and the following sequence occurs: Thread 1 and Thread 2 are both created to receive a message from Channel A. These threads start running and block in line 20. The main thread sends a message on Channel A two times. Describe a specific thread ordering using the active threads (i.e., the main thread and threads 1 & 2) that will lead to one thread getting stuck in line 6 and another getting stuck in line 20 forever. You cannot introduce any new threads to the situation, and assume all other channel functions and the usage of these functions are correct.
For an online exam, a working webcam is required and it’s im…
For an online exam, a working webcam is required and it’s important to place your webcam in the right position, so your exam is valid. The side-angle view for the camera, on your left or right side, is required, and it captures the profile of your face, both your hands, and your workspace (including all sheets of scratch paper, computer screen, keyboard, and mouse) during the entire exam session. This may require placing the camera on a surface other than your desk, such as a nearby table. Ensure your camera is securely positioned using a tripod or other support to prevent movement during the exam. Check your Honorlock recording screen. Do you place your camera in the right position and do you perform the required scan? WARNING: To ensure the integrity of the exam, make sure your side-angle view meets the requirement. Failure to do so may result in a zero grade.
What is the purpose of a “Red Team” in the context of AI dev…
What is the purpose of a “Red Team” in the context of AI development?
How do you categorize algorithms which are trained by provid…
How do you categorize algorithms which are trained by providing explicit examples of results sought?
What are tools that put users in control so that they can cr…
What are tools that put users in control so that they can create custom reports on a as-needed basis by selecting fields, ranges, summary conditions and other parameters?
What term does our textbook apply to a protester seeking to…
What term does our textbook apply to a protester seeking to make a political point by leveraging technology tools, often though system infiltration, defacement, or damage?
What is the term for the physical threat of gaining compromi…
What is the term for the physical threat of gaining compromising information through observation?
What term does our textbook apply to a con (or scam) execute…
What term does our textbook apply to a con (or scam) executed using technology, typically targeted at acquiring sensitive information or tricking someone into installing malicious software?
What are small pieces of code that are accessible via the ap…
What are small pieces of code that are accessible via the application server, and permit interoperable machine-to-machine interaction over a network?
What are attacks so new that they haven’t been clearly ident…
What are attacks so new that they haven’t been clearly identified, and haven’t made it into security screening systems?