IPC机制概念

发布于 2024-12-19 20:20:53 字数 89 浏览 10 评论 0原文

我想了解OS中的这些IPC机制概念——共享内存、消息系统、套接字、RPC、RMI,

不同的操作系统是如何实现这些的。具体是Android操作系统吗?

I want to understand these IPC mechanism concepts in OS - Shared Memory, Message System, Sockets, RPC, RMI

How do different operating systems implement these. Specifically Android operating system?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

但可醉心 2024-12-26 20:20:53

IPC是操作系统中的进程间通信机制是一个大讨论的概念,所以,我认为这里我们不能涵盖所有这些,

一些低级的东西:

这里讨论的IPC机制处于最低级别——所有其他 CPU 间 IPC 机制都使用它作为基础。例如,通过 ARM11 处理器到另一个处理器的 TCP/IP 连接最终会通过此 IPC 机制。诊断消息是依赖此低级 IPC 的消息的另一个示例。

IPC 机制由两侧实现:“客户端”,面向内核并提供基于回调的接口风格;“CPU 侧”,提供与其他 CPU 的接口。

  • CPU 端实现为共享内存接口,
    中断和“门铃”机制。在最高级别,发送
    从ARM11到另一个CPU的消息,消息内容放置
    在共享内存的缓冲区中,并且硬件端口被触发
    向另一个 CPU 指示数据可用。

  • 在相反的方向上,数据被放置到共享内存中
    另一个 CPU 和 ARM11 上触发硬件中断。
    该硬件中断使 ARM11 检查共享的
    内存的缓冲区,检索消息并将其路由到客户端。

但更具体到Android:

android中的IPC,它描述了不同类型的android组件如何通信的机制。

Android 实现了一些关键工具,用于在程序之间安全地进行通信或协调。这些机制使 Android 应用程序能够在后台运行进程、提供其他应用程序使用的服务、安全地共享关系数据、启动其他程序以及安全地重用其他应用程序的组件。

  • 大部分进程间通信 (IPC) 发生在 Android 上
    是通过传递一个名为的数据结构来完成的
    意图。这些是信息的集合,其中有一些
    系统可以使用预期属性来帮助确定去哪里
    如果开发人员未明确表示,则发送 Intent。动作属性
    表达 Intent 的用途(Intent.ACTION_VIEW 操作
    例如,表示数据要显示给用户)。
    data 属性是一个可选的 URI,可以指向一个文件,
    联系方式、网页、电话号码等。意图也可能是
    有一组称为 extras 的键/值对以及标志,
    组件以及其他更高级的功能。

  • 这些 IPC 机制中的每一个都以某种能力使用意图,并​​且是
    大多数 Android 开发人员可能都有些熟悉。然而,
    因为安全地使用这些是 Android 安全的关键,

1) Intents 是组件可以发送和接收的消息。它是在进程之间传递数据的通用机制。在意图的帮助下,人们可以启动服务或活动、调用广播接收器等等。

2) Bundles 是数据的实体通过了。它类似于对象的序列化,但在 android 上要快得多。可以通过 getExtras() 方法从 Intent 获取 Bundle。

3) Binders 是允许活动和服务获取对另一个服务的引用。它不仅允许简单地向服务发送消息,还允许直接调用它们的方法。

欲了解更多信息,请参阅:

  1. 掌握Android的IPC机制

  2. Android 的安全 IPC机制

IPC is inter-process communication mechanisms in OS is large discussion concept so, I think here we can't cover all this,

Some Low Level stuff:

The IPC mechanism discussed here is at the lowest level—all other inter-CPU IPC mechanisms use it as the base. For example, a TCP/IP connection through the ARM11 processor to another processor ends up going through this IPC mechanism. Diagnostic messages are another example of messages that rely on this low-level IPC.

The IPC mechanism is implemented with two sides—a "client side," which faces the kernel and provides a callback-based style of interface, and a "CPU side," which provides the interface to the other CPUs.

  • The CPU side is implemented as a shared-memory interface, with
    interrupts and a "doorbell" mechanism. At the highest level, to send
    messages from the ARM11 to another CPU, the message content is placed
    in a buffer in shared memory and a hardware port is tickled to
    indicate to the other CPU that data is available.

  • In the reverse direction, the data is placed into shared memory by
    the other CPU and a hardware interrupt is triggered on the ARM11.
    This hardware interrupt causes the ARM11 to examine the shared
    memory's buffer, retrieve the message and route it to the client.

But to more specific to Android:

IPC in android, It describes the mechanism how different types of android components are communicated.

Android implements a few key tools used to communicate with or coordinate between programs securely. These mechanisms give Android applications the ability to run processes in the background, offer services consumed by other applications, safely share relational data, start other programs, and reuse components from other applications safely.

  • Much of the interprocess communication (IPC) that occurs on Android
    is done through the passing around of a data structures called
    Intents. These are collections of information that have a few
    expected properties the system can use to help figure out where to
    send an Intent if the developer wasn’t explicit. The Action property
    expresses what the Intent is for (the Intent.ACTION_VIEW action
    indicates that the data is to be displayed to the user, for example).
    The data property is an optional URI and could point to a file,
    contact, web page, phone number, and so on. Intents also potentially
    have a collection of key/value pairs called extras, as well as flags,
    components, and other more advanced features.

  • Each of these IPC mechanisms uses Intents in some capacity and is
    probably somewhat familiar to most Android developers. However,
    because using these safely is key to Android security,

1) Intents are messages which components can send and receive. It is a universal mechanism of passing data between processes. With help of the intents one can start services or activities, invoke broadcast receivers and so on.

2) Bundles are entities the data is passed through. It is similar to the serialization of an object, but much faster on android. Bundle can be got from intent via the getExtras() method.

3) Binders are the entity which allows activities and services obtain a reference to another services. It allows not simply send messages to services but directly invoke methods on them.

For more info look at:

  1. Grasping Android's IPC mechanism

  2. Android’s Securable IPC Mechanisms

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文