drm30963 2013-10-18 07:45
浏览 44

Go语言中的Mach端口和Channel如何相互关联?

The Mach ports which are widely used as a mechanism for IPC in XNU(, the kernel for OS X and iOS), act as endpoints of queue of messages.

Go Channel is well known to be modeled after C. A. R. Hoare's Communicating Sequential Processes. How about Mach ports? Regardless of the security and rights properties of ports and type safety of Go Channel, are they working in the same pattern in nature?

  • 写回答

1条回答 默认 最新

  • dourao1896 2013-10-18 08:38
    关注

    According to wikipedia a Mach port is:

    a protected message queue for communication between tasks; tasks own send and receive rights to each port

    • Go implements some of the CSP concepts in its memory model. Mach port implementations could but don't have to, follow CSP.

    • A Mach port is a much higher level structure, managed by the OS kernel and communicating two separate memory spaces. Go channels (usually) communicate two goroutines.

    • Go channels can be buffered (effectively building a queue) but don't have to be, whereas Mach ports are always queues.

    • Go channels are typed, Mach ports don't care about the information being transmitted.

    • A Go channel cannot be used to communicate two separate processes, a Mach port can.

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化