# US 10,120,712 B2 · Instruction pre-fetching

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

- Number: US 10,120,712 B2
- Document ID: US10120712B2
- Status: Granted
- Kind: B2
- Application number: 15/202,105
- Filed: 2016-07-05
- Published: 2018-01-11
- Granted: 2018-11-06
- Earliest claimed: 2016-07-05
- Assignees: NXP USA, Inc.
- Applicants: Freescale Semiconductor, Inc.
- Inventors: Stefan Singer; Jochen M Gerster; Michael Rohleder
- Web page: https://patentgrep.com/patent/US10120712B2

## CPC

- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/3802: {Instruction prefetching}
- G06F 9/3814: {Implementation provisions of instruction buffers, e.g. prefetch buffer; banks}
- G06F 9/3842: {Speculative instruction execution}
- G06F 9/46: Multiprogramming arrangements
- G06F 9/48: Program initiating; Program switching, e.g. by interrupt
- G06F 9/4806: {Task transfer initiation or dispatching}
- G06F 9/4843: {by program, e.g. task dispatcher, supervisor, operating system}
- G06F 12/08: in hierarchically structured memory systems, e.g. virtual memory systems
- G06F 12/0862: with prefetch
- 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

Pre-fetching instructions for tasks of an operating system (OS) is provided by calling a task scheduler that determines a load start time for a set of instructions for a particular task corresponding to a task switch condition. The OS calls, and in response to the load start time, a loader entity module that generates a pre-fetch request that loads the set of instructions for the particular task from a non-volatile memory circuit into a random access memory circuit. The OS calls the task scheduler to switch to the particular task.

## Claims

### Claim 1

A method for pre-fetching instructions for tasks under the control of an operating system (OS), the method comprising:
calling, by the OS, a task scheduler in response to a task scheduler event, the task scheduler:
identifying a future task switch condition corresponding to a particular task and a task switch time;
accessing, in response to identifying the task switch condition, a task information queue to retrieve task information for the particular task; and
determining, based upon the task information and the task switch time, a load start time for a set of instructions for the particular task based on a load anticipation time for the set of instructions;
calling, by the task scheduler in response to the load start time, a loader entity module, the loader entity module generating, a pre-fetch request to load the set of instructions for the particular task from a non-volatile memory circuit into a random access memory circuit,
wherein the set of instructions includes less than all instructions in the particular task and less than all constant data for the particular task, and
wherein the loader entity module generates additional load anticipation times for additional sets of instructions for the particular task; and
switching, by the task scheduler and in response to the task switch time, to the particular task.

### Claim 2 (depends on 1)

The method of claim 1, wherein identifying the future task switch condition further comprises determining that a priority for the particular task is higher than a priority for other tasks in the task information queue.

### Claim 3 (depends on 1)

The method of claim 1, wherein identifying the future task switch condition further comprises: identifying an expiration time for a time slice; and determining that the particular task is assigned to a subsequent time slice.

### Claim 4 (depends on 1)

The method of claim 1, wherein determining, based upon the task information, the load start time for the particular task further comprises: determining an entire load anticipation time for the particular task as a function of a size of all instructions in the particular task and access time for the non-volatile memory circuit; and subtracting the entire load anticipation time from the task switch time to result in the load start time.

### Claim 5 (depends on 4)

The method of claim 4, further comprising determining the task switch time by selecting, as the task switch time, an earliest start time from a range of potential start times for the particular task.

### Claim 6 (depends on 5)

The method of claim 5, wherein the entire load anticipation time for the particular task includes the load anticipation time of the set of instructions for the particular task and the additional load anticipation times for additional sets of instructions for the particular task.

### Claim 7 (depends on 1)

The method of claim 1, wherein the OS is a real time OS that is executing on a processor core of an integrated circuit (IC) die and wherein the non-volatile memory circuit is a programmable read-only memory that is external to the IC die.

### Claim 8 (depends on 7)

The method of claim 7, wherein the task information queue includes task entries that specify a start address location and an end address location for the set of instructions in the non-volatile memory circuit, and task information used by the operating system.

### Claim 9 (depends on 1)

The method of claim 1, further comprising evicting, in response to the pre-fetch request, a resident set of instructions for another task from a first memory space within the random access memory circuit, and wherein the OS reserves a second memory space within the random access memory circuit for instructions that the loader entity module is not allowed to evict.

### Claim 10 (depends on 9)

The method of claim 9, wherein the instructions in the second memory space includes instructions for interrupt service routines.

### Claim 11 (depends on 1)

The method of claim 1, wherein the loader entity module is further configured to generate an additional pre-fetch request for each of the additional sets of instructions for the particular task.

### Claim 12

A system comprising:
a computer processor circuit that is configured for pre-fetching instructions for tasks under the control of an operating system (OS) by executing code that causes the computer processor circuit to:
call, by the OS, a task scheduler in response to task scheduler events, the task scheduler configured to:
identify a future task switch condition corresponding to a particular task and a task switch time;
access, in response to identifying the task switch condition, a task information queue to retrieve task information for the particular task;
determine, based upon the task information and the task switch time, a load start time for a set of instructions for the particular task based on a load anticipation time for the set of instructions;
switch, in response to the task switch time, to the particular task; and
call, in response to the load start time, a loader entity module, the loader entity module configured to generate a pre-fetch request to load the set of instructions for the particular task from a non-volatile memory circuit into a random access memory circuit,
wherein the set of instructions includes less than all instructions in the particular task and less than all constant data for the particular task, and
wherein the loader entity module generates additional loan anticipation times for additional sets of instructions for the particular task.

### Claim 13 (depends on 12)

The system of claim 12, wherein the task scheduler is further configured to identify the future task switch condition by determining that a priority for the particular task is higher than other tasks in the task information queue.

### Claim 14 (depends on 12)

The system of claim 12, wherein the task scheduler is further configured to identify the future task switch condition by: identifying an expiration time for a time slice; and determining that the particular task is assigned to a subsequent time slice.

### Claim 15 (depends on 12)

The system of claim 12, wherein the task scheduler is further configured to determine the load start time for the particular task by: determining an entire load anticipation time for the particular task as a function of a size of all instructions in the particular task and access time for the non-volatile memory circuit; and subtracting the entire load anticipation time from the task switch time to result in the load start time.

### Claim 16 (depends on 15)

The system of claim 15, wherein the task scheduler is further configured to determine the load start time by selecting, as the task switch time, an earliest start time from a range of potential start times for the particular task.

### Claim 17 (depends on 12)

The system of claim 12, wherein the OS is a real time OS executing on a system on a chip (SoC) and wherein the non-volatile memory circuit is a programmable read-only memory that is external to the SoC.

### Claim 18 (depends on 17)

The system of claim 17, wherein the task information queue includes task entries that specify a start address location and an end address location for the set of instructions in the non-volatile memory circuit and task information used by the operating system.

### Claim 19 (depends on 12)

The system of claim 12, wherein the loader entity module is further configured to evict a resident set of instructions for another task from a first memory space within the random access memory circuit, and wherein the loader entity reserves a second memory space within of the random access memory circuit for a set of instructions that cannot be evicted by the loader entity module.

### Claim 20 (depends on 19)

The system of claim 19, wherein the set of instructions that cannot be evicted include instructions for interrupt service routines.
