Q38. The nurse is reviewing the chart of a newly admitted p…
Q38. The nurse is reviewing the chart of a newly admitted patient. The complete blood count (CBC) indicates that the patient has Immune Thrombocytopenia Purpura (ITP). Which nursing actions should be included in the plan of care? (Select all that apply)
Read DetailsFor questions 37–39, consider the following two lock implem…
For questions 37–39, consider the following two lock implementations running on a multiprocessor system. Lock A: typedef struct { int flag; } lock_A_t; void acquire_A(lock_A_t *lock) { while (lock->flag == 1) ; // spin lock->flag = 1; } void release_A(lock_A_t *lock) { lock->flag = 0; } Lock B: typedef struct { int ticket; int turn; } lock_B_t; void acquire_B(lock_B_t *lock) { int myturn = FetchAndAdd(&lock->ticket); while (lock->turn != myturn) ; // spin } void release_B(lock_B_t *lock) { lock->turn++; } Where FetchAndAdd atomically increments *addr and returns the old value: int FetchAndAdd(int *addr) { int old = *addr; *addr = old + 1; return old; }
Read DetailsConsider this thread_join implementation: void thread_join()…
Consider this thread_join implementation: void thread_join() { mutex_lock(&m); if (done == 0) cond_wait(&cv, &m); mutex_unlock(&m); } void thread_exit() { mutex_lock(&m); done = 1; cond_signal(&cv); mutex_unlock(&m); } True/False: This implementation is correct: thread_join will always wait until the child thread has called thread_exit.
Read Details