# US 11,029,968 B1 · Operating system with a single kernel stack per processor

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

- Number: US 11,029,968 B1
- Document ID: US11029968B1
- Status: Granted
- Kind: B1
- Application number: 16/528,221
- Filed: 2019-07-31
- Granted: 2021-06-08
- Earliest claimed: 2019-07-31
- Assignees: Facebook Technologies, LLC
- Applicants: Facebook Technologies, LLC
- Inventors: Christoph Klee; Bernhard Poess
- Web page: https://patentgrep.com/patent/US11029968B1

## CPC

- G06F 9/4406: {Loading of operating system}
- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/4812: {by interrupt, e.g. masked}
- G06F 9/5027: {the resource being a machine, e.g. CPUs, Servers, Terminals}
- G06F 9/545: {where tasks reside in different layers, e.g. user- and kernel-space}
- G06F 12/0875: with dedicated cache, e.g. instruction or stack
- G06F 2212/1021: Hit rate improvement
- G06F 2212/1028: Power efficiency
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

In one embodiment, a method includes storing thread state information associated with the first user-mode thread into a memory space associated with the first user-mode thread when executing in kernel space in response to a first system call by a first-user mode thread, executing first operations corresponding to the first system call on a processor, where data associated with executing the first operations are stored on a kernel stack associated with the processor, determining to pause the execution of the first operations, enqueuing a workload on a schedule queue for resuming execution of the first operations in a future, where the workload comprises data associated with executing a remainder of the first operations, and executing second operations corresponding to a second system call from a second user-mode thread on the processor, where data associated with executing the second operations are stored on the kernel stack associated with the processor.

## Claims

### Claim 1

A method comprising, by a kernel-mode thread of an operating system of a computing device:
storing, in response to a first system call by a first-user mode thread, thread state information associated with the first user-mode thread into a memory space associated with the first user-mode thread when executing in kernel space;
executing, on a processor of the computing device, first operations corresponding to the first system call, wherein data associated with executing the first operations are stored on a kernel stack associated with the processor;
determining to pause the execution of the first operations;
enqueuing a workload on a schedule queue for resuming the execution of the first operations in a future, wherein the workload comprises data associated with executing a remainder of the first operations; and
executing, on the processor, second operations corresponding to a second system call from a second user-mode thread, wherein data associated with executing the second operations are stored on the kernel stack associated with the processor.

### Claim 2 (depends on 1)

The method of claim 1, wherein the thread state information associated with the first user-mode thread is a snapshot of register values associated with the processor when the first user-mode thread makes the first system call.

### Claim 3 (depends on 1)

The method of claim 1, wherein the processor is associated with only one kernel-mode thread.

### Claim 4 (depends on 1)

The method of claim 1, wherein the memory space associated with the first user-mode thread is a Thread-Local Storage (TLS) associated with the first user-mode thread.

### Claim 5 (depends on 1)

The method of claim 1, wherein the memory space associated with the first user-mode thread is a Thread Control Block (TCB) associated with the first user-mode thread.

### Claim 6 (depends on 1)

The method of claim 1, wherein determining to pause the execution of the first operations comprises calling a scheduler function, wherein the scheduler function makes a schedule decision among a plurality of workloads in the schedule queue.

### Claim 7 (depends on 6)

The method of claim 6, wherein the schedule decision is made based on one or more scheduling policies.

### Claim 8 (depends on 1)

The method of claim 1, wherein the second operations comprise returning to the second user-mode thread.

### Claim 9 (depends on 8)

The method of claim 8, wherein returning to the second user-mode thread comprises:
retrieving thread state information associated with the second user-mode thread from a memory space associated with the second user-mode thread;
returning results of the second operations to the second system call; and
restoring registers of the processor with the retrieved thread state information.

### Claim 10 (depends on 1)

The method of claim 1, wherein the operating system is a microkernel-based operating system, wherein user-mode threads in the operating system comprise user application threads and service-providing threads.

### Claim 11 (depends on 10)

The method of claim 10, wherein a first service-providing thread provides a particular service to second threads, wherein the second threads comprise other service-providing threads or user application threads.

### Claim 12 (depends on 11)

The method of claim 11, wherein a request for the particular service from one of the second threads to the first service-providing thread is communicated through one of available Inter-Process Communication (IPC) mechanisms.

### Claim 13 (depends on 11)

The method of claim 11, wherein a result of the particular service from the first service-providing thread to one of the second threads is communicated through one of available IPC mechanisms or a shared memory.

### Claim 14 (depends on 10)

The method of claim 10, wherein the service-providing threads comprise device drivers.

### Claim 15 (depends on 10)

The method of claim 10, wherein the user application threads are implemented with an event-driven architecture.

### Claim 16

One or more computer-readable non-transitory storage media embodying software that is operable by a kernel-mode thread of an operating system of a computing device when executed to:
store, in response to a first system call by a first user-mode thread, thread state information associated with the first user-mode thread into a memory space associated with the first user-mode thread when executing in kernel space;
execute, on a processor of the computing device, first operations corresponding to the first system call, wherein data associated with executing the first operations are stored on a kernel stack associated with the processor;
determine to pause the execution of the first operations;
enqueue a workload on a schedule queue for resuming the execution of the first operations in a future, wherein the workload comprises data associated with executing a remainder of the first operations; and
execute, on the processor, second operations corresponding to a second system call from a second user-mode thread, wherein data associated with executing the second operations are stored on the kernel stack associated with the processor.

### Claim 17 (depends on 16)

The media of claim 16, wherein the thread state information associated with the first user-mode thread is a snapshot of register values associated with the processor when the first user-mode thread makes the first system call.

### Claim 18 (depends on 16)

The media of claim 16, wherein the processor is associated with only one kernel-mode thread.

### Claim 19 (depends on 16)

The media of claim 16, wherein the memory space associated with the first user-mode thread is a Thread-Local Storage (TLS) associated with the first user-mode thread.

### Claim 20

A system comprising:
one or more processors; and
one or more computer-readable non-transitory storage media coupled to one or more of the processors and comprising instructions operable when executed by one of the processors to cause a kernel-mode thread of an operating system of the system to:
store, in response to a first system call by a first user-mode thread, thread state information associated with the first user-mode thread into a memory space associated with the first user-mode thread when executing in kernel space;
execute, on a processor among the one or more processors, first operations corresponding to the first system call, wherein data associated with executing the first operations are stored on a kernel stack associated with the processor;
determine to pause the execution of the first operations;
enqueue a workload on a schedule queue for resuming the execution of the first operations in a future, wherein the workload comprises data associated with executing a remainder of the first operations; and
execute, on the processor, second operations corresponding to a second system call from a second user-mode thread, wherein data associated with executing the second operations are stored on the kernel stack associated with the processor.
