• Basic Concepts in OS X Operation System(OSX系统的一些基本概念),准确地说是mach内核的一些基本概念



    Tasks
    A task is a logical representation of an execution environment. Tasks are used
    in order to divide system resources between each running program. Each task
    has its own virtual address space and privilege level. Each task contains one or
    more threads. The tasks address space and resources are shared between each
    of its threads.
    On Mac OS X, new tasks can be created using either the task create() function
    or the fork() BSD syscall.

    Threads
    In Mach, a thread is an independent execution entity. Each thread has its own
    registers and scheduling policies. Each thread has access to all the elements
    within the task it is contained within.
    On Mac OS X, a list of all the threads in a task can be obtained using the
    task threads() function shown below.

    kern_return_t task_threads
        (task_t task,
        thread_act_port_array_t thread_list,
        mach_msg_type_number_t* thread_count);

    The Mach API on Mac OS X provides a variety of functions for dealing with

    threads. Through this API, new threads can easily be created, register contents
    can be modified and retrieved, and so on.

    Msgs
    Messages are used in Mach in order to provide communicate between threads.
    A message is made up of a collection of data objects. Once a message is created
    it is sent to a port for which the invoking task has the appropriate port rights.
    Port rights can be sent between tasks as a message. Messages are queued at the
    destination and processed at the liberty of the receiving thread.
    On Mac OS X, the mach msg() function be used to send and receive messages
    to and from a port. The declaration for this function is shown below.

    mach_msg_return_t mach_msg
      (mach_msg_header_t msg,
      mach_msg_option_t option,
      mach_msg_size_t send_size,
      mach_msg_size_t receive_limit,
      mach_port_t receive_name,
      mach_msg_timeout_t timeout,
      mach_port_t notify);

    Ports
    A port is a kernel controlled communication channel. It provides the ability to
    pass messages between threads. A thread with the appropriate port rights for a
    port is able to send messages to it. Multiple ports which have the appropriate
    port rights are able to send messages to a single port concurrently. However,
    only a single task may receive messages from a single port at any given time.
    Each port has an associated message queue.

    Port Set
    A port set is (unsurprisingly) a collection of Mach ports. Each of the ports in
    a port set use the same queue of messages.

  • 相关阅读:
    oracle 复制表结构 复制表数据 sql 语句
    Linux rsync实现断点续传
    qt实现一个简单的计算器
    python脚本0b文件处理
    同步和互斥
    python中的randint,引入模块
    python中常见的三种句型if,while,for
    python中的变量,运算符
    python安装与使用
    常见dos命令总结
  • 原文地址:https://www.cnblogs.com/andypeker/p/4056485.html
Copyright © 2020-2023  润新知