# US 2011/0239225 A1 · Apparatus and method for adaptive context switching scheduling scheme for fast block input and output

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

- Number: US 2011/0239225 A1
- Document ID: US20110239225A1
- Status: Published application
- Kind: A1
- Application number: 13/112,671
- Filed: 2011-05-20
- Published: 2011-09-29
- Earliest claimed: 2008-11-26
- Assignees: Iucf-Hyu (Industry-University Cooperation Foundation Hanyang University)
- Inventors: Youjip Won
- Web page: https://patentgrep.com/patent/US20110239225A1

## CPC

- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 13/12: using hardware independent of the central processor, e.g. channel or peripheral processor
- G06F 13/20: for access to input/output bus
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

Provided is a method and apparatus for an adaptive context switching for a fast block input/output. The adaptive context switching method may include: requesting, by a process, an input/output device to perform an input/output of data; comparing a Central Processing Unit (CPU) effectiveness based on whether the context switching is performed; and performing the input/output through the context switching to a driver context of the input/output device, or directly performing, by the process, the input/output based on a comparison result of the CPU effectiveness.

## Claims

### Claim 1

A method for an adaptive context switching, the method comprising:
requesting, by a process, an input/output device to perform an input/output of data;
comparing a Central Processing Unit (CPU) effectiveness based on whether the context switching is performed; and
performing the input/output through the context switching to a driver context of the input/output device, or directly performing, by the process, the input/output based on a comparison result of the CPU effectiveness.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
determining whether the input/output device corresponds to a fast block device,
wherein, when the input/output device corresponds to the fast block device, the comparing through the performing of the input/output is performed.

### Claim 3 (depends on 1)

The method of claim 1, wherein the comparing comprises comparing the CPU effectiveness according to a first input/output operation where the process having requested the input/output directly performs the input/output, and the CPU effectiveness according to a second input/output operation where the input/output is performed through the context switching to the driver context of the input/output device.

### Claim 4 (depends on 3)

The method of claim 3, wherein the performing of the input/output comprises performing the first input/output operation when the CPU effectiveness according to the first input/output operation is greater than the CPU effectiveness according to the second input/output operation, and performing the second input/output operation when the CPU effectiveness according to the second input/output operation is greater than the CPU effectiveness according to the first input/output operation.

### Claim 5 (depends on 3)

The method of claim 3, wherein, in the first input/output operation, the process having requested the input/output directly performs the input/output until the input/output is completed.

### Claim 6 (depends on 1)

The method of claim 1, wherein the comparing comprises calculating and comparing the CPU effectiveness based on an amount of time used for the input/output, and an amount of time used for allocating a CPU to the process and thereby processing the calculation.

### Claim 7 (depends on 1)

The method of claim 1, further comprising:
verifying whether the input/output device uses a Direct Memory Access (DMA).

### Claim 8 (depends on 7)

The method of claim 7, wherein the comparing comprises calculating an amount of time a CPU is allocated to the process and processing of the calculation, using a sum of an amount of response standby time until an interrupt is received from the input/output device, and an amount of time allocated to the driver context of the input/output device, when the input/output device performs the context switching without using the DMA.

### Claim 9 (depends on 7)

The method of claim 7, wherein the comparing comprises calculating an amount of time a CPU is allocated to the process and processing of the calculation, using an amount of time allocated to the driver context of the input/output device, when the input/output device neither uses the DMA nor performs the context switching.

### Claim 10 (depends on 7)

The method of claim 7, wherein the comparing comprises calculating an amount of time the CPU is allocated to the process and processing of the calculation, using a twice of an amount of time allocated to the driver context of the input/output device and an amount of response standby time until an interrupt is received from the input/output device, when the input/output device performs the context switching using the DMA.

### Claim 11 (depends on 7)

The method of claim 7, wherein the comparing comprises calculating an amount of time a CPU is allocated to the process and processing of the calculation, using an amount of time allocated to the driver context of the input/output device, when the input/output device uses the DMA and does not perform the context switching.

### Claim 12 (depends on 1)

The method of claim 1, wherein the performing of the input/output comprises:
determining whether a request in a response standby state exists in a queue of the input/output device; and
performing the input/output through the context switching to the driver context of the input/output device when the request exists.

### Claim 13

An apparatus for an adaptive context switching, the apparatus comprising:
an input/output request unit to request, by a process, an input/output device to perform an input/output of data;
a CPU effectiveness comparison unit to compare a CPU effectiveness based on whether the context switching is performed; and
an input/output performing unit to perform the input/output through the context switching to a driver context of the input/output device, or directly performing, by the process, the input/output based on a comparison result of the CPU effectiveness.

### Claim 14 (depends on 13)

The apparatus of claim 13, further comprising:
a DMA utilization verifying unit to verify whether the input/output device uses a DMA,
wherein the CPU effectiveness comparison unit comprises:
a CPU effectiveness calculation unit to calculate the CPU effectiveness according to a first input/output operation where the process having requested the input/output directly performs the input/output, and the CPU effectiveness according to a second input/output operation where the input/output is performed through the context switching to the driver context of the input/output device; and
an effectiveness comparison unit to compare the CPU effectiveness according to the first input/output operation with the CPU effectiveness according to the second input/output operation.

### Claim 15 (depends on 14)

The apparatus of claim 14, wherein the CPU effectiveness calculation unit comprises:
a first CPU effectiveness calculation unit to calculate the CPU effectiveness according to the first input/output operation and the CPU effectiveness according to the second input/output operation, when the input/output device does not use the DMA; and
a second CPU effectiveness calculation unit to calculate the CPU effectiveness according to the first input/output operation and the CPU effectiveness according to the second input/output operation, when the input/output device uses the DMA.

### Claim 16 (depends on 15)

The apparatus of claim 15, wherein the first CPU effectiveness calculation unit and the second CPU effectiveness calculation unit calculate the CPU effectiveness based on an amount of time used for the input/output, and an amount of time a CPU is allocated to the process and processing of the calculation.

### Claim 17 (depends on 16)

The apparatus of claim 16, wherein:
when the context switching is performed, the first CPU effectiveness calculation unit calculates the amount of time the CPU is allocated to the process and processing of the calculation, using a sum of an amount of response standby time until an interrupt is received from the input/output device, and an amount of time allocated to the driver context of the input/output device, and
when the context switching is not performed, the first CPU effectiveness calculation unit calculates the amount of time the CPU is allocated to the process and processing of the calculation, using the amount of time allocated to the driver context of the input/output device.

### Claim 18 (depends on 16)

The apparatus of claim 16, wherein:
when the context switching is performed, the second CPU effectiveness calculation unit calculates the amount of time the CPU is allocated to the process and processing of the calculation, using twice of an amount of time allocated to the driver context of the input/output device and an amount of response standby time until an interrupt is received from the input/output device, and
when the context switching is not performed, the second CPU effectiveness calculation unit calculates the amount of time the CPU is allocated to the process and processing of the calculation, using the amount of time allocated to the driver context of the input/output device.

### Claim 19 (depends on 13)

The apparatus of claim 13, further comprising:
a fast block device decision unit to determine whether the input/output device corresponds to a fast block device.

### Claim 20 (depends on 13)

The apparatus of claim 13, wherein:
the input/output performing unit comprises:
a response standby decision unit to determine whether a request in a response standby state exists in a queue of the input/output device; and
when the request exists, the input/output performing unit performs the input/output through the context switching to the driver context of the input/output device.
