Basic Concepts in OS X Operation System(OSX系统的一些基本概念),准确地说是mach内核的一些基本概念
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Basic Concepts in OS X Operation System(OSX系统的一些基本概念),准确地说是mach内核的一些基本概念,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2479字,纯文字阅读大概需要4分钟。
内容图文
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.
原文:http://www.cnblogs.com/andypeker/p/4056485.html
内容总结
以上是互联网集市为您收集整理的Basic Concepts in OS X Operation System(OSX系统的一些基本概念),准确地说是mach内核的一些基本概念全部内容,希望文章能够帮你解决Basic Concepts in OS X Operation System(OSX系统的一些基本概念),准确地说是mach内核的一些基本概念所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。