# US 2009/0276778 A1 · Context switching in a scheduler

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

- Number: US 2009/0276778 A1
- Document ID: US20090276778A1
- Status: Published application
- Kind: A1
- Application number: 12/113,209
- Filed: 2008-05-01
- Published: 2009-11-05
- Earliest claimed: 2008-05-01
- Assignees: Microsoft Corporation
- Inventors: Paul F. Ringseth; Genevieve Fernandes
- Web page: https://patentgrep.com/patent/US20090276778A1

## CPC

- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/461: {Saving or restoring of program or task context}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A scheduler in a process of a computer system detects a task with an associated execution context that has not been previously invoked by the scheduler. The scheduler executes the task on a processing resource without performing a context switch if the processing resource executed a previous task to completion. The scheduler stores the execution context originally associated with the task for later use.

## Claims

### Claim 1

A method performed by a scheduler of a process executing on a computer system, the method comprising:
executing a first task associated with a first execution context to completion on a first processing resource allocated to the scheduler; and
executing a second task associated with a second execution context with the first execution context on the first processing resource in response to the second task not being invoked previously by the scheduler.

### Claim 2 (depends on 1)

The method of claim 1 further comprising:
executing the second task with the second execution context on the first processing resource in response to the second task being invoked previously by the scheduler.

### Claim 3 (depends on 2)

The method of claim 2 further comprising:
performing a context switch from the first execution context to the second execution context on the first processing resource in response to the second task being invoked previously by the scheduler.

### Claim 4 (depends on 1)

The method of claim 1 further comprising:
storing the second execution context in response to executing the second task with the first execution context.

### Claim 5 (depends on 1)

The method of claim 1 further comprising:
switching to the second execution context on the first processing resource to execute a third task associated with the second execution context and previously invoked by the scheduler subsequent to executing the second task with the first execution context.

### Claim 6 (depends on 1)

The method of claim 1 further comprising:
switching to the second execution context on a second processing resource allocated to the scheduler to execute a third task associated with the second execution context and previously invoked by the scheduler subsequent to executing the second task with the first execution context.

### Claim 7 (depends on 1)

The method of claim 1 further comprising:
obtaining the first execution context from an operating system prior to executing the first task.

### Claim 8 (depends on 1)

The method of claim 1 wherein the first processing resource includes a virtual processor and a hardware thread.

### Claim 9

A computer readable storage medium storing computer-executable instructions that, when executed by a computer system, perform a method in a scheduler in a process executing on the computer system, the method comprising:
executing a first task associated with a first execution context as a continuation on a second execution context on a first processing resource of the scheduler in response to the first task being not invoked previously by the scheduler; and
performing a first context switch from the second execution context to the first execution context on the first processing resource in response to the first task being invoked previously by the scheduler.

### Claim 10 (depends on 9)

The computer readable storage medium of claim 9, the method further comprising:
storing the first execution context in response to executing the first task with the second execution context.

### Claim 11 (depends on 10)

The computer readable storage medium of claim 10, the method further comprising:
performing a second context switch from the second execution context to the first execution context on the first processing resource to execute a second task associated with the first execution context subsequent to executing the first task with the second execution context.

### Claim 12 (depends on 10)

The computer readable storage medium of claim 10, the method further comprising:
performing a second context switch from a third execution context to the first execution context on a second processing resource of the scheduler to execute a second task associated with the first execution context.

### Claim 13 (depends on 9)

The computer readable storage medium of claim 9, the method further comprising:
executing the first task with the first execution context on the first processing resource subsequent to performing the first context switch.

### Claim 14 (depends on 9)

The computer readable storage medium of claim 9, the method further comprising:
executing a second task associated with the second execution context to completion on the first processing resource prior to executing the first task with the second execution context.

### Claim 15 (depends on 9)

The computer readable storage medium of claim 9, the method further comprising:
performing the first context switch from the second execution context to the first execution context on the first processing resource in response to a second task associated with the second execution context blocking or being interrupted.

### Claim 16

A method performed by a scheduler in a process executing on a computer system comprising:
detecting a first task associated with a first execution context, wherein the first task has not been invoked previously by the scheduler; and
executing the first task as a continuation on a second execution context on a first processing resource of the scheduler.

### Claim 17 (depends on 16)

The method of claim 16 further comprising:
executing the first task as the continuation on the second execution context on the first processing resource in response to a second task executed by the first processing resource with the second execution context completing and not blocking or being interrupted.

### Claim 18 (depends on 16)

The method of claim 16 further comprising:
storing the first execution context in response to executing the first task as the continuation.

### Claim 19 (depends on 16)

The method of claim 16 further comprising:
performing a context switch from the second execution context to the first execution context on the first processing resource to execute a second task associated with the first execution context subsequent to executing the first task as the continuation.

### Claim 20 (depends on 16)

The method of claim 16 further comprising:
performing a context switch from a third execution context to the first execution context on a second processing resource of the scheduler to execute a second task associated with the first execution context.
