Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that obtains under the creative work prerequisite.
Fig. 1 is the process flow diagram of the embodiment of the invention one command handling method.As shown in Figure 1, present embodiment specifically comprises the steps:
Step 101, local user's interactive interface receive input command.
Local user's interactive interface is the interface between user and local operation system or the native processor, and its function mainly is the order that receives user's input, order is identified, and sent to local command processing unit or remote command processing unit.
Step 102, when input command is switching command, local user's interactive interface sends log on command to the remote operating system of switching command appointment or the remote command processing unit in the teleprocessing unit, makes the user sign in to the remote command processing unit.
Concrete, local user's interactive interface process can be identified input command, judges whether switching command, and switching command is the order to remote operating system or teleprocessing unit switching of user's input.If to judge input command be switching command, local user's interactive interface sends log on command to the remote command processing unit of switching command appointment, this log on command is the order that the user logins remote operating system or teleprocessing unit, makes the user sign in to the remote command processing unit.
In the present embodiment, when the input command that receives when local user's interactive interface was switching command, local user's interactive interface sent log on command to the remote command processing unit of switching command appointment, makes the user sign in to the remote command processing unit.This shows, command interaction is to be finished by local user's interactive interface in the present embodiment, can sign in to remote command processing unit in remote operating system or the teleprocessing unit by local user's interactive interface user, the method that provides according to present embodiment can realize in distributed system or polycaryon processor system that cross operating system uses and strides processor and use.
Fig. 2 is the process flow diagram of the embodiment of the invention two command handling methods.Present embodiment can be applied in distributed system or the polycaryon processor system.Distributed system comprises master control borad and one or more other plate (as business board or interface board etc.), and wherein master control borad is local system, and other plate is remote system.The polycaryon processor system comprises control module and other unit except control module such as one or more Service Processing Unit, interface processing unit, polycaryon processor can be asymmetric multiple processing (AsymmetricMulti-Processing, be called for short: AMP) framework or symmetrical multiple processing (SymmetricMulti-Processing, be called for short: SMP) framework, if AMP framework, then control module is native processor, other unit teleprocessing unit; If the SMP framework, any one unit can be native processor or teleprocessing unit, and it is inequality that the difference of native processor and teleprocessing unit is at least process number.
In the present embodiment, on function, SHELL is divided into user interactions interface and command process unit, as local SHELL, its local user's interactive interface not only is connected with the local command processing unit, also is connected with remote command processing unit among the long-range SHELL of remote system or teleprocessing unit.The interactive mode of local user's interactive interface and local command processing unit can adopt the mode of directly calling; The interactive mode of local user's interactive interface and remote command processing unit can realize by multiple flexible way, as adopt modes such as two layers of exchange or internuclear communication to communicate.
Before the method that the execution present embodiment provides, need to create local SHELL and long-range SHELL.Wherein the constructive process of local SHELL is: when os starting, create local user's interactive interface process and local command treatment progress, and the fileinfo and the local command processing unit that import the tape symbol table into identify (ID), the local command treatment progress obtains symbol table according to fileinfo, is mapped in the internal memory.The constructive process of long-range SHELL similarly, its difference is that long-range SHELL can not create long-distance user's interactive interface process.Like this, there is own unique sign each command process unit, this sign is according to the difference of system architecture and difference to some extent, and for example this sign can be CPU number and process number in the polycaryon processor system, and this sign can be plate number, CPU number and process number in distributed system.The file of above-mentioned tape symbol table can be specially to carry out and can link form (Executable and LinkingFormat is called for short: ELF) file, but present embodiment is not limited only to this.
As shown in Figure 2, present embodiment specifically comprises the steps:
Step 201, after signing in to local user's interactive interface, local user's interactive interface receives input command.
Concrete, after the user signed in to local user's interactive interface, local user's interactive interface was waited for user's input command, when the user import one be the input command of end mark with the carriage return after, local user's interactive interface receives this input command.
Step 202, local user's interactive interface process judge whether input command is switching command, if then execution in step 203; Otherwise execution in step 206.
Concrete, switching command is the order to remote system or teleprocessing unit switching of user's input.Local user's interactive interface process can be identified this input command, and whether judge is switching command.
Step 203, local user's interactive interface send log on command to the remote operating system of switching command appointment or the remote command processing unit in the teleprocessing unit.
Concrete, owing to carry the sign of remote command processing unit in this switching command, the corresponding remote command processing unit of this sign is the remote command processing unit of switching command appointment.Particularly, in distributed system, local user's interactive interface of master control borad is by the remote command processing unit transmission log on command of Ethernet interface to other plate; In the polycaryon processor system, local user's interactive interface of control module is by the remote command processing unit transmission log on command of internuclear communication mode to other unit.
After step 204, remote command processing unit receive log on command, return to local user's interactive interface and to receive the response, make the user namely sign in to the remote command processing unit, enter step 205.
Concrete, after the remote command processing unit receives log on command, can return to local user's interactive interface and receive the response.If when local user's interactive interface does not receive receiveing the response that the remote command processing unit returns in the given time, local user's interactive interface process output switch failure information, namely the user logins the failure of remote command processing unit.
Step 205, after signing in to the remote command processing unit, the subsequent commands by the remote command processing unit processes that local user's interactive interface will receive sends to the remote command processing unit, by the remote command treatment progress described subsequent commands is carried out respective handling;
After the user successfully signed in to the remote command processing unit, local user's interactive interface waited for that the user imports subsequent commands, when the user import one be the subsequent commands of end mark with the carriage return after, local user's interactive interface receives this subsequent commands.If this subsequent commands neither switching command neither exit command, and identify this order should be by above-mentioned remote command processing unit processes the time, then local user's interactive interface sends to the remote command processing unit with subsequent commands, by the remote command treatment progress described subsequent commands is carried out respective handling.
Particularly, in distributed system, local user's interactive interface of master control borad can be by the remote command processing unit transmission subsequent commands of Ethernet interface to other plate; In the polycaryon processor system, local user's interactive interface of control module can be by the remote command processing unit transmission subsequent commands of internuclear communication mode to other unit.
Further, can also comprise before step 205: local user's interactive interface is judged subsequent commands whether for exiting command, if, then withdraw from current command process process,
Concrete, that is to say, withdraw from the remote command treatment progress; Otherwise, execution in step 205.This exits command is the remote system that withdraws from current login imported of user or the order of teleprocessing unit.
Step 206, local user's interactive interface process judge that whether input command is for exiting command, if not then execution in step 207; Otherwise execution in step 208.
Whether exiting command of this step is the local system that withdraws from current login imported of user or the order of native processor, and local user's interactive interface process can be identified this input command, judge for exiting command.
Step 207, local user's interactive interface send input command to the local command processing unit, handle this input command by the local command treatment progress.
Step 208, withdraw from the current command treatment progress;
Concrete, if currently then withdraw from the local command treatment progress by the order of local command processing unit processes, if current by the order of remote command processing unit processes, then withdraw from the remote command treatment progress.
The step 206 of present embodiment also can be carried out before step 202, was when exiting command when judging input command, withdrawed from the local command treatment progress of current login, was not when exiting command when judging input command, execution in step 202.
Fig. 3 is the process flow diagram of being handled subsequent commands in the embodiment of the invention two command handling methods by the remote command treatment progress.As shown in Figure 3, further, handling subsequent commands by the remote command treatment progress in the step 205 can specifically comprise:
Step 301, remote command treatment progress carry out grammer or lexical analysis to subsequent commands, if correct, then execution in step 302; Otherwise, execution in step 303.
Step 302, remote command treatment progress are carried out subsequent commands, and the remote command processing unit returns execution result to local user's interactive interface.
The processing procedure of this step can be specially: the remote command treatment progress is searched the entry address of subsequent commands correspondence in the symbol table of remote system or teleprocessing unit, and wherein function brings into operation from the entry address; Adopt redirecting technique, the execution result that goes on a long journey function is returned to local user's interactive interface.
If occur unusually in the subsequent commands implementation, the remote command treatment progress then resets.
Step 303, remote command processing unit return grammer or morphology error message to local user's interactive interface.
It is similar to handle process and the process shown in Figure 3 of input command by the local command treatment progress in the step 207, does not repeat them here.
Need to prove that the method that present embodiment provides can use standard C language to realize, that is to say, can realize the function of SHELL in the present embodiment with standard C language.
In the present embodiment, the user interactions interface separates with the command process unit, also be that command interaction separates with command execution, solved prior art and in distributed system or polycaryon processor system, had only a main control unit and have only under the situation of a serial ports problem of the very difficult login of user.When the method that present embodiment is provided is applied to distributed system or polycaryon processor system, local system can be different operating system with remote system, native processor also can be different processors with teleprocessing unit, realized cross operating system and stride processor and use by mutual between local user's interactive interface and the remote command processing unit, thus realized a main control unit and other unit alternately.Present embodiment calls by using the function level, is very easy to the debugging of distributed system or polycaryon processor system.
In addition, because present embodiment can adopt standard C language to realize the function of SHELL, be not limited to the file layout of specific tape symbol table, also be not limited to communication mode concrete between user interactions interface and the command process unit, the correlation function of system can plug and play, thereby be not limited to concrete operating system, so improved the portability of code.
Fig. 4 is the structural representation of the embodiment of the invention one command processing device.Command processing device in the present embodiment can be specially the local user's interactive interface among the said method embodiment.As shown in Figure 4, present embodiment comprises receiver module 11 and first sending module 12.Wherein:
Receiver module 11 is used for receiving input command;
First sending module 12 is used for when input command is switching command, sends log on command to the remote operating system of switching command appointment or the remote command processing unit in the teleprocessing unit, makes the user sign in to the remote command processing unit.
Local user's interactive interface of present embodiment is the interface between user and local operation system or the native processor, receiver module 11 receives input command, by input command is identified, judge whether switching command, switching command is the order to remote operating system or teleprocessing unit switching of user's input.If to judge input command be switching command, by the remote command processing unit transmission log on command of first sending module 12 to the switching command appointment, this log on command is the order that the user logins remote operating system or teleprocessing unit, makes the user sign in to the remote command processing unit.
In the present embodiment, when the input command that receives when receiver module is switching command, first sending module sends log on command to the remote command processing unit of switching command appointment, make the user sign in to the remote command processing unit, because command interaction is to be finished by local user's interactive interface, can sign in to remote command processing unit in remote operating system or the teleprocessing unit by local user's interactive interface user, the device that present embodiment is provided is applied to distributed system or polycaryon processor system, can realize that cross operating system uses and stride the processor use.
Fig. 5 is the structural representation of the embodiment of the invention two command processing devices.As shown in Figure 5, on the basis of said apparatus embodiment one, present embodiment also comprises second sending module 13, this second sending module 13 is used for when input command neither switching command neither exit command the time, input command is sent to the local command processing unit, by the local command treatment progress input command is handled accordingly.
Concrete, after receiver module 11 receives input command, can identify input command, judge whether switching command or exit command (concrete deterministic process can referring to method embodiment two), if judge input command neither switching command neither exit command, second sending module 13 sends input command to the local command processing unit, by the local command treatment progress input command is handled accordingly.
Further, present embodiment can also comprise and withdraw from module 14, this withdraw from module 14 be used for when input command when exiting command, withdraw from the current command treatment progress.
Concrete, if currently then withdraw from the local command treatment progress by the order of local command processing unit processes, if current by the order of remote command processing unit processes, then withdraw from the remote command treatment progress.
The subsequent commands by the remote command processing unit processes that above-mentioned first sending module 12 can also be used for receiving sends to the remote command processing unit, by the remote command treatment progress subsequent commands is carried out respective handling.Concrete processing procedure can be referring to method embodiment two.
In the present embodiment, the user interactions interface separates with the command process unit, also be that command interaction separates with command execution, when the device that present embodiment is provided is applied to distributed system or polycaryon processor system, local system can be different operating system with remote system, realized the cross operating system use, native processor can be different processors with teleprocessing unit, has realized striding processor and has used.Present embodiment has realized that also the function level calls, and is very easy to the debugging of distributed system or polycaryon processor system.
Fig. 6 is the structural representation of embodiment of the invention command treatment system.As shown in Figure 6, present embodiment comprises command processing device (being local user's interactive interface) 21, remote command processing unit 22 and local command processing unit 23.
Wherein, the concrete structure of command processing device 21 can be referring to the description of device embodiment.
Remote command processing unit 22 is used for receiving the log on command that command processing device 21 sends, and makes the user sign in to remote command processing unit 22; And what receive command processing device 21 transmissions should carry out respective handling by the remote command treatment progress to subsequent commands by the subsequent commands of these remote command processing unit 22 processing.
Local command processing unit 23 is used for when input command input command being handled accordingly by the local command treatment progress neither switching command neither exit command the time, receives the input command of command processing device 21 transmissions.
Command interaction is to be finished by command processing device in the present embodiment, can sign in to remote command processing unit in remote operating system or the teleprocessing unit by the command processing device user, the system applies that present embodiment is provided is in distributed system or polycaryon processor system, can realize that cross operating system uses and strides processor and use.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be finished by the relevant hardware of programmed instruction, aforesaid program can be stored in the computer read/write memory medium, this program is when carrying out, execution comprises the step of said method embodiment, and aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
It should be noted that at last: above embodiment only in order to the technical scheme of the embodiment of the invention to be described, is not intended to limit; Although with reference to previous embodiment the embodiment of the invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment puts down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of each embodiment technical scheme of the embodiment of the invention.