  We study, from a network layer perspective, the effect of an Ad-Hoc secondary
network with N nodes randomly accessing the spectrum licensed to a primary node
during the idle slots of the primary user. If the sensing is perfect, then the
secondary nodes do not interfere with the primary node and hence do not affect
its stable throughput. In case of imperfect sensing, it is shown that if the
primary user's arrival rate is less than some calculated finite value,
cognitive nodes can employ any transmission power or probabilities without
affecting the primary user's stability; otherwise, the secondary nodes should
control their transmission parameters to reduce the interference on the
primary. It is also shown that in contrast with the primary's maximum stable
throughput which strictly decreases with increased sensing errors, the
throughput of the secondary nodes might increase with sensing errors as more
transmission opportunities become available to them. Finally, we explore the
use of the secondary nodes as relays of the primary node's traffic to
compensate for the interference they might cause. We introduce a relaying
protocol based on distributed space-time coding that forces all the secondary
nodes that are able to decode a primary's unsuccessful packet to relay that
packet whenever the primary is idle. In this case, for appropriate modulation
scheme and under perfect sensing, it is shown that the more secondary nodes in
the system, the better for the primary user in terms of his stable throughput.
Meanwhile, the secondary nodes might benefit from relaying by having access to
a larger number of idle slots due to the increase of the service rate of the
primary. For the case of a single secondary node, the proposed relaying
protocol guarantees that either both the primary and the secondary benefit from
relaying or none of them does.
