3. 1) If item popped from stack2 is null, item popped from stack1 not returned to stack. 2) Lock on both stacks not released if either items popped is null. 3) Deadlock if we have swap(a,b) and swap(b,a) since both threads could end up holding what the other needs to terminate. Soln: if (stack1 > stack2){ tmp = stack1; stack1 = stack2; stack2 = tmp; } if((item1=pop(stack1)) == NULL){ // nothing to do } else if ((item2=pop(stack2)) == NULL){ // restore stack1 push(stack1, item1); } else { push(stack1, item2); push(stack2, item1); } v(stack1); v(stack2); 4. If get preempted in transmitter() after 'thread_start(rcv)' and before 'thread_stop()', then receive will try to start a running thread. And vice versa. Also, this same situation could happen on startup if the starting thread is preempted after starting both threads. The users will observe that the radar will either crash on startup, or occasionally make it pass startup and crash after some period of time. System performance will also be slow while it is running. Soln: sem transok = semaphore_create(); sem rcvok = semaphore_create(); void startradar(){ xmitter = thread_create(transmitter); rcv = thread_create(receiver); transok = semaphore_init(1); rcvok = semaphore_init(0); thread_start(xmitter); thread_start(rcv); } void transmitter(){ while (true){ p(oktotrans); //transmit v(rcvok); } } void receiver(){ while (true){ p(rcvok); //receive v(oktotrans); } }