# US 10,872,006 B2 · Ensuring thread affinity for interprocess communication in a managed code environment

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 10,872,006 B2
- Document ID: US10872006B2
- Status: Granted
- Kind: B2
- Application number: 16/124,654
- Filed: 2018-09-07
- Published: 2019-03-07
- Granted: 2020-12-22
- Earliest claimed: 2006-03-23
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Microsoft Technology Licensing, LLC
- Inventors: Jackson M. Davis; John A. Shepard
- Web page: https://patentgrep.com/patent/US10872006B2

## CPC

- G06F 9/547: {Remote procedure calls [RPC]; Web services}
- G06F 9/546: {Message passing systems or structures, e.g. queues}
- H04L 67/1001: for accessing one among a plurality of replicated servers
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

A remote procedure call channel for interprocess communication in a managed code environment ensures thread-affinity on both sides of an interprocess communication. Using the channel, calls from a first process to a second process are guaranteed to run on a same thread in a target process. Furthermore, calls from the second process back to the first process will also always execute on the same thread. An interprocess communication manager that allows thread affinity and reentrancy is able to correctly keep track of the logical thread of execution so calls are not blocked in unmanaged hosts. Furthermore, both unmanaged and managed hosts are able to make use of transparent remote call functionality provided by an interprocess communication manager for the managed code environment.

## Claims

### Claim 1

A method comprising:
transmitting, in a channel, an interprocess message from a first object to a second object, wherein the first object is executing on a first process in a runtime managed environment and the second process is external to the first process, and wherein the channel is thread reentrant and enables thread affinity between the first process and the second process.

### Claim 2 (depends on 1)

The method of claim 1, wherein the channel is a remote procedure call channel for interprocess communication.

### Claim 3 (depends on 1)

The method of claim 1, wherein the channel enables managed hosts and unmanaged hosts to use remote call functionality of the channel.

### Claim 4 (depends on 1)

The method of claim 1, wherein the first process executes a thread used to:
transmit the interprocess message from the first object to the second object; and
transmit a response message from the second object to the first object.

### Claim 5 (depends on 1)

The method of claim 1, wherein the first process is a host process and the second process is an add-in process.

### Claim 6 (depends on 1)

The method of claim 1, wherein the channel is managed by an interprocess communication manager configured to track a logical thread of execution to prevent call blocking in unmanaged hosts.

### Claim 7 (depends on 1)

The method of claim 1, wherein the channel comprises one or more interprocess communication objects for processing the interprocess message before the interprocess message is transmitted to the second object.

### Claim 8 (depends on 7)

The method of claim 7, wherein processing the interprocess message comprises generating, in the first process, a proxy object for the second object, wherein calls to the proxy object are intercepted by a runtime environment associated with the channel.

### Claim 9 (depends on 8)

The method of claim 8, wherein the runtime environment is configured to determine whether the calls are a valid method of the second object.

### Claim 10 (depends on 7)

The method of claim 7, wherein processing the interprocess message comprises applying a binary encoding or an XML encoding to the interprocess message.

### Claim 11 (depends on 1)

The method of claim 1, wherein the channel enables the first process to transmit additional messages while awaiting a response to the interprocess message from the second object.

### Claim 12

A system comprising:
at least one processor; and
memory coupled to the at least one processor, the memory comprising computer executable instructions that, when executed by the at least one processor, performs a method comprising:
transmitting, in a channel, an interprocess message from a first object to a second object, wherein the first object is executing on a first process in a runtime managed environment and the second process is external to the first process, and wherein the channel is thread reentrant and enables thread affinity between the first process and the second process.

### Claim 13 (depends on 12)

The system of claim 12, wherein the system further comprises an interprocess communication manager configured to track a logical thread of execution to prevent call blocking in unmanaged hosts.

### Claim 14 (depends on 12)

The system of claim 12, wherein the system further comprises a message filter to selectively control reentrancy, wherein the message filter is installed as a single-threaded process.

### Claim 15 (depends on 12)

The system of claim 12, wherein when the first object activates the second object, the channel creates a local instance of the second object, wherein the local instance comprises a list of classes and interface methods for the second object.

### Claim 16 (depends on 15)

The system of claim 15, wherein a runtime environment of the system is operable to determine whether the second object is located in a same application domain as the local instance.

### Claim 17 (depends on 15)

The system of claim 15, wherein, when the second object is an unmanaged object, the local instance of the second object is exposed through a runtime wrapper.

### Claim 18 (depends on 12)

The system of claim 12, wherein the channel is a Common Object Model remote procedure call channel.

### Claim 19 (depends on 12)

The system of claim 12, wherein the first process is a host process and the second process is an add-in process.

### Claim 20

A device comprising at least one processor, the processor executing a method comprising:
transmitting, in a channel, an interprocess message from a first object to a second object, wherein the first object is executing on a first process in a runtime managed environment and the second process is external to the first process, and wherein the channel is thread reentrant and enables thread affinity between the first process and the second process.
