type
status
date
slug
summary
tags
category
icon
password
  • 缓冲区技术
notion image
读数据填入缓冲区,写数据从缓冲区中流出
  • 内核空间和用户空间
  • 虚拟内存 — 虚拟地址指向真实的物理地址(RAM)<N:1>,虚拟内存>>>物理内存
  • 分页技术
  • 面向文件的IO和流的IO
  • 多工IO

同步阻塞io

notion image

同步非阻塞io

notion image

io多路复用

notion image

信号驱动io

notion image

异步io

notion image

NIO

  • buffer
    • capacity position limit mark
    • 核心api
      • buffer.put(), buffer.put(int, x)
      • buffer.flip(), buffer.compact()
      • buffer.position(int)
      • buffer.get()
      • buffer.mark()
      • buffer.rewind(), buffer.reset()
      • buffer.hasRemaining()
      • compareTo()
        • 对象类型相同
        • 剩余元素数量相同,(position到limit的距离一致)
        • get()返回的元素序列一致
  • Channel
    • FileChannel — 文件操作通道
    • SocketChannel — 连接数据传输
    • ServerSocketChannel — 服务器套接字通道,负责连接监听
    • DatagramChannel — 用于UDP数据报通信
  • selector
    • SelectKey.OP_READ 1 << 0
    • SelectKey.OP_WRITE 1 << 2
    • SelectKey.OP_CONNECT 1 << 3
    • SelectKey.OP_ACCEPT 1 << 4
    • 事件操作
      • 删除事件 — key.interestOps(key.interestOps() & (~XXX));
      • 添加事件 — key.interestOps(key.interestOps() | XXX);

字节顺序

  • 大端字节存储
  • 小端字节存储
notion image