1 / 18

Phase 4: Network

Phase 4: Network. For ACM05, By Mu LI. The Goal. Implement a full-duplex, reliable, byte-stream communication with no size limits. Write a chat-room program to test your codes. The network layer of nachos. IP Address  LinkAddress Port Number  Port Number

Download Presentation

Phase 4: Network

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Phase 4: Network For ACM05, By Mu LI

  2. The Goal • Implement a full-duplex, reliable, byte-stream communication with no size limits. • Write a chat-room program to test your codes.

  3. The network layer of nachos • IP Address  LinkAddress • Port Number  Port Number • UDP  Embedded in Machine.NetworkLink • UDP Packet  Machine.Packet • TCP  Embedded in the Network Package • TCP Packet  Network.MailMessage • TCP Network Daemon  Network.PostOffice • TCP Socket  Tuple of (SrcLinkAddr, DestLinkAddr, SrcPort, DestPort)

  4. A Graphic Example Provided

  5. Codes provided • machine.NetworkLink.java – provides ordered, unreliable, transmission of limits size packets between nodes • machine.Packet.java – transmission unit

  6. Your work • Define the message formats over Packet.java • Design a socket states transition table

  7. A sample format • The control bit (FIN, …) take one bit, resp. and is in effect when 1 • Blank is just for keeping regular

  8. Message Types • The message is the type iff all correspond control bits are 1 and the others are 0

  9. The states for socket

  10. The Events Cause Transition

  11. States Transition Table

  12. Class: MailMessage • 持有其所对应的machine.Packet格式的对象packet • 发送时使用NetworkLink.send()发送packet • 重载hashcode()使得其与对应的packet有相同的hash,以便查找

  13. Class: Socket • Socket类保存一个端对端的全双工通讯的信息 • Socket类继承自machine.Openfile

  14. Socket.Read() • 从接收缓冲队列receiveBuffer中读取字节,无等待的返回实际读到的字节数 • receiveBuffer中消息按照先后顺序存放至多16个MailMessage,顺序是PostOffice保证的

  15. Socket.Write() • 将所需要写的字节分割打包成MailMessage • 列队入发送窗口队列sendWindow • 当sendWindow满了时,列队入发送缓冲队列sendBuffer

  16. Class: PostOffice • PostOffice类是实现状态转移的核心类,它管理所有的消息的发送与接受,维护所有的socket状态 • 运行时候只有一个实例,内部维护5条进程: • 处理中断的receiveHandler和sendHandler • 收发消息的receiveThread和sendThread • 定时启动发送消息的timeoutThread

  17. Class: NetProcess • 主要任务是处理两个新的sysvcall: • syscallConnect • 首先新建相应的socket,将socket加入进程的descriptor table和PostOffice的socket table。然后维护socket状态,发送SYN,一直等待收到SYN/ACK才返回 • syscallAccept • 取出SYN,根据消息取出对应的socket,将socket放入进程的descriptor table,维护socket状态

  18. Thank you • Q & A

More Related