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.

时间: 2024-11-07 06:31:58

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

Introduction and Basic concepts

1 Network Edge The device such as computers and mobiles connect to the Internet. So they are referred as end systems(who run the application programs) sitting at the edge of the Internet. And we use host and end system interchangeably, that is host=e

Operation System - Peterson's Solution算法 解决多线程冲突

Person's solution 是用来一种基于软件的解决关键区域问题的算法(critical-section). 它并不是完美的,有可能不对地工作.并且是限制解决两个进程同步的问题. 可是它非常easy,非常原始,学习起来也是非常轻松的. 代码例如以下: do { flag[i] = true; turn = j; while (flag[j] && turn == j); critical section flag[i] = false; remainder section } wh

Operation System - Peterson's Solution算法 解决多线程冲突

Person's solution 是用来一种基于软件的解决关键区域问题的算法(critical-section). 它并非完美的,有可能不正确地工作.而且是限制解决两个进程同步的问题. 但是它很简单,很原始,学习起来也是很轻松的. 代码如下: do { flag[i] = true; turn = j; while (flag[j] && turn == j); critical section flag[i] = false; remainder section } while (tr

Pattern Discovery Basic Concepts

Pattern Discovery Basic Concepts @(Pattern Discovery in Data Mining)[Pattern Discovery] 本文介绍了基本的模式挖掘的概念 Pattern: A set of items, subsequences, or substructures that occur frequently together (or strongly correlated) in a data set. Motivation to do pa

Basic Concepts of Block Media Recovery

Basic Concepts of Block Media Recovery Whenever block corruption has been automatically detected, you can perform block media recovery manually with the RECOVER ... BLOCK command. By default, RMAN first searches for good blocks in the real-time query

In-memory Computing with SAP HANA读书笔记 - 第一章:Basic concepts of in-memory

本文为In-memory Computing with SAP HANA on Lenovo X6 Systems第一章Basic concepts of in-memory computing的读书笔记. 作为基础概念,本章非常重要.此Redbook讲得浅显易懂,配图也容易理解.唯一需要深读是DL ACM的那篇论文,后续我会再补充. "卑之,毋甚高论,令今可行也", 本章正符合汉文帝对于张释之的要求. Basic concepts of in-memory computing In-

【转】OS X Base System 上没有足够的空间来进行安装

今天在windows环境下安装IOS虚拟机,安装过程中报了一个错:"OS X Base System "上没有足够的空间来进行安装.如图: 之后的解决办法是:点击上方的[实用工具]->[磁盘工具],显示如下: 选择下方的[VMware virtual SA--],然后点击上方的[抹掉]按钮,弹出弹框: 填入名称后,点击弹框中的[抹掉]按钮,然后关闭磁盘工具.在安装页面可以看到可使用的硬盘: 选择该硬盘,点击[继续]按钮,即可继续安装. from:https://blog.csdn

Basic Concepts 基本概念(二)

Basic Concepts There are a few concepts that are core to Elasticsearch. Understanding these concepts from the outset will tremendously help ease the learning process. 有一些概念是Elasticsearch的核心.从一开始就理解这些概念将极大地帮助简化学习过程. Near Realtime (NRT) Elasticsearch i

iOS&OSX系统初步了解

本文算是自己的一个笔记吧. 介绍: Unix于1969年诞生于贝尔实验室的计算机科学家Ken Thompson的头脑中,Thompson和Ritchie为支持游戏开发而在PDP-7上编制的实用程序成了Unix的核心——虽然直到1970年才产生Unix这个名字,1978年,第一个Unix公司(the Santa Cruz Operation,SCO)成立,同年售出第一个商用C编译器(Whitesmiths) AF_INET域与AF_UNIX域socket通信原理对比 http://blog.csd