phase 4 network n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Phase 4: Network PowerPoint Presentation
Download Presentation
Phase 4: Network

Loading in 2 Seconds...

play fullscreen
1 / 18

Phase 4: Network - PowerPoint PPT Presentation


  • 168 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Phase 4: Network' - jonas-harvey


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
phase 4 network

Phase 4: Network

For ACM05, By Mu LI

the goal
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
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)
codes provided
Codes provided
  • machine.NetworkLink.java – provides ordered, unreliable, transmission of limits size packets between nodes
  • machine.Packet.java – transmission unit
your work
Your work
  • Define the message formats over Packet.java
  • Design a socket states transition table
a sample format
A sample format
  • The control bit (FIN, …) take one bit, resp. and is in effect when 1
  • Blank is just for keeping regular
message types
Message Types
  • The message is the type iff all correspond control bits are 1 and the others are 0
class mailmessage
Class: MailMessage
  • 持有其所对应的machine.Packet格式的对象packet
  • 发送时使用NetworkLink.send()发送packet
  • 重载hashcode()使得其与对应的packet有相同的hash,以便查找
class socket
Class: Socket
  • Socket类保存一个端对端的全双工通讯的信息
  • Socket类继承自machine.Openfile
socket read
Socket.Read()
  • 从接收缓冲队列receiveBuffer中读取字节,无等待的返回实际读到的字节数
  • receiveBuffer中消息按照先后顺序存放至多16个MailMessage,顺序是PostOffice保证的
socket write
Socket.Write()
  • 将所需要写的字节分割打包成MailMessage
  • 列队入发送窗口队列sendWindow
  • 当sendWindow满了时,列队入发送缓冲队列sendBuffer
class postoffice
Class: PostOffice
  • PostOffice类是实现状态转移的核心类,它管理所有的消息的发送与接受,维护所有的socket状态
  • 运行时候只有一个实例,内部维护5条进程:
    • 处理中断的receiveHandler和sendHandler
    • 收发消息的receiveThread和sendThread
    • 定时启动发送消息的timeoutThread
class netprocess
Class: NetProcess
  • 主要任务是处理两个新的sysvcall:
    • syscallConnect
      • 首先新建相应的socket,将socket加入进程的descriptor table和PostOffice的socket table。然后维护socket状态,发送SYN,一直等待收到SYN/ACK才返回
    • syscallAccept
      • 取出SYN,根据消息取出对应的socket,将socket放入进程的descriptor table,维护socket状态