# US 9,354,931 B1 · Method, server and computer-readable recording medium for managing size of thread pool dynamically

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

- Number: US 9,354,931 B1
- Document ID: US9354931B1
- Status: Granted
- Kind: B1
- Application number: 14/791,771
- Filed: 2015-07-06
- Granted: 2016-05-31
- Earliest claimed: 2015-05-14
- Assignees: Tmaxsoft Co., Ltd.
- Applicants: Tmaxsoft. Co., Ltd.
- Inventors: Kyoung Min Ryoo; Moon Namkoong; Kyung Koo Yoon
- Web page: https://patentgrep.com/patent/US9354931B1

## CPC

- G06F 9/5061: {Partitioning or combining of resources}
- G06F 2209/5011: Pool
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for managing a size of a thread pool dynamically is disclosed. The method includes the steps of: (a) a processor increasing a maximum thread size if the number of threads included in the thread pool is close to the maximum thread size; and (b) the processor comparing a size of a task queue before the increase of the maximum thread size with that after the increase thereof by referring to information on the size of the task queue, and increasing the maximum thread size again if the size of the task queue after the increase thereof is larger than, or equal to, that before the increase thereof.

## Claims

### Claim 1

A method for managing a size of a thread pool dynamically, comprising the steps of:
(a) a processor increasing a maximum thread size if the number of threads included in the thread pool is within a predetermined amount of the maximum thread size; and
(b) the processor comparing a size of a task queue before the increase of the maximum thread size with that after the increase thereof by referring to information on the size of the task queue, and increasing the maximum thread size again if the size of the task queue after the increase thereof is larger than, or equal to, that before the increase thereof;
(c) stopping increasing the maximum thread size if the size of the task queue is decreased after the step of (b) or the number of threads included in the thread pool fails to be within a predetermined amount from the maximum thread size calculated at the step of (b) even though the maximum thread size has been increased again at the step of (b),
wherein, at the step of (c), if the size of the task queue is decreased or the number of threads included in the thread pool fails to be within a predetermined amount from the maximum thread size calculated at the step of (b) after a prefixed time from the completion of the step of (b) even though the maximum thread size has been increased again at the step of (b), the increase of the maximum thread size is stopped.

### Claim 2 (depends on 1)

The method of claim 1, wherein the step of (a) includes the steps of:
(a1) the processor creating at least one new thread as much as an amount of increase in the maximum thread size and putting the created new thread in the thread pool; and
(a2) the processor acquiring at least one new task from the task queue and allocating the acquired new task to the created new thread.

### Claim 3 (depends on 1)

The method of claim 1, wherein, at the step of (b), even though the size of the task queue after the increase thereof is larger than, or equal to, that before the increase thereof, if the number of threads included in the thread pool is less than the maximum thread size, the processor stops increasing the maximum thread size of the thread pool.

### Claim 4 (depends on 1)

The method of claim 1, wherein, at the step of (a), if the number of threads included in the thread pool is equal to the maximum thread size, the processor increases the maximum thread size.

### Claim 5 (depends on 1)

The method of claim 1, wherein, at the step of (b), the processor refers to the size of the task queue without acquiring the lock.

### Claim 6 (depends on 1)

The method of claim 1, wherein an amount of increase in the maximum thread size at the step of (a) and that in the maximum thread size at the step of (b) are determined by referring to the number of cores of a CPU.

### Claim 7 (depends on 1)

The method of claim 1, wherein an amount of increase in the maximum thread size at the step of (a) and that in the maximum thread size at the step of (b) are differently set.

### Claim 8 (depends on 1)

The method of claim 1, wherein an amount of increase in the maximum thread size at the step of (b) is determined by referring to a degree of difference between the size of the task queue after the increase of the maximum thread size and that before the increase thereof.

### Claim 9 (depends on 1)

The method of claim 1, wherein, at the step of (a), the processor instructs a surveillance thread to increase the maximum thread size.

### Claim 10

A server for managing size of a thread pool dynamically, comprising:
a processor;
a communication part for acquiring a request for a task; and
a memory for storing information on a size of a task queue and information on a maximum thread size with respect to a thread pool;
wherein the processor (i) increases the maximum thread size if the number of threads included in the thread pool is within a predetermined amount of the maximum thread size and then stores it in the memory; and (ii) compares a size of the task queue before the increase of the maximum thread size with that after the increase thereof by referring to information on the size of the task queue, and increases the maximum thread size again and stores it in the memory, if the size of the task queue after the increase thereof is larger than, or equal to, that before the increase thereof;
wherein the processor stops increasing the maximum thread size if the size of the task queue is decreased or the number of threads included in the thread pool fails to be within a predetermined amount from the maximum thread size calculated even though the maximum thread size has been increased again at (ii); and
wherein, if the size of the task queue is decreased or the number of threads included in the thread pool fails to be within a predetermined amount from the maximum thread size at (ii) after a prefixed time from the completion of (ii) even though the maximum thread size has been increased again, the processor stops increasing the maximum thread size.

### Claim 11 (depends on 10)

The server of claim 10, wherein the processor creates at least one new thread as much as an amount of increase in the maximum thread size and puts the created new thread in the thread pool, and then acquires at least one new task from the task queue and allocates the acquired new task to the created new thread.

### Claim 12 (depends on 10)

The server of claim 10, wherein, at (ii), even though the size of the task queue after the increase thereof is larger than, or equal to, that before the increase thereof, if the number of threads included in the thread pool is less than the maximum thread size, the processor stops increasing the maximum thread size of the thread pool.

### Claim 13 (depends on 10)

The server of claim 10, wherein, if the number of threads included in the thread pool is equal to the maximum thread size, the processor increases the maximum thread size and then stores it in the memory.

### Claim 14 (depends on 10)

The server of claim 10, wherein the processor refers to the size of the task queue without acquiring the lock.

### Claim 15 (depends on 10)

The server of claim 10, wherein an amount of increase in the maximum thread size at (i) and that in the maximum thread size at (ii) are determined by referring to the number of cores of a CPU.

### Claim 16 (depends on 10)

The server of claim 10, wherein am amount of increase in the maximum thread size at (i) and that in the maximum thread size at (ii) are differently set.

### Claim 17 (depends on 10)

The server of claim 10, wherein an amount of increase in the maximum thread size at (ii) is determined by referring to a degree of difference between the size of the task queue after the increase of the maximum thread size and that before the increase thereof.

### Claim 18 (depends on 10)

The server of claim 10, wherein the processor instructs a surveillance thread to increase the maximum thread size and store it in the memory.
