# US 10,310,876 B2 · Executing application code based on manner of accessing a hard disk

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

- Number: US 10,310,876 B2
- Document ID: US10310876B2
- Status: Granted
- Kind: B2
- Application number: 15/337,700
- Filed: 2016-10-28
- Published: 2017-02-16
- Granted: 2019-06-04
- Earliest claimed: 2014-04-30
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Xiaosong Lei
- Web page: https://patentgrep.com/patent/US10310876B2

## CPC

- G06F 9/45504: {Abstract machines for program code execution, e.g. Java virtual machine [JVM], interpreters or emulators}
- G06F 3/061: {Improving I/O performance}
- G06F 8/61: Installation
- G06F 2009/45579: {I/O management, e.g. providing access to device drivers or storage}
- G11B 2220/2516: Hard disks
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- G11B: INFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER (recording measured values in a way that does not require playback through a transducer G01D9/00; recording or playback apparatus using mechanically marked tape, e.g. punched paper tape, or using unit records, e.g. punched or magnetically marked cards G06K; transferring data from one type of record carrier to another G06K1/18; circuits for coupling output of reproducer to radio receiver H04B1/20; gramophone pick-ups or like acoustic electromechanical transducers or circuits therefor H04R)

## Abstract

A method for a hard disk to execute application code and an apparatus relate to the field of storage technologies such that a hard disk can support a manner of accessing the hard disk based on application code that is from outside of the hard disk, thereby improving performance of the hard disk, and improving a capability of a client to interact with the hard disk. The method includes receiving, by a hard disk, application code and an execution policy of the application code, determining, by the hard disk according to the application code, whether the application code needs to be executed in a virtual machine environment, and executing, by the hard disk in the virtual machine environment, the application code according to the execution policy of the application code when the application code needs to be executed in the virtual machine environment.

## Claims

### Claim 1

A method for executing application code based on a manner of accessing a hard disk, wherein the hard disk comprises a processor, a data interface, and a hard disk medium that stores data, and wherein the method comprises:
receiving, by the data interface and from a server, the application code, wherein the application code is related to the data, and wherein the application code carries a virtual machine identifier;
determining, by the processor, according to the application code, whether to execute the application code in a virtual environment within the hard disk, wherein the virtual environment is used for running the application code; and
executing, by the processor, the application code to process the data in the hard disk medium in response to determining to execute the application code in the virtual environment.

### Claim 2 (depends on 1)

The method of claim 1, wherein, before receiving the application code, the method further comprises:
receiving, by the processor, virtual data information for creating the virtual environment; and
creating, by the processor, the virtual environment according to the virtual data information.

### Claim 3 (depends on 2)

The method of claim 2, wherein, after executing the application code, the method further comprises:
receiving, by the processor, an execution indication instructing the hard disk to store the virtual data information; and
performing, by the processor, an operation on the virtual data information according to the execution indication.

### Claim 4 (depends on 1)

The method of claim 1, wherein the virtual environment is a virtual machine environment.

### Claim 5 (depends on 1)

The method of claim 1, wherein executing the application code comprises:
creating, by the processor, an application code process for the application code in the virtual environment;
loading, by the processor, the application code into a memory of the hard disk corresponding to the application code process; and
executing, by the processor in the virtual environment, the application code process.

### Claim 6 (depends on 1)

The method of claim 1, further comprising executing the application code according to an execution policy comprising a trigger condition for executing the application code.

### Claim 7 (depends on 1)

The method of claim 1, further comprising executing the application code according to an execution policy comprising an execution condition of the application code.

### Claim 8 (depends on 1)

The method of claim 1, further comprising executing the application code according to an execution policy comprising an operation to be executed after execution of the application code is completed.

### Claim 9

A method for executing application code based on a manner of accessing a hard disk, wherein the hard disk comprises a processor, a random-access memory (RAM), a data interface, and a hard disk medium that stores data, and wherein the method comprises:
receiving, by the data interface and from a server, the application code, wherein the application code is related to the data;
creating, by the processor, an application code process for the application code, wherein the application code process is a dynamic execution of a program and is a unit of allocating and scheduling resources by an operating system;
loading, by the hard disk, the application code into the RAM; and
executing, by the processor, the application code process to process the data.

### Claim 10 (depends on 9)

The method of claim 9, further comprising processing the data according to an execution policy of the application code, wherein the execution policy comprises:
at least one of a trigger condition for executing the application code, an execution condition of the application code, or an operation to be executed after execution of the application code is completed;
an identifier of the application code;
a start position of the application code; or
a length of the application code.

### Claim 11 (depends on 9)

The method of claim 9, wherein the application code is in a binary format.

### Claim 12

A hard disk comprising:
an interface configured to receive an application code from a server, wherein the application code carries a virtual machine identifier;
a storage configured to store the application code and data;
a hard disk medium configured to store the application code and the data; and
a processor coupled to the storage and configured to:
determine, according to the application code, whether to execute the application code in a virtual environment, wherein the virtual environment is for running the application code; and
execute, in the virtual environment, the application code to process the data in the hard disk medium when the application code is determined to be executed in the virtual environment.

### Claim 13 (depends on 12)

The hard disk of claim 12, wherein the processor is further configured to:
receive virtual data information; and
create the virtual environment according to the virtual data information, wherein the storage is further configured to store the virtual data information.

### Claim 14 (depends on 13)

The hard disk of claim 13, wherein the processor is further configured to:
receive an execution indication instructing whether to store the virtual data information; and
perform an operation on the virtual data information according to the execution indication, and
wherein the storage is further configured to store the execution indication of the virtual data information.

### Claim 15 (depends on 12)

The hard disk of claim 12, wherein the virtual environment is a virtual machine environment, and wherein the processor is further configured to determine, according to the virtual machine identifier, the virtual machine environment for processing the application code.

### Claim 16 (depends on 12)

The hard disk of claim 12, further comprising a memory, wherein the processor is further configured to:
create an application code process for the application code in the virtual environment;
load the application code into the memory, wherein the memory corresponds to the application code process; and
execute the application code process in the virtual environment.

### Claim 17 (depends on 12)

The hard disk of claim 12, wherein the processor is further configured to process the data according to an execution policy of the application code comprising at least one of a trigger condition for executing the application code, an execution condition of the application code, or an operation to be executed after execution of the application code is completed.

### Claim 18 (depends on 12)

The hard disk of claim 12, wherein the processor is further configured to execute the application code to execute virus scanning, integrity checking, compressing, and garbage collecting for the data.

### Claim 19

A hard disk comprising:
a data interface configured to receive an application code from a server;
a storage for storing the application code;
a hard disk medium configured to store data; and
a processor coupled to the storage and configured to:
create an application code process for the application code, wherein the application code process is a dynamic execution of a program and is a unit of allocating and scheduling resources by an operating system;
load the application code into a random-access memory (RAM); and
execute the application code process to process the data in the hard disk medium.

### Claim 20 (depends on 19)

The hard disk of claim 19, wherein the processor is further configured to process the data according to an execution policy of the application code, and wherein the execution policy comprises:
at least one of a trigger condition for executing the application code, an execution condition of the application code, or an operation to be completed after execution of the application code is completed;
an identifier of the application code;
a start position of the application code; or
a length of the application code.

### Claim 21 (depends on 19)

The hard disk of claim 19, wherein the application code is in a binary format.

### Claim 22 (depends on 19)

The hard disk of claim 19, wherein the processor is further configured to execute the application code to execute virus scanning, integrity checking, compressing, and garbage collecting for the data.
