A KVM switch based on many-to-many control and control method thereof

By introducing many-to-many control design in the KVM switch, automatically matching the keyboard and mouse with the host and server, the problems of high management costs and inconvenient operation of traditional KVM switches are solved, and efficient and automatic device management is achieved.

CN117687701BActive Publication Date: 2025-03-28GUANGDONG MT-VIKI ELECTRONICS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410013990.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-03
Publication Date
2025-03-28
Estimated Expiration
2044-01-03

AI Technical Summary

Technical Problem

When managing multiple controlled computers, traditional KVM switches need to connect multiple sets of keys and rats, resulting in high management costs and difficult to control.

Method used

A KVM switcher based on many-to-many control is designed, including a keyboard and mouse management module, multiple groups of host management modules, matching condition setting module and control switching module. By setting matching relationships and matching conditions, the keyboard and mouse are automatically matched with the host and server.

Benefits of technology

It realizes automatic matching between multiple sets of keyboard and mouse and multiple hosts, reducing management costs, improving operational efficiency, and avoiding the need for artificial switching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117687701B_ABST
    Figure CN117687701B_ABST
Patent Text Reader

Abstract

The present invention discloses a KVM switch based on many-to-many control and a control method thereof, wherein the KVM switch comprises: a keyboard and mouse management module for managing multiple groups of keyboards and mice; a multiple group host management module for managing multiple groups of hosts and servers; a matching condition setting module for setting matching conditions and matching relationships between multiple groups of keyboards and mice and multiple groups of hosts and servers, and matching each group of keyboards and mice with one or more groups of hosts and servers; and a control switching module for automatically matching the corresponding keyboard and mouse to the control of each group of hosts and servers through matching conditions and matching relationships. This solution sets the matching relationship and matching conditions between the keyboard and mouse and the host, automatically matches the corresponding host and server for the keyboard and mouse through the matching relationship and matching conditions, or automatically matches the corresponding keyboard and mouse for the host and server, without the need for manual switching, and without the need for additional button switching, and directly realizes the mutual matching between multiple sets of keyboards and mice and multiple groups of hosts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of KVM switches, and in particular to a KVM switch based on many-to-many control and a control method thereof. Background Art

[0002] KVM (Keyboard Video Mouse) technology can support one or more users to manage multiple remote controlled computers connected to the KVM system at the same time, and realize the function of simultaneously accessing and operating multiple controlled computers with a set of keyboard, display, and mouse devices, so as to improve the utilization rate of computer group equipment, improve the stability, security and reliability of the computer group, and improve the work efficiency of computer group managers.

[0003] Traditional matrix switchers generally use one set of keyboard and mouse to control multiple access devices. Controlling multiple access devices requires connecting multiple sets of keyboard and mouse, which increases management costs and makes management difficult. Summary of the invention

[0004] The present invention provides a KVM switch based on many-to-many control and a control method thereof to solve the above problems existing in the prior art.

[0005] The present invention provides a KVM switch based on many-to-many control, comprising:

[0006] Keyboard and mouse management module, used to manage multiple groups of keyboards and mice;

[0007] Multiple host management modules are used to manage multiple groups of hosts and servers;

[0008] A matching condition setting module is used to set matching conditions and matching relationships between multiple sets of keyboards and mice and multiple sets of hosts and servers, and match each set of keyboards and mice with one or more sets of hosts and servers;

[0009] The control switching module is used to automatically match the corresponding keyboard and mouse for the control of each group of hosts and servers through matching conditions and matching relationships.

[0010] Preferably, the keyboard and mouse management module includes:

[0011] A keyboard and mouse characteristic classification unit is used to classify all keyboards and mice according to their characteristics;

[0012] The keyboard and mouse numbering unit is used to number all the keyboards and mice in different categories according to their categories. Each category has the same category number. In the same category, an intra-category number is set and the keyboards and mice are sorted in the order of the intra-category numbers.

[0013] The first storage unit is used to form a keyboard and mouse number by combining the class numbers and the intra-class numbers of all keyboards and mice for storage.

[0014] Preferably, the multiple groups of host management modules include:

[0015] A matrix arrangement unit is used to arrange hosts and servers in a matrix manner to form a host matrix;

[0016] A host numbering unit, used for numbering a host matrix formed by hosts and servers in a matrix manner to form a host number;

[0017] The second storage unit is used to store the host numbers corresponding to all hosts and servers.

[0018] Preferably, the matching condition setting module includes:

[0019] A condition setting unit, used to set a matching condition between each set of keyboard and mouse and each set of host and server, wherein the matching condition is that after the matching value between the keyboard and mouse characteristics and the host and server characteristics exceeds a set threshold, the two are considered to be matched;

[0020] The matching relationship establishing unit is used to establish a matching relationship between a group of keyboards and mice and at least one group of hosts and servers according to matching conditions, and the control efficiency between the keyboards and mice and the hosts and servers having matching relationships is greater than or equal to a set efficiency threshold.

[0021] Preferably, the control switching module includes:

[0022] A first detection unit, used to automatically detect the current keyboard and mouse matching relationship and matching conditions;

[0023] The keyboard and mouse automatic switching unit is used to automatically determine all hosts and servers that match the current keyboard and mouse according to the matching relationship and matching conditions of the current keyboard and mouse;

[0024] A second detection unit, used for automatically detecting the matching relationship and matching conditions of the current host;

[0025] The host automatic switching unit is used to automatically determine a set of keyboard and mouse that matches the current host according to the matching relationship and matching conditions of the current host.

[0026] Preferably, it also includes a multi-task communication and synchronization module, which is used for cooperation, coordination and information exchange between multiple tasks when multiple tasks are switched; the multi-task communication and synchronization module includes: a mutex variable unit, a counting semaphore unit, an event flag group unit and a message queue unit.

[0027] Preferably, the mutually exclusive variable unit includes:

[0028] The mutex variable creation subunit is used to create a mutex variable, find an available control block in the array, and initialize the control block as a mutex variable control block; check whether the control parameter is TRUE. If it is TRUE, the task that creates the mutex variable will obtain the mutex variable and set the control variable in the mutex variable control block to 0, indicating that the mutex variable has been occupied; if the control parameter is not TRUE, set the control variable in the mutex variable control block to 1, indicating that the mutex variable can be applied for by other tasks; return the subscript of the mutex variable in the array;

[0029] The mutex variable application subunit is used for tasks to obtain control of mutex variables by applying for them; set the timeout time. If the mutex variable is already occupied by other tasks and the current task cannot successfully apply for it, if the value is 0, the current task will wait until the mutex variable is available, otherwise a timer will be created with the timeout time as a parameter and wait for n clock cycles of the timeout time;

[0030] Release the mutex variable subunit, which is used to release the mutex variable for use by other tasks when a task has finished using it. The release operation will reduce the reference count by 1. If the count becomes 0, the mutex variable is obtained by other tasks in the suspended queue so that the task can continue to run.

[0031] The mutex variable subunit is deleted to resume all tasks that are suspended due to waiting for the mutex variable, and then the data member in its control block is set to TRUE to invalidate the mutex variable control block and recycle the control block.

[0032] Preferably, the counting semaphore unit comprises:

[0033] Creating a counting semaphore quantum unit for searching an unused counting semaphore control block in the second array; initializing the counting semaphore control block, setting a data member to FALSE to indicate that the counting semaphore control block has been used, and setting a data member count parameter to TYPE_SEMAPHORE to indicate that the control block is used for counting semaphores;

[0034] The semaphore application unit is used to apply for semaphores. When a task cannot obtain a semaphore temporarily and does not need to wait until a semaphore is available, a timer is used for time management so that the task can be activated when the timeout time set for the task arrives.

[0035] Release semaphore quantum unit, used to release the occupied semaphore after the task completes access to the semaphore resource; after the semaphore is released, its current value will increase by 1; if the current value of the semaphore before release is 0, the first task in the suspended queue waiting on the semaphore will be awakened after the semaphore is released, and the semaphore will be occupied by the task;

[0036] The semaphore deletion unit is used to complete the operation of deleting the counting semaphore.

[0037] Preferably, the event flag group unit includes:

[0038] Creating an event flag group subunit for assigning values ​​to each member of the event flag group control block pointed to by the event flag group;

[0039] The flag in the waiting group is set subunit, which is used to identify events using a 32-bit unsigned integer. Each bit of the integer represents an event. A task can wait for up to 32 events at the same time. If the specified event flag is set, the service is satisfied;

[0040] The event flag group setting subunit is used to reset the value of the event flag group when one or more events occur, and to set or reset one or more flags in the group;

[0041] The event flag group deletion subunit is used to delete the event flag group when it is no longer used.

[0042] The present invention provides a control method of a KVM switch based on many-to-many control, comprising: using the KVM switch based on many-to-many control, performing the following steps:

[0043] S100, determining a group of keyboards and mice corresponding to the host and the server according to the matching relationship and matching conditions;

[0044] S200, using the determined keyboard and mouse to control the corresponding host and server;

[0045] S300, when switching to another group of hosts and servers, determining whether the current keyboard and mouse are in a matching relationship with the group of hosts and servers, and if so, continuing to use the keyboard and mouse to control the host and server;

[0046] S400: If there is no matching relationship, then the corresponding keyboard and mouse are matched for the other group of hosts and servers to be switched according to the matching relationship and the matching condition, and the matched keyboard and mouse are used to control the other group of hosts and servers.

[0047] Compared with the prior art, the present invention has the following advantages:

[0048] The present invention provides a KVM switch based on many-to-many control and a control method thereof, wherein the KVM switch comprises: a keyboard and mouse management module for managing multiple groups of keyboards and mice; a multiple group host management module for managing multiple groups of hosts and servers; a matching condition setting module for setting matching conditions and matching relationships between multiple groups of keyboards and mice and multiple groups of hosts and servers, and matching each group of keyboards and mice with one or more groups of hosts and servers; and a control switching module for automatically matching the corresponding keyboard and mouse to the control of each group of hosts and servers through matching conditions and matching relationships. This scheme manages the keyboard and mouse and the host respectively by setting two management modules to facilitate setting the matching relationship and matching conditions between the two, thereby automatically matching the corresponding host and server for the keyboard and mouse through the matching relationship and matching conditions, or automatically matching the corresponding keyboard and mouse for the host and server, without manual switching, only by setting the matching relationship and matching conditions in advance, when controlling a certain host and server, only by checking the matching relationship and matching conditions of the host, judging whether the current keyboard and mouse are matched, or directly selecting an appropriate set of keyboards and mice through the matching relationship and matching conditions, and controlling through the selected set of keyboards and mice. There is no need to use additional button switching, and multiple sets of keyboards and mice can be used in conjunction with multiple host computers.

[0049] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings.

[0050] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:

[0052] Figure 1 Schematic diagram of the structure of a KVM switch based on many-to-many control in an embodiment of the present invention;

[0053] Figure 2 This is a schematic diagram of the structure of a control switching module in an embodiment of the present invention;

[0054] Figure 3 The present invention is a flowchart of a method for controlling a KVM switch based on many-to-many control. DETAILED DESCRIPTION

[0055] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0056] The embodiment of the present invention provides a KVM switch based on many-to-many control, please refer to Figure 1 , the KVM switch based on many-to-many control includes:

[0057] Keyboard and mouse management module, used to manage multiple groups of keyboards and mice;

[0058] Multiple host management modules are used to manage multiple groups of hosts and servers;

[0059] A matching condition setting module is used to set matching conditions and matching relationships between multiple sets of keyboards and mice and multiple sets of hosts and servers, and match each set of keyboards and mice with one or more sets of hosts and servers;

[0060] The control switching module is used to automatically match the corresponding keyboard and mouse for the control of each group of hosts and servers through matching conditions and matching relationships.

[0061] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is a keyboard and mouse management module for managing multiple groups of keyboards and mice; multiple groups of host management modules for managing multiple groups of hosts and servers; a matching condition setting module for setting matching conditions and matching relationships between multiple groups of keyboards and mice and multiple groups of hosts and servers, and matching each group of keyboards and mice with one or more groups of hosts and servers; a control switching module for automatically matching the corresponding keyboard and mouse to the control of each group of hosts and servers through matching conditions and matching relationships. This embodiment manages the keyboard and mouse and the host respectively by setting two management modules to facilitate setting the matching relationship and matching conditions between the two, so as to automatically match the corresponding host and server for the keyboard and mouse through the matching relationship and matching conditions, or automatically match the corresponding keyboard and mouse for the host and server, without manual switching, only by setting the matching relationship and matching conditions in advance, when controlling a certain host and server, only by checking the matching relationship and matching conditions of the host, judging whether the current keyboard and mouse are matched, or directly selecting an appropriate set of keyboards and mice through the matching relationship and matching conditions, and controlling through the selected set of keyboards and mice. There is no need to use additional button switching, and multiple sets of keyboards and mice can be used in conjunction with multiple host computers.

[0062] In another embodiment, the keyboard and mouse management module includes:

[0063] A keyboard and mouse characteristic classification unit is used to classify all keyboards and mice according to their characteristics;

[0064] The keyboard and mouse numbering unit is used to number all the keyboards and mice in different categories according to their categories. Each category has the same category number. In the same category, an intra-category number is set and the keyboards and mice are sorted in the order of the intra-category numbers.

[0065] The first storage unit is used to form a keyboard and mouse number by combining the class numbers and the intra-class numbers of all keyboards and mice for storage.

[0066] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the keyboard and mouse management module includes: a keyboard and mouse characteristic classification unit, which is used to classify all keyboards and mice according to the keyboard and mouse characteristics; a keyboard and mouse numbering unit, which is used to number all classified keyboards and mice according to the classification, each category has the same category number, and the category number is set in the same category, and sorted according to the order of the category number; a first storage unit is used to form a keyboard and mouse number from the category number and the category number of all keyboards and mice for storage. The solution provided by this embodiment ensures that the keyboard and mouse characteristic classification is more matched with the host on the one hand, and on the other hand, it is more convenient to set the matching conditions and matching relationships through the category number and the category number.

[0067] In another embodiment, the plurality of groups of host management modules include:

[0068] A matrix arrangement unit is used to arrange hosts and servers in a matrix manner to form a host matrix;

[0069] A host numbering unit, used for numbering a host matrix formed by hosts and servers in a matrix manner to form a host number;

[0070] The second storage unit is used to store the host numbers corresponding to all hosts and servers.

[0071] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the multiple host management modules include: a matrix arrangement unit, which is used to arrange the host and the server in a matrix manner to form a host matrix; a host numbering unit, which is used to number the host matrix formed by the host and the server in a matrix manner to form a host number; and a second storage unit, which is used to store the host numbers corresponding to all hosts and servers. Arranging and numbering in a matrix manner makes it easier to set matching conditions and matching relationships.

[0072] In another embodiment, the matching condition setting module includes:

[0073] A condition setting unit, used to set a matching condition between each set of keyboard and mouse and each set of host and server, wherein the matching condition is that after the matching value between the keyboard and mouse characteristics and the host and server characteristics exceeds a set threshold, the two are considered to be matched;

[0074] The matching relationship establishing unit is used to establish a matching relationship between a group of keyboards and mice and at least one group of hosts and servers according to matching conditions, and the control efficiency between the keyboards and mice and the hosts and servers having matching relationships is greater than or equal to a set efficiency threshold.

[0075] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the matching condition setting module includes: a condition setting unit, which is used to set the matching conditions between each group of keyboard and mouse and each group of host and server, and the matching condition is that after the matching value between the characteristics of the keyboard and mouse and the characteristics of the host and server exceeds the set threshold, the two are considered to be matched; a matching relationship establishment unit, which is used to establish a matching relationship between a group of keyboard and mouse and at least one group of host and server according to the matching condition, and the control efficiency between the keyboard and mouse with the matching relationship and the host and server is greater than or equal to the set efficiency threshold. Setting the matching relationship and matching conditions can facilitate the automatic matching of the corresponding host through the keyboard and mouse, and the automatic matching of the corresponding keyboard and mouse according to the host.

[0076] In another embodiment, please refer to Figure 2 , the control switching module includes:

[0077] A first detection unit, used to automatically detect the current keyboard and mouse matching relationship and matching conditions;

[0078] The keyboard and mouse automatic switching unit is used to automatically determine all hosts and servers that match the current keyboard and mouse according to the matching relationship and matching conditions of the current keyboard and mouse;

[0079] A second detection unit, used for automatically detecting the matching relationship and matching conditions of the current host;

[0080] The host automatic switching unit is used to automatically determine a set of keyboard and mouse that matches the current host according to the matching relationship and matching conditions of the current host.

[0081] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the control switching module includes: a first detection unit, which is used to automatically detect the matching relationship and matching conditions of the current keyboard and mouse; a keyboard and mouse automatic switching unit, which is used to automatically determine all hosts and servers that match the current keyboard and mouse according to the matching relationship and matching conditions of the current keyboard and mouse; a second detection unit, which is used to automatically detect the matching relationship and matching conditions of the current host; a host automatic switching unit, which is used to automatically determine a group of keyboards and mice that match the current host according to the matching relationship and matching conditions of the current host. The solution provided in this embodiment is used to automatically achieve the matching between the keyboard and mouse and the host.

[0082] In another embodiment, it also includes a multi-task communication and synchronization module, which is used for cooperation, coordination and information exchange between multiple tasks when multiple tasks are switched; the multi-task communication and synchronization module includes: a mutex variable unit, a counting semaphore unit, an event flag group unit and a message queue unit.

[0083] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment also includes a multi-task communication and synchronization module, which is used to cooperate, coordinate and exchange information between multiple tasks when switching between multiple tasks; the multi-task communication and synchronization module includes: a mutually exclusive variable unit, a counting semaphore unit, an event flag group unit and a message queue unit.

[0084] The function of the KVM switch is accomplished through many tasks and interrupt service routines. Tasks and interrupt service routines must coordinate actions, cooperate with each other or exchange information, which involves communication and synchronization issues between tasks. Communication and synchronization mechanism is one of the most important functions provided by the KVM system for applications.

[0085] The inter-task communication mechanism is a way for tasks in a multi-task real-time system to share and exchange information. The communication mechanism of the KVM system must be robust, that is, it must be able to effectively prevent data loss between tasks.

[0086] When two or more tasks in a KVM switch system need to access the same resource, they need to be in a certain order to ensure that the resource can only be used by one task at a time. That is to say, the two cooperating tasks need to coordinate their work at certain points. When one task reaches this point, unless the other task has completed certain operations, it has to stop and wait for the completion of these operations. There is a direct constraint relationship between the two tasks, and this is when the synchronization function of the KVM system needs to be used.

[0087] The scheme provided by this embodiment can realize the close relationship between the communication mechanism and the task communication and task scheduling mechanism, which usually need to cooperate with each other to complete their respective functions. When designing and implementing the communication and synchronization mechanism, the real-time and reliability of the embedded real-time operating system must be guaranteed.

[0088] In another embodiment, the mutually exclusive variable unit includes:

[0089] The mutex variable creation subunit is used to create a mutex variable, find an available control block in the array, and initialize the control block as a mutex variable control block; check whether the control parameter is TRUE. If it is TRUE, the task that creates the mutex variable will obtain the mutex variable and set the control variable in the mutex variable control block to 0, indicating that the mutex variable has been occupied; if the control parameter is not TRUE, set the control variable in the mutex variable control block to 1, indicating that the mutex variable can be applied for by other tasks; return the subscript of the mutex variable in the array;

[0090] The mutex variable application subunit is used for tasks to obtain control of mutex variables by applying for them; set the timeout time. If the mutex variable is already occupied by other tasks and the current task cannot successfully apply for it, if the value is 0, the current task will wait until the mutex variable is available, otherwise a timer will be created with the timeout time as a parameter and wait for n clock cycles of the timeout time;

[0091] Release the mutex variable subunit, which is used to release the mutex variable for use by other tasks when a task has finished using it. The release operation will reduce the reference count by 1. If the count becomes 0, the mutex variable is obtained by other tasks in the suspended queue so that the task can continue to run.

[0092] The mutex variable subunit is deleted to resume all tasks that are suspended due to waiting for the mutex variable, and then the data member in its control block is set to TRUE to invalidate the mutex variable control block and recycle the control block.

[0093] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the mutually exclusive variable unit includes:

[0094] The mutex variable creation subunit is used to create a mutex variable, search for an available control block in the array, and initialize the control block as a mutex variable control block; check whether the control parameter is TRUE. If it is TRUE, the task that creates the mutex variable will obtain the mutex variable and set the control variable in the mutex variable control block to 0, indicating that the mutex variable has been occupied; if the control parameter is not TRUE, set the control variable in the mutex variable control block to 1, indicating that the mutex variable can be applied for by other tasks; return the subscript of the mutex variable in the array; apply for a mutex variable subunit, which is used for a task to obtain control of a mutex variable by applying for a mutex variable; set a timeout period, which will be used when the mutex variable has been occupied by other tasks Yes, if the current task cannot successfully apply, if the value is 0, the current task will wait until the mutex variable is available, otherwise a timer will be created with the timeout as a parameter, waiting for n timeout clock cycles; release mutex subunit, used when a task has finished using the mutex variable, it should be released for other tasks to use; the release operation will reduce the reference count by 1, if the count value becomes 0, the mutex variable will be obtained by other tasks in the suspended queue, so that the task can continue to run; delete mutex subunit, used to restore all tasks suspended due to waiting for the mutex variable, and then set the data member in its control block to TRUE, make the mutex variable control block invalid, and recycle the control block. To use shared resources, a task must first apply for a mutex variable, and then access the shared resource, and then release the mutex variable after access. Before the task releases the mutex variable, other tasks that apply to use the shared resource can only wait.

[0095] In another embodiment, the counting semaphore unit comprises:

[0096] Creating a counting semaphore quantum unit for searching an unused counting semaphore control block in the second array; initializing the counting semaphore control block, setting a data member to FALSE to indicate that the counting semaphore control block has been used, and setting a data member count parameter to TYPE_SEMAPHORE to indicate that the control block is used for counting semaphores;

[0097] The semaphore application unit is used to apply for semaphores. When a task cannot obtain a semaphore temporarily and does not need to wait until a semaphore is available, a timer is used for time management so that the task can be activated when the timeout time set for the task arrives.

[0098] Release semaphore quantum unit, used to release the occupied semaphore after the task completes access to the semaphore resource; after the semaphore is released, its current value will increase by 1; if the current value of the semaphore before release is 0, the first task in the suspended queue waiting on the semaphore will be awakened after the semaphore is released, and the semaphore will be occupied by the task;

[0099] The semaphore deletion unit is used to complete the operation of deleting the counting semaphore.

[0100] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the counting semaphore unit includes: creating a counting semaphore quantum unit, which is used to find an unused counting semaphore control block in the second array; initializing the counting semaphore control block, setting the data member to FALSE to indicate that the counting semaphore control block has been used, and setting the data member counting parameter to TYPE_SEMAPHORE to indicate that the control block is used for counting semaphores; applying for a semaphore quantum unit, which is used to use a timer for time management when a task temporarily cannot obtain a semaphore and does not need to wait until a semaphore is available when applying for a semaphore, so as to activate the task when the timeout time set by the task arrives; releasing a semaphore quantum unit, which is used to release the occupied semaphore after the task completes the access to the semaphore resource; after the semaphore is released, its current value will increase by 1; if the current value of the semaphore before the release is 0, the first task in the suspended queue waiting on the semaphore will be awakened after the semaphore is released, and the semaphore will be occupied by the task; deleting a semaphore quantum unit, which is used to complete the operation of deleting the counting semaphore. If a task needs to use one of the shared resources, it must obtain a semaphore, otherwise it can only wait. After the task has used up the shared resource, it needs to release the semaphore so that other tasks can apply for it.

[0101] In another embodiment, the event flag group unit includes:

[0102] Creating an event flag group subunit for assigning values ​​to each member of the event flag group control block pointed to by the event flag group;

[0103] The flag in the waiting group is set subunit, which is used to identify events using a 32-bit unsigned integer. Each bit of the integer represents an event. A task can wait for up to 32 events at the same time. If the specified event flag is set, the service is satisfied;

[0104] The event flag group setting subunit is used to reset the value of the event flag group when one or more events occur, and to set or reset one or more flags in the group;

[0105] The event flag group deletion subunit is used to delete the event flag group when it is no longer used.

[0106] The working principle and beneficial effects of the above technical solution are as follows: the scheme adopted in this embodiment is that the event flag group unit includes: creating an event flag group subunit, which is used to assign values ​​to each member of the event flag group control block pointed to by the event flag group; a flag setting subunit in the waiting group, which is used to use a 32-bit unsigned integer to identify an event, each bit of which represents an event, and a task can wait for up to 32 events at the same time. If the specified event flag is set, the service is satisfied; setting the event flag group subunit, which is used to reset the value of the event flag group when one or more events occur, and set or reset one or more flags in the group; deleting the event flag group subunit, which is used to delete the event flag group when it is no longer used. When the flag in the task waiting group is set, the function will check whether the event flag group at this time meets the task requirements according to the task's setting of the get option. If it meets the requirements, some subsequent processing can be done to let the task continue to run. If it does not meet the requirements, the task will be suspended. When the task sets the event flag group, if it is set in a bitwise "and" manner, it will return directly after completing the setting operation. Otherwise, after setting the event flag group, the suspended queue will be traversed, all tasks in the queue that meet the conditions will be resumed, and finally a task switching operation will be performed so that the task scheduling has been resumed and the highest priority task will run.

[0107] In another embodiment, the message queue unit includes:

[0108] Create a message queue subunit, which is used to create a message queue and assign values ​​to each member of the message queue control block, where the total number of messages can be calculated from the specified message size and the total number of bytes in the queue;

[0109] The message sending subunit is used to send a message to a specified message queue, and copy the message from the memory space specified by the source pointer to the end of the message queue being sent;

[0110] The message receiving subunit is used to receive a message from a message queue and update the corresponding member variables of the message queue.

[0111] The working principle and beneficial effects of the above technical solution are as follows: the solution adopted in this embodiment is that the message queue unit includes: a message queue creation subunit, which is used to create a message queue and assign values ​​to each member of the message queue control block, wherein the total number of messages can be calculated from the specified message size and the total number of bytes of the queue; a message sending subunit, which is used to send a message to the specified message queue and copy the message from the memory space specified by the source pointer to the tail of the message queue being sent; a message receiving subunit, which is used to receive a message from a message queue and update the corresponding member variables of the message queue. The message queue first requires a storage area to store messages. A data member can be designed in the message queue to indicate the starting address of the message queue. The address can be located anywhere in the target address space and is specified when the message queue is created. The task can obtain the message from the head of the message queue. When the task sends a message to the message queue, the message will be saved at the tail of the message queue. When the message queue is empty, that is, there is no message in it, the task receiving the message from the message queue will also be suspended, and the length of the message is determined. This value can be represented by the data member.

[0112] In another embodiment, this embodiment also provides a control method of a KVM switch based on many-to-many control, please refer to Figure 3 The control method includes: using a KVM switch based on many-to-many control, performing the following steps:

[0113] S100, determining a group of keyboards and mice corresponding to the host and the server according to the matching relationship and matching conditions;

[0114] S200, using the determined keyboard and mouse to control the corresponding host and server;

[0115] S300, when switching to another group of hosts and servers, determining whether the current keyboard and mouse are in a matching relationship with the group of hosts and servers, and if so, continuing to use the keyboard and mouse to control the host and server;

[0116] S400: If there is no matching relationship, then the corresponding keyboard and mouse are matched for the other group of hosts and servers to be switched according to the matching relationship and the matching condition, and the matched keyboard and mouse are used to control the other group of hosts and servers.

[0117] The working principle and beneficial effects of the above technical scheme are as follows: the scheme adopted in this embodiment is that the control method includes: adopting a KVM switch based on many-to-many control, and executing the following steps: determining the keyboard and mouse corresponding to a group of hosts and servers according to the matching relationship and matching conditions; using the determined keyboard and mouse to control the corresponding hosts and servers; when switching another group of hosts and servers, judging whether the current keyboard and mouse are in a matching relationship with the group of hosts and servers, if they are a matching relationship, continuing to use the keyboard and mouse to control the hosts and servers; if they are not a matching relationship, matching the corresponding keyboard and mouse for the other group of hosts and servers to be switched according to the matching relationship and matching conditions, and using the matched keyboard and mouse to control the other group of hosts and servers. This embodiment manages the keyboard and mouse and the host respectively by setting two management modules to facilitate the setting of the matching relationship and matching conditions between the two, so as to automatically match the keyboard and mouse with the corresponding host and server through the matching relationship and matching conditions, or automatically match the corresponding keyboard and mouse with the host and server, without manual switching. It only needs to set the matching relationship and matching conditions in advance. When controlling a certain host and server, it only needs to check the matching relationship and matching conditions of the host to determine whether the current keyboard and mouse are matched, or directly select an appropriate set of keyboard and mouse through the matching relationship and matching conditions, and control through the selected set of keyboard and mouse. There is no need to use an additional button switching method, and the mutual matching between multiple sets of keyboards and mice and multiple groups of hosts can be directly realized.

[0118] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.

Claims

1. A KVM switch based on many-to-many control, characterized in that: include: Keyboard and mouse management module, used to manage multiple groups of keyboards and mice; Multiple host management modules are used to manage multiple groups of hosts and servers; A matching condition setting module is used to set matching conditions and matching relationships between multiple sets of keyboards and mice and multiple sets of hosts and servers, and match each set of keyboards and mice with one or more sets of hosts and servers; The control switching module is used to automatically match the corresponding keyboard and mouse for the control of each group of hosts and servers through matching conditions and matching relationships; It also includes a multi-task communication and synchronization module, which is used for cooperation, coordination and information exchange between multiple tasks when multiple tasks are switched; the multi-task communication and synchronization module includes: a mutex variable unit, a counting semaphore unit, an event flag group unit and a message queue unit; The mutually exclusive variable unit comprises: The mutex variable creation subunit is used to create a mutex variable, find an available control block in the array, and initialize the control block as a mutex variable control block; check whether the control parameter is TRUE. If it is TRUE, the task that creates the mutex variable will obtain the mutex variable and set the control variable in the mutex variable control block to 0, indicating that the mutex variable has been occupied; if the control parameter is not TRUE, set the control variable in the mutex variable control block to 1, indicating that the mutex variable can be applied for by other tasks; return the subscript of the mutex variable in the array; The mutex variable application subunit is used for tasks to obtain control of mutex variables by applying for them; set the timeout time. If the mutex variable is already occupied by other tasks and the current task cannot successfully apply for it, if the timeout time value is 0, the current task will wait until the mutex variable is available, otherwise a timer will be created with the timeout time as a parameter and wait for n timeout time clock cycles; Release the mutex variable subunit, which is used to release the mutex variable for use by other tasks when a task has finished using it. The release operation will reduce the reference count by 1. If the count becomes 0, the mutex variable is obtained by other tasks in the suspended queue so that the task can continue to run. Deleting the mutex variable subunit is used to resume all tasks that are suspended due to waiting for the mutex variable, and then setting the data member in its control block to TRUE to invalidate the mutex variable control block and reclaim the control block; The counting semaphore unit comprises: Creating a counting semaphore quantum unit for searching an unused counting semaphore control block in the second array; initializing the counting semaphore control block, setting a data member to FALSE to indicate that the counting semaphore control block has been used, and setting a data member count parameter to TYPE_SEMAPHORE to indicate that the counting semaphore control block is used for counting semaphores; The semaphore application unit is used to apply for semaphores. When a task cannot obtain a semaphore temporarily and does not need to wait until a semaphore is available, a timer is used for time management so that the task can be activated when the timeout time set for the task arrives. Release semaphore quantum unit, used to release the occupied semaphore after the task completes access to the semaphore resource; after the semaphore is released, its current value will increase by 1; if the current value of the semaphore before release is 0, the first task in the suspended queue waiting on the semaphore will be awakened after the semaphore is released, and the semaphore will be occupied by the task; Deleting the signal quantum unit, used to complete the operation of deleting the counting semaphore; The event flag group unit comprises: Creating an event flag group subunit for assigning values ​​to each member of the event flag group control block pointed to by the event flag group; The flag in the waiting group is set subunit, which is used to identify events using a 32-bit unsigned integer. Each bit of the integer represents an event. A task can wait for up to 32 events at the same time. If the specified event flag is set, the service is satisfied; The event flag group setting subunit is used to reset the value of the event flag group when one or more events occur, and to set or reset one or more flags in the group; The event flag group deletion subunit is used to delete the event flag group when it is no longer used.

2. A KVM switch based on many-to-many control according to claim 1, characterized in that: The keyboard and mouse management module includes: A keyboard and mouse characteristic classification unit is used to classify all keyboards and mice according to their characteristics; The keyboard and mouse numbering unit is used to number all the keyboards and mice in different categories according to their categories. Each category has the same category number. In the same category, an intra-category number is set and the keyboards and mice are sorted in the order of the intra-category numbers. The first storage unit is used to form a keyboard and mouse number by combining the class numbers and the intra-class numbers of all keyboards and mice for storage.

3. The KVM switch based on many-to-many control according to claim 1, characterized in that: The multiple groups of host management modules include: A matrix arrangement unit is used to arrange hosts and servers in a matrix manner to form a host matrix; A host numbering unit, used for numbering a host matrix formed by hosts and servers in a matrix manner to form a host number; The second storage unit is used to store the host numbers corresponding to all hosts and servers.

4. The KVM switch based on many-to-many control according to claim 1, characterized in that: The matching condition setting module includes: A condition setting unit, used to set a matching condition between each set of keyboard and mouse and each set of host and server, wherein the matching condition is that after the matching value between the keyboard and mouse characteristics and the host and server characteristics exceeds a set threshold, the two are considered to be matched; The matching relationship establishing unit is used to establish a matching relationship between a group of keyboards and mice and at least one group of hosts and servers according to matching conditions, and the control efficiency between the keyboards and mice and the hosts and servers having matching relationships is greater than or equal to a set efficiency threshold.

5. The KVM switch based on many-to-many control according to claim 1, characterized in that: The control switching module includes: A first detection unit, used to automatically detect the current keyboard and mouse matching relationship and matching conditions; The keyboard and mouse automatic switching unit is used to automatically determine all hosts and servers that match the current keyboard and mouse according to the matching relationship and matching conditions of the current keyboard and mouse; A second detection unit, used for automatically detecting the matching relationship and matching conditions of the current host; The host automatic switching unit is used to automatically determine a set of keyboard and mouse that matches the current host according to the matching relationship and matching conditions of the current host.

6. A control method for a KVM switch based on many-to-many control, characterized in that: include: Using the KVM switch based on many-to-many control as described in any one of claims 1 to 5, perform the following steps: S100, determining a group of keyboards and mice corresponding to the host and the server according to the matching relationship and matching conditions; S200, using the determined keyboard and mouse to control the corresponding host and server; S300, when switching to another group of hosts and servers, determining whether the current keyboard and mouse are in a matching relationship with the group of hosts and servers, and if so, continuing to use the keyboard and mouse to control the host and server; S400: If there is no matching relationship, then the corresponding keyboard and mouse are matched for the other group of hosts and servers to be switched according to the matching relationship and the matching condition, and the matched keyboard and mouse are used to control the other group of hosts and servers.

Citation Information

Patent Citations

  • Computer switch and method thereof for matching with multiple servers

    CN101453356A

  • Hardware real-time operation system

    CN103412755A

  • USB switching device and method capable of achieving many-to-many switching control

    CN111930658A