System and method for implementing a multi-threaded device driver in a computer system
Abstract
A method of implementing a multi-threaded device driver for a computer system is disclosed. According to one embodiment, a polling device driver is partitioned into a plurality of driver threads for controlling a device of a computer system. The device has a first device state of an unscouted state and a scouted state, and a second device state of an inactive state and an active state. A driver thread of the plurality of driver threads determines that the first device state of the device state is in the unscouted state, and changes the first state of the device to the scouted state. The driver thread further determines that the second device state of the device is in the inactive state and changes the second device state of the device to the active state. The driver thread executes an operation on the device during a pre-determined time slot configured for the driver thread.
Claims
exact text as granted — not AI-modifiedWe claim:
1 . A method of partitioning a polling device driver into a plurality of driver threads for controlling a device of a computer system, the method comprising:
checking a first device state of the device, the first device state having an unscouted state and a scouted state; determining that the first device state of the device is in the unscouted state; changing the first state of the device to the scouted state; checking a second device state of the device, the second device state having an inactive state and an active state; determining that the second device state of the device is in the inactive state; changing the second state of the device to the active state; executing an operation on the device during a pre-determined time slot configured for a first driver thread of the plurality of driver threads; and changing the first state of the device to the unscouted state after the pre-determined time slot expires.
2 . The method of claim 1 , wherein the device is in one of four device states, wherein the four device states comprise an unscouted/inactive state, an unscouted/active state, a scouted/inactive state, and a scouted/active state.
3 . The method of claim 1 , further comprising:
continuing to execute the operation on the device until a second driver thread changes the device state to the scouted state; and changing the second state of the device to the inactive state.
4 . The method of claim 3 , wherein the device is in one of four device states, wherein the four device states comprise an unscouted/inactive state, an unscouted/active state, a scouted/inactive state, and a scouted/active state.
5 . The method of claim 4 , wherein the first driver thread monitors the second state of the device and changes the second state of the device to the inactive state after observing that the second state of the device changes to the scouted state.
6 . The method of claim 3 , wherein the first driver thread has an exclusive ownership of the device during the scouted/active state.
7 . The method of claim 6 , wherein the second driver thread changes the second state of the device to the active state and claims the exclusive ownership of the device after the first driver thread relinquishes the exclusive ownership of the device.
8 . The method of claim 1 , further comprising performing a post-processing task and changing the state of the driver thread to a sleep state.
9 . The method of claim 1 , wherein the pre-determined time slot is determined based on a system performance requirement or central processing unit (CPU) utilization.
10 . The method of claim 1 , further comprising dynamically controlling a number of maximum thread execution counts for each driver thread of the plurality of driver threads.
11 . The method of claim 10 , wherein the number of maximum thread execution counts is dynamically modified based on data traffic or a policy determined by a system administrator.
12 . The method of claim 1 , further comprising implementing a semaphore or a mutual exclusion, or an atomic exchange to ensure a single ownership of the device at a given time.
13 . The method of claim 1 , wherein the computer system comprises a plurality of core processors.
14 . The method of claim 1 , wherein the computer system is a multi-socket computer system, and wherein each socket of the multi-socket computer system comprises a plurality of multi-core processors.
15 . The method of claim 1 , wherein the device is a co-processor input/output (CPIO) device.
16 . The method of claim 13 , wherein the CPIO device comprises a non-volatile dual in-line memory module (NVDIMM).
17 . A computer system comprising:
a device; and a polling device driver partitioned into a plurality of driver threads for controlling the device, wherein the device has a first device state of an unscouted state and a scouted state, wherein the device has a second device state of an inactive state and an active state, wherein a first driver thread of the plurality of driver threads is configured to:
determine that the first device state of the device is in the unscouted state,
change the first state of the device to the scouted state;
determine that the second device state of the device is in the inactive state;
change the second state of the device to the active state; and
execute an operation on the device during a pre-determined time slot configured for a driver thread of the plurality of driver threads; and
changing the first state of the device to the unscouted state after the pre-determined time slot expires.
18 . The system of claim 17 , wherein the first driver thread is further configured to:
continue to execute the operation on the device until a second driver thread changes the device state to the scouted state; and change the second state of the device to the inactive state.
19 . The system of claim 17 , wherein a number of maximum thread execution counts for each driver thread of the plurality of driver threads is dynamically controlled.
20 . The system of claim 19 , wherein the number of maximum thread execution counts is dynamically modified based on data traffic or a policy determined by a system administrator.
21 . The system of claim 17 , wherein the computer system comprises a plurality of core processors.
22 . The system of claim 17 , wherein the computer system is a multi-socket computer system, and wherein each socket of the multi-socket computer system comprises a plurality of multi-core processors.
23 . The system of claim 17 , wherein the device is a CPIO device comprising an NVDIMM.
24 . A method of implementing a device driver for controlling a device of a computer system, the method comprising:
partitioning the device driver into a plurality of driver threads; monitoring a device status of the device and determining that the device has a task to perform; assigning a first driver thread of the plurality of driver threads to perform the task based on the device status; executing the task by the first driver thread for a pre-determined time slot configured for the first driver thread; and changing the device status to an inactive state after the pre-determined time slot expires.
25 . The method of claim 22 further comprising:
determining that the device has a second task to perform;
assigning a second driver thread of the plurality of driver threads to perform the second task based on the device status;
changing the device status to an active state;
executing the second task by the second driver thread for a second pre-determined time slot configured for the second driver thread; and
changing the device status to the inactive state after the second pre-determined time slot expires.
26 . The method of claim 24 , wherein the device is a co-processor input/output (CPIO) device comprising a non-volatile dual in-line memory module (NVDIMM).Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.