IP Library Granted Patent US 11,474,861
Granted Patent B1
US 11,474,861 · App. 16/698,451 · Granted Oct 18, 2022

Methods and systems for managing asynchronous function calls

Inventor: Bernhard Poess (Redmond, WA)
Assignee: Meta Platforms Technologies, LLC
G06F9/4881G06F9/3871G06F9/52
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,474,861
App. No.
16/698,451
Granted
Oct 18, 2022
Kind
B1
Abstract

This disclosure generally relates to operating systems and methods of computing devices for managing system and function calls. An example method include determining that a fiber is requesting to wait for one or more results of an asynchronous function call, pausing execution of the fiber until the one or more results are completed, enqueuing the paused fiber in a local queue of the one or more results, determining that the one or more results are completed, accessing one or more queued fibers in the local queue of the one or more results. The one or more queued fibers comprise the fiber and resuming execution of the one or more queued fibers, and the asynchronous function call is called by a thread to execute a task without being blocked while the task is being completed.

Claims (61)

1. A method comprising, by an operating system executing on a computing device:

determining that a first fiber is requesting to wait for a future associated with one or more results generated by an asynchronous function call, wherein the asynchronous function call is called by a thread to execute a task without being blocked while the task is being completed;

pausing execution of the first fiber until the future is completed, wherein the future is completed when the asynchronous function call generates the one or more results;

enqueuing the paused first fiber in a local queue associated with the future that the first fiber is waiting for;

determining that the future is completed;

accessing one or more queued fibers in the local queue of the future, wherein the one or more queued fibers comprise the first fiber;

prioritizing execution of the one or more queued fibers in the local queue over fibers in a global queue based on a priority policy;

resuming execution of the one or more queued fibers.

2. The method of claim 1 , wherein the one or more queued fibers further comprise a second fiber whose execution is paused until the one or more results are completed.

3. The method of claim 1 , further comprising:

enqueuing the one or more queued fibers on an execution queue of a thread;

wherein the resuming execution of the one or more queued fibers is performed by the thread.

4. The method of claim 3 , further comprising:

selecting at least one executable fiber from the execution queue or the global queue based on the priority policy, wherein the execution queue has a higher priority than the global queue.

5. The method of claim 1 , wherein the one or more results are associated with a second local queue configured to store work items that are waiting for the one or more results to complete.

6. The method of claim 5 , further comprising:

in response to determining that the one or more results are completed, accessing one or more work items in the second local queue of the one or more results; and

resuming execution of the one or more work items.

7. The method of claim 6 , further comprising:

enqueuing the one or more work items on an execution queue of a thread;

wherein the resuming execution of the one or more queued work items is performed by the thread.

8. The method of claim 7 , further comprising:

selecting at least one work item for execution from the execution queue or the global queue based on the priority policy, wherein the execution queue has a higher priority than the global queue.

9. One or more computer-readable non-transitory storage media embodying software that is operable when executed to:

determine that a first fiber is requesting to wait for one or more results of an asynchronous function call, wherein the asynchronous function call is called by a thread to execute a task without being blocked while the task is being completed;

pause execution of the first fiber until the one or more results are completed;

enqueue the paused first fiber in a local queue associated with the one or more results that the first fiber is waiting for;

determine that the one or more results are completed;

access one or more queued fibers in the local queue of the one or more results, wherein the one or more queued fibers comprise the first fiber;

prioritizing execution of the one or more queued fibers in the local queue over fibers in a global queue based on a priority policy; and

resume execution of the one or more queued fibers.

10. The media of claim 9 , wherein the one or more queued fibers further comprise a second fiber whose execution is paused until the one or more results are completed.

11. The media of claim 9 , wherein the media is configured to: enqueue the one or more queued fibers on an execution queue of a thread;

wherein the resuming execution of the one or more queued fibers is performed by the thread.

12. The media of claim 11 , wherein the media is configured to:

select at least one executable fiber from the execution queue or the global queue based on the priority policy, wherein the execution queue has a higher priority than the global queue.

13. The media of claim 9 , wherein the one or more results are associated with a second local queue configured to store work items that are waiting for the one or more results to complete.

14. The media of claim 13 , wherein the media is configured to:

in response to determining that the one or more results are completed, access one or more work items in the second local queue of the one or more results; and

resume execution of the one or more work items.

15. The media of claim 14 , wherein the media is configured to:

enqueue the one or more work items on an execution queue of a thread;

wherein the resuming execution of the one or more queued work items is performed by the thread.

16. The media of claim 15 , wherein the media is configured to:

select at least one work item for execution from the execution queue or the global queue based on the priority policy, wherein the execution queue has a higher priority than the global queue.

17. 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 or more of the processors to cause the system to:

determine that a first fiber/work item is requesting to wait for one or more results of an asynchronous function call, wherein the asynchronous function call is called by a thread to execute a task without being blocked while the task is being completed;

pause execution of the first fiber/work item until the one or more results are completed;

enqueue the paused first fiber/work item in a local queue associated with the one or more results that the first fiber is waiting for;

determine that the one or more results are completed;

access one or more queued fibers/works item in the local queue of the one or more results, wherein the one or more queued fibers/work items comprise the first fiber/work item;

prioritizing execution of the one or more queued fibers in the local queue over fibers in a global queue based on a priority policy; and

resume execution of the one or more queued fibers/work items.

18. The system of claim 17 , wherein the one or more queued fibers/work items further comprise a second fiber/work item whose execution is paused until the one or more results are completed.

19. The system of claim 17 , wherein the system is configured to:

enqueue the one or more queued fibers/work items on an execution queue of a thread;

wherein the resuming execution of the one or more queued fibers/work items is performed by the thread.

20. The system of claim 19 , wherein the system is configured to:

select at least one executable fiber/work item from the execution queue or the global queue based on the priority policy, wherein the execution queue has a higher priority than the global queue.

Assignments (2)
CHANGE OF NAME Recorded Jul 6, 2022
From: FACEBOOK TECHNOLOGIES, LLC
To: META PLATFORMS TECHNOLOGIES, LLC
Reel/Frame 060591/0848 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Dec 19, 2019
From: POESS, BERNHARD
To: FACEBOOK TECHNOLOGIES, LLC
Reel/Frame 051331/0471 →