|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.kernel.devices.NetworkDriver
public class NetworkDriver
This class defines a "synchronous" network abstraction for sending and receiving packets on the network. As with other I/O devices, the raw physical network is an asynchronous device -- requests to send or receive packets return immediately, and an interrupt occurs later to signal that the operation completed. This class provides synchronization so that its methods (send and receive) return when the network operation finishes. It also provides synchronization to ensure that the next send operation starts only after the previous send operation (if any) finished; this is required for the network to work correctly.
Packet
,
Network
Nested Class Summary | |
---|---|
private class |
NetworkDriver.ReceiveHandler
Network driver interrupt handler class. |
private class |
NetworkDriver.SendHandler
Network driver interrupt handler class. |
Field Summary | |
---|---|
private byte |
id
Network address of this machine. |
private nachos.machine.Network |
network
Raw network device. |
private Semaphore |
receiveSemaphore
Semaphore used to synchronize receiving threads with the interrupt handler. |
private Lock |
sendLock
Lock used to ensure that the previous send request finished before the next send request starts. |
private Semaphore |
sendSemaphore
Semaphore used to synchronize sending threads with the interrupt handler. |
Constructor Summary | |
---|---|
NetworkDriver(java.lang.String[] args)
Initialize the synchronous interface to the physical network, in turn initializing the physical network. |
Method Summary | |
---|---|
nachos.machine.Packet |
receive()
Receive a network packet. |
void |
send(nachos.machine.Packet p)
Send a network packet. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private nachos.machine.Network network
private Semaphore sendSemaphore
private Semaphore receiveSemaphore
private Lock sendLock
private byte id
Constructor Detail |
---|
public NetworkDriver(java.lang.String[] args)
args
- Array containing command-line argumentsMethod Detail |
---|
public nachos.machine.Packet receive()
public void send(nachos.machine.Packet p)
p
- The packet to send.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |