# US 2014/0208083 A1 · Multi-threaded logging

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

- Number: US 2014/0208083 A1
- Document ID: US20140208083A1
- Status: Published application
- Kind: A1
- Application number: 13/745,173
- Filed: 2013-01-18
- Published: 2014-07-24
- Earliest claimed: 2013-01-18
- Assignees: Morgan Stanley
- Applicants: Morgan Stanley
- Inventors: Graeme Burnett
- Web page: https://patentgrep.com/patent/US20140208083A1

## CPC

- G06F 11/3636: {by tracing the execution of the program}
- G06F 9/526: {Mutual exclusion algorithms}
- G06F 11/0775: {Content or structure details of the error report, e.g. specific table structure, specific error fields}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A data slot may be reserved for a first thread selected from a plurality of threads executed by a computer system. A memory of the computer system may comprise a plurality of log files and a next free data slot pointer. Each log file may comprise a plurality of data slots and each of the data slots may be of a common size. Reserving the data slot for the first thread may comprise attempting to perform a first atomic operation to write to a first data slot pointed to by a current value of the next free data slot pointer an indication that the first data slot is filled. If the first atomic operation is successful, the computer system may update the next free data slot pointer to point to a second data slot positioned sequentially after the first data slot. If the first atomic operation is unsuccessful, the computer system may analyze the second data slot.

## Claims

### Claim 1

A computer implemented system for maintaining logs for use by multiple threads, the system comprising:
a computer system, the computer system comprising at least one processor and operatively associated memory, wherein the memory comprises:
a plurality of log files, wherein each log file of the plurality of log files comprises a plurality of data slots and wherein each of the plurality of data slots are of a common size; and
a next free data slot pointer;
wherein the computer system is programmed to execute a plurality of threads;
wherein the computer system is programmed to reserve a data slot for a first thread selected from the plurality of threads, wherein reserving the data slot for the first thread comprises:
attempting to perform a first atomic operation to write to a first data slot pointed to by a current value of the next free data slot pointer an indication that the first data slot is filled; and
performing one of the following disjunctive steps based on whether the first atomic operation is successful:
conditioned upon success of the first atomic operation, updating the next free data slot pointer to point to a second data slot positioned sequentially after the first data slot; and
conditioned upon failure of the first atomic operation, analyzing the second data slot.

### Claim 2 (depends on 1)

The system of claim 1, wherein the first atomic operation is a compare and set operation, and wherein the compare comprises comparing a value of a status field of the first data slot to a known status value, and wherein the set comprise the writing to the first data slot the indication that the first data slot is filled.

### Claim 3 (depends on 2)

The system of claim 2, wherein writing to the first data slot the indication that the first data slot is filled comprises writing the indication that the first data slot is filled to the status field of the first data slot.

### Claim 4 (depends on 1)

The system of claim 1, wherein the computer system is further programmed to reserve a data slot for a second thread selected from the plurality of threads by the second thread, wherein reserving the data slot for the second thread selected from the plurality of threads comprises:
attempting to perform a second atomic operation to write to the first data slot an indication that the first data slot is filled; and
performing one of the following disjunctive steps based on whether the second atomic operation is successful:
conditioned upon success of the second atomic operation, updating the next free data slot pointer to point to a second data slot positioned sequentially after the first data slot; and
conditioned upon failure of the second atomic operation, determining whether the second data slot is free.

### Claim 5 (depends on 4)

The system of claim 4, wherein the first atomic operation fails when the second atomic operation completes before the first atomic operation.

### Claim 6 (depends on 1)

The system of claim 1, wherein analyzing the second data slot comprises:
attempting to perform a third atomic operation to write to the second data slot an indication that the second data slot is filled; and
performing one of the following disjunctive steps based on whether the third atomic operation is successful:
conditioned upon success of the third atomic operation, updating the next free data slot pointer to point to a third data slot positioned sequentially after the second data slot; and
conditioned upon failure of the third atomic operation, analyzing the third data slot.

### Claim 7 (depends on 1)

The system of claim 1, wherein reserving the data slot for the first thread further comprises, conditioned upon success of the first atomic operation:
generating a reserved data slot pointer pointing to the first data slot; and
providing the reserved data slot pointer to the first thread.

### Claim 8 (depends on 1)

The system of claim 1, wherein the computer system is further programmed to, also conditioned upon success of the first atomic operation, write, by the first thread, to the first data slot.

### Claim 9 (depends on 1)

The system of claim 1, wherein the first data slot is part of a first log file of the plurality of log files, and wherein reserving the data slot for the first thread further comprises:
conditioned upon the first log file being filled, updating the next free data slot pointer to point to a fourth data slot that is part of a second log file positioned sequentially after the first log file, wherein the updating is performed utilizing a fourth atomic operation.

### Claim 10 (depends on 9)

The system of claim 9, wherein the memory further comprises a log file counter, wherein reserving the data slot for the first thread further comprises:
also conditioned upon the first log file being filled, updating a log file pointer.

### Claim 11 (depends on 9)

The system of claim 9, wherein the plurality of threads comprises an administrative thread, and wherein the administrative thread is configured to:
periodically close at least one filled log file from the plurality of log files; and
add at least one new log file to the plurality of log files to replace the at least one filled log file that was closed.

### Claim 12 (depends on 11)

The system of claim 11, wherein adding the at least one new log file to the plurality of log files comprises memory mapping the at least one new log file to the memory.

### Claim 13 (depends on 1)

The system of claim 1, wherein each of the plurality of data slots comprises a predefined number of data fields.

### Claim 14 (depends on 1)

The system of claim 1, wherein the first atomic operation is also a buitin_expect( ) operation configured to expect that the first data slot is unfilled.

### Claim 15 (depends on 1)

The system of claim 1, wherein the memory comprises kernel space and wherein the plurality of log files are positioned in the kernel space.

### Claim 16 (depends on 15)

The system of claim 15, wherein the computer device is further configured to execute a kernel, and wherein the kernel is configured to write the set of log files to a persistent data storage device of the computer system upon a failure of the computer device.

### Claim 17 (depends on 1)

The system of claim 1, wherein the plurality of log files are memory mapped to the kernel space.

### Claim 18 (depends on 1)

The system of claim 1, wherein each of the plurality of log files is of a predefined size.

### Claim 19

A computer implemented method for maintaining logs for use by multiple threads, the system comprising:
reserving a data slot for a first thread selected from a plurality of threads executed by a computer system, wherein the computer system comprises at least one processor and operatively associated memory, wherein the memory comprises a plurality of log files and a next free data slot pointer, wherein each log file of the plurality of log files comprises a plurality of data slots and wherein each of the plurality of data slots are of a common size, and wherein reserving the data slot for the first thread comprises:
attempting to perform a first atomic operation to write to a first data slot pointed to by a current value of the next free data slot pointer an indication that the first data slot is filled; and
performing one of the following disjunctive steps based on whether the first atomic operation is successful:
conditioned upon success of the first atomic operation, updating the next free data slot pointer to point to a second data slot positioned sequentially after the first data slot; and
conditioned upon failure of the first atomic operation, analyzing the second data slot.

### Claim 20 (depends on 19)

The method of claim 19, wherein the memory comprises kernel space and wherein the plurality of log files are positioned in the kernel space.
