Preface. 1. Introduction. The Development of Mach.
OSF/1.
Fundamental Mach Concepts.
Getting Started with Mach.
Header Files.
Compilation and Libraries.
2. Tasks And Threads. Using Mach Tasks.
Designing Applications with Multiple Tasks.
Talking about Tasks.
Spawning a New Task.
Identifying Mach Tasks.
Using Mach Threads.
Designing Applications with Multiple Threads.
Modular Program Design.
Increased Performance.
Sharing Data among Threads.
Multithreading Existing Programs.
Thread-Safe Libraries.
Mach Thread Calls.
Spawning a New Thread.
Preparing the New Thread to Run.
Running a New Thread.
The Demise of a Thread.
A Multithreaded Example.
Single-Threaded Design.
Multithreading Design.
Creating the Threads.
Preparing the New Thread for Execution.
Performing the Computation.
When Are We Done?
The Complete Multithreaded Program.
Mach Task Calls.
Suspending and Resuming All Threads in a Task.
Finding All Threads in a Task.
Requesting Task Information.
Specialized Task IPC Ports.
Miscellaneous Thread Calls.
Aborting Threads Cleanly.
Specialized Thread IPC Ports.
Requesting Thread Information.
3. Interprocess Communication (IPC). General IPC Concepts.
Access Rights.
Seamless Distributed Computing.
Port Names.
The Time Server.
Initialization.
Receiving a Message.
Process and Reply.
The Complete Time Server.
Server Compilation and Execution.
The Client.
Client Initialization.
Sending the Message.
The Complete Client Program.
Client Compilation and Execution.
4. Virtual Memory. Introduction.
The Problems and the Remedy.
Mach Virtual Memory Basics.
Page Sizes and Ranges.
Data Types.
Memory Allocation.
Memory Movement Operations.
Reading and Writing Memory.
Copying Memory.
Demonstrating Memory Movement Operations.
Memory Protections.
Mechanics of Vm_Protect.
A Vm_Protect Example.
Memory Inheritance Between Related Tasks.
Vm_Inherit In Action.
Reporting on Memory Regions.
System Call Summary.
5. Threads. Synchronization.
Mutual Exclusion.
Condition Variables.
Multithreaded Search.
Declarations and Global Variables.
Set Up.
Thread Creation.
Termination.
The String Search.
Additional C Thread Functions.
C Threads.
Mutex Locking.
Condition Signaling.
Mutex and Condition Management.
Naming.
Complete Program Example.
6. Mach Exception Handling. Overview of Mach Exception Handling.
Exception Handling Philosophy.
The Steps in Exception Processing.
Exception Ports.
Registering the Thread Exception Port.
Using the Thread Exception Port.
The Task Exception Port.
Exception IPC Messages.
The Notification Message.
The Reply Message.
Three Sample Exception Handlers.
Developing a Simple Exception Handler.
Sample Program 1.
Illustrating the Exception Port Hierarchy.
Sample Program 2.
Modifying the Victim Thread.
Sample Program 3.
Mach Exceptions versus UNIX signals.
Summary.
7. Advanced IPC. Out-of-Line Data.
Message RPC.
Port Sets.
Kernel Notifications.
Header and Type Structure Options.
Longform of the Type Structure.
Transferring Port Rights.
Deallocation of Resources.
Port Backlog.
Port Status.
Port Names and Port Rights.
Renaming Ports.
Port Names.
Ports as Objects.
Interposing Port Rights.
Forging Ports.
Name Servers.
Network Message Server.
Environment Manager.
Summary.
8. Mach Interface Generator (MIG). MIG Overview.
Subsystem Identifier.
Type Specifications.
Simple Types.
Complex Types.
Polymorphic Types.
Translation Information.
Import Declarations.
Operation Descriptions.
Option Declarations.
Type Translation Information.
Compiling a Specification File.
Complete Example.
MIG Definitions File.
Header File.
Client Program.
Server Program.
9. External Memory Management. Introduction.
Overview of Relationships.
Client View of EMM.
Obtaining a Memory Object.
Mapping a Memory Object.
Accessing Mapped Memory.
Pager Overview.
Pager View of the Initial Connection.
EMM Interfaces.
Memory Object Initialization.
Memory Object Attributes.
Setting Attributes.
Retrieving Attributes.
Page Fault Handling.
Supplying the Data.
Valid Region, No Data.
Paging Error.
Memory_Object_Data_Request Example.
Page-Out Handling.
Memory_Object_Data_Write Example.
Page Protection Faults and Consistency.
Memory_Object_Data_Unlock .
Memory_Object_Lock_Request.
Memory_Object_Lock_Completed.
Memory_Object_Data_Unlock Example.
Shutting Down a Memory Object.
Memory_Object_Terminate.
Memory_Object_Destroy.
Races and Other Topics.
Terminate Versus Init.
Page-In Versus Page-Out.
Distributed Shared Memory.
EMM Interface Summary.
10. OSF/1 P Threads. Basic P Threads Calls.
Creating and Terminating Pthreads.
Pthread Attributes.
Waiting for Pthreads.
Detaching Pthreads.
Synchronization Facilities.
Who Am I?
Yielding the Processor.
Pthread-Specific Data.
Advanced P Threads Topics.
Pthread Cancellation.
Cleanup Routines.
P Threads and Signals.
Pthread Error Reporting.
Two Example P Threads Programs.
Using Reentrant Libraries.
11. Mach Programming. Memory Management.
Why a UNIX Program Might Fail Under Mach.
Mixing UNIX and Mach.
Signals.
Using Threads.
Multiplexing I/O with Threads.
Debugging a Multithreaded Program.
Implicitly Shared Data.
Summary.
Appendix A. Mig Generated Files. Time.H.
Timeuser.C.
Timeserver.C.
Appendix B. EMM Example. Reading the Programs.
Running the Programs.
Makefile.
Sm.Defs.
Sm_Decls.H.
Sm_Pager.C.
Sm_Emm.C.
Sm_Dsm.C.
Sm_Encryption.C.
Common_Funcs.C.
Appendix C. System And Library Call Summary. Mach Interfaces.
nterprocess Communication.
Tasks and Threads.
Virtual Memory.
External Memory Management.
C Threads Library Calls.
P Threads Library Calls.
Appendix D. References. Index. 0201527391T04062001