CN103246591B - The method and apparatus of signal transacting - Google Patents
The method and apparatus of signal transacting Download PDFInfo
- Publication number
- CN103246591B CN103246591B CN201310150277.8A CN201310150277A CN103246591B CN 103246591 B CN103246591 B CN 103246591B CN 201310150277 A CN201310150277 A CN 201310150277A CN 103246591 B CN103246591 B CN 103246591B
- Authority
- CN
- China
- Prior art keywords
- thread
- space
- signal
- stack
- storage space
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 186
- 230000008569 process Effects 0.000 claims abstract description 139
- 238000012545 processing Methods 0.000 claims description 25
- 238000012544 monitoring process Methods 0.000 description 24
- 230000006870 function Effects 0.000 description 17
- 238000010586 diagram Methods 0.000 description 7
- 230000002159 abnormal effect Effects 0.000 description 4
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000000977 initiatory effect Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000008878 coupling Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011084 recovery Methods 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000035800 maturation Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000013139 quantization Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Landscapes
- Storage Device Security (AREA)
Abstract
The embodiment of the present invention provides a kind of method and apparatus of signal transacting, can guarantee the carrying out of signal transacting.The method comprises: determine that the first memory size required for operational objective thread and this subject thread carry out the second memory size required for signal transacting; According to this first memory size and this second memory size, create thread stack, wherein, this thread stack comprises threads store space and signal storage space, this threads store space is used for the process variable that this subject thread of storage running produces, the size in this threads store space is more than or equal to this first memory size, and this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size; When this subject thread carries out this signal transacting, in this signal storage space, access the process variable that this signal transacting produces.
Description
Technical field
The present invention relates to computer realm, and more specifically, relate to the method and apparatus of signal transacting.
Background technology
At present, in computer systems, which, thread needs to carry out signal transacting, such as, when carrying out fault handling, can create a monitoring process and carry out heartbeat monitor to business process (specifically, being the main thread of this business process), the business process cycle sends heartbeat message to monitoring process, when heartbeat is lost, monitoring process will restart business process, or, send signal to business process and notify that it exits and restarts this business process; Again such as, a monitoring thread is started to the central processing unit (CPU of all threads of this process in business process, CentralProcessingUnit) occupancy is monitored, and when CPU usage exceedes default threshold value, monitoring thread sends signal to business processing thread; Again such as, business process by the mode that signal is taken over monitor occur that CPU is abnormal time the signal that sends of the kernel signal, the monitoring process that send and the signal that sends of CPU usage monitoring thread; By processing above-mentioned signal, the data structure snapshot etc. of fault type, current register information, call stack information, thread stack contents, related service can be obtained, these information are recorded in dying words, carry out software fault location by these information.
When carrying out above-mentioned signal transacting, need to open up the process variable of signal stack for producing in stores processor process.
In a kind of prior art, as shown in Figure 1, acquiescence opens up signal stack in the current location of thread stack, namely, when thread receives signal and carries out signal transacting to this signal, system directly opens up signal stack from current thread stack location, there is a page guard space (also referred to as page guard interval) in the stack top due to thread stack, this space cannot be write as data, CPU will be triggered abnormal when thread stack space uses and crosses the border, such as, when thread stack space use cross the border or critical cross the border time, the signal stack opened up will be positioned at a page guard space, because this guard space can not be written into data, it is abnormal that signal transacting will cause CPU, signal transacting is caused to carry out.
In another kind of prior art, for thread specifies one piece of independently signal stack from heap memory, thread stack and signal stack can be separated.But, due to signal stack may with this heap memory in adjacent for the space storing data, when data write-overflow, cause signal stack to be stepped on, cause signal transacting to carry out.
Summary of the invention
The embodiment of the present invention provides a kind of method of signal transacting, device and equipment, can guarantee the carrying out of signal transacting.
First aspect, provide a kind of method of signal transacting, it is characterized in that, the method comprises: determine that the first memory size required for operational objective thread and this subject thread carry out the second memory size required for signal transacting; According to this first memory size and this second memory size, create thread stack, wherein, this thread stack comprises threads store space and signal storage space, this threads store space is used for the process variable that this subject thread of storage running produces, the size in this threads store space is more than or equal to this first memory size, and this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size; When this subject thread carries out this signal transacting, in this signal storage space, access the process variable that this signal transacting produces.
In conjunction with first aspect, in the first implementation of first aspect, this signal transacting comprises: the process of the fault-signal produced when breaking down to this subject thread; And be somebody's turn to do the process variable that access this signal transacting and produce in this signal storage space, comprising: in this signal storage space, access the process variable produced when this subject thread processes this fault-signal.
In conjunction with first aspect and above-mentioned implementation thereof, in the second implementation of first aspect, in this thread stack of establishment, the start address in this threads store space is identical with the start address of this thread stack.
In conjunction with first aspect and above-mentioned implementation thereof, in the third implementation of first aspect, it is the first read-only or not read-write insulating space that this thread stack also comprises attribute, and this first insulating space is between this threads store space and this signal storage space.
In conjunction with first aspect and above-mentioned implementation thereof, in the 4th kind of implementation of first aspect, it is the second read-only or not read-write insulating space that this thread stack also comprises attribute, this the second insulating space is positioned at the stack top of this thread stack, and this second insulating space not with this threads store space or this signal storage space overlap.
Second aspect, provide a kind of device of signal transacting, this device comprises: capacity determining unit, for determining the first memory size of operational objective thread and carrying out the second memory size of the signal transacting corresponding with the operation of this subject thread; Thread stack creating unit, for this first memory size of determining according to this capacity determining unit and this second memory size, create this thread stack, wherein, this thread stack comprises threads store space and signal storage space, this threads store space is used for the process variable that this subject thread of storage running produces, the size in this threads store space is more than or equal to this first memory size, this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size; Processing unit, for when this subject thread carries out this signal transacting, accesses the process variable that this signal transacting produces in this signal storage space that this thread stack creating unit creates.
In conjunction with second aspect, in the first implementation of second aspect, this signal transacting comprises: the process of the fault-signal produced when breaking down to this subject thread; And this processing unit is specifically for accessing the process variable produced when this subject thread processes this fault-signal in this signal storage space of creating in this thread stack creating unit.
In conjunction with second aspect and above-mentioned implementation thereof, in the second implementation of second aspect, in this thread stack that this thread stack creating unit creates, the start address in this threads store space is identical with the start address of this thread stack.
In conjunction with second aspect and above-mentioned implementation thereof, in the third implementation of second aspect, it is the first read-only or not read-write insulating space that this thread stack that this thread stack creating unit creates also comprises attribute, and this first insulating space is between this threads store space and this signal storage space.
In conjunction with second aspect and above-mentioned implementation thereof, in the 4th kind of implementation of second aspect, it is the second read-only or not read-write insulating space that this thread stack that this thread stack creating unit creates also comprises attribute, this the second insulating space is positioned at the stack top of this thread stack, and this second insulating space not with this threads store space or this signal storage space overlap.
The third aspect, provides a kind of equipment of signal transacting, and this equipment comprises: bus; The processor be connected with this bus; The storer be connected with this bus; Wherein, this processor, by this bus, calls the program stored in this storer, carries out the second memory size required for signal transacting for the first memory size determined required for operational objective thread and this subject thread; For according to this first memory size and this second memory size, create thread stack, wherein, this thread stack comprises threads store space and signal storage space, this threads store space is used for the process variable that this subject thread of storage running produces, the size in this threads store space is more than or equal to this first memory size, and this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size; For when this subject thread carries out this signal transacting, in this signal storage space, access the process variable that this signal transacting produces.
In conjunction with the third aspect, in the first implementation of the third aspect, this signal transacting comprises: the process of the fault-signal produced when breaking down to this subject thread; And this processor specifically for accessing the process variable produced when this subject thread processes this fault-signal in this signal storage space.
In conjunction with the third aspect and above-mentioned implementation thereof, in the second implementation of the third aspect, in this thread stack that this processor creates, the start address in this threads store space is identical with the start address of this thread stack.
In conjunction with the third aspect and above-mentioned implementation thereof, in the third implementation of the third aspect, it is the first read-only or not read-write insulating space that this thread stack that this processor creates also comprises attribute, and this first insulating space is between this threads store space and this signal storage space.
In conjunction with the third aspect and above-mentioned implementation thereof, in the 4th kind of implementation of the third aspect, it is the second read-only or not read-write insulating space that this thread stack that this processor creates also comprises attribute, this the second insulating space is positioned at the stack top of this thread stack, and this second insulating space not with this threads store space or this signal storage space overlap.
According to the method for the signal transacting of the embodiment of the present invention, device and equipment, by the subject thread run as required and the signal transacting needing to carry out, determine thread stack, this thread stack is made to comprise the threads store space of the process variable for storing this subject thread and the signal storage space for the process variable that stores this signal transacting, make the size in this threads store space be more than or equal to this thread run required for internal memory, the size in this signal storage space is made to be more than or equal to internal memory required for this signal transacting, the storage space of the process variable for storage signal process can be guaranteed, thus carry out of thread to signal transacting can be guaranteed.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme of the embodiment of the present invention, be briefly described to the accompanying drawing used required in the embodiment of the present invention below, apparently, accompanying drawing described is below only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the schematic diagram of the configuration representing signal stack in prior art.
Fig. 2 is the indicative flowchart of the method for signal transacting according to the embodiment of the present invention.
Fig. 3 is the schematic diagram of the configuration representing embodiment of the present invention thread stack.
Fig. 4 represents the creation method of embodiment of the present invention thread stack and the indicative flowchart of using method.
Fig. 5 is the schematic block diagram of the device of signal transacting according to the embodiment of the present invention.
Fig. 6 is the schematic diagram of the equipment of signal transacting according to the embodiment of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Technical scheme of the present invention, may operate in and comprise such as, CPU, Memory Management Unit (MMU, on the hardware device of MemoryManagementUnit), internal memory (also referred to as storer), the operating system that this hardware device runs can be the various computer operating systems being realized (comprising multiple thread) business processing by thread or process, such as, linux system, Unux system etc.
Fig. 2 shows the indicative flowchart of the method 100 according to the signal transacting of the embodiment of the present invention.The subject of implementation of method 100 of the present invention can be CPU, can be also MMU, or worked in coordination with by CPU and MMU, the present invention is also not particularly limited, below, for the ease of understanding and explanation, when not specified, for the execution of MMU, method 100 of the present invention is described.As shown in Figure 1, the method 100 comprises:
S110, determines that the first memory size required for operational objective thread and this subject thread carry out the second memory size required for signal transacting;
S120, according to this first memory size and this second memory size, create thread stack, wherein, this thread stack comprises threads store space and signal storage space, and this threads store space is used for the process variable that this subject thread of storage running produces, and the size in this threads store space is more than or equal to this first memory size, this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size;
S130, when this subject thread carries out this signal transacting, accesses the process variable that this signal transacting produces in this signal storage space.
Specifically, at S110, the subject thread that MMU can run as required, determine this subject thread (specifically, store the process variable that produces because running this thread) required for memory size (the first memory size), and, in embodiments of the present invention, determine that the method for this first memory size can be similar to prior art, such as, the function that can realize according to the needs of the regulation of operating system or this subject thread or the business corresponding with this subject thread, determine this first memory size.Here, it should be noted that, this subject thread can realize a business or function independently, and also can jointly complete a business or function with other threads, the present invention is also not particularly limited.Further, the method for determination first memory size more than enumerated is only exemplary illustration, and the present invention is not defined in this, and the method for other memory sizes can determined needed for thread all falls within the scope of protection of the present invention.
In embodiments of the present invention, this subject thread is the thread needing to carry out the signal such as from system kernel, CUP or other threads signal transacting.
Optionally, this signal transacting comprises: the process of the fault-signal produced when breaking down to this subject thread; And
The process variable that this signal transacting produces should be accessed in this signal storage space, comprising:
The process variable produced when this subject thread processes this fault-signal is accessed in this signal storage space.
Specifically, this signal transacting can be the process to the signal for fault collection.
Such as, the software systems such as wild pointer, memory write-overflow defect (BUG) may cause business thread to occur, and CPU is abnormal, to this, system kernel sends signal to this business thread, business thread receives this signal, carry out information acquisition in the signal processing, after having recorded the information of collection, business thread restarts.
Or, system can create a monitoring process and carry out heartbeat monitor to business process (comprising one or more thread), the business process cycle sends heartbeat message to monitoring process, if monitoring process finds that business process heartbeat is lost, then monitoring process sends signal to business process, and business process receives this signal, carry out information acquisition in the signal processing, after having recorded the information of collection, business process has exited, and is responsible for business process to restart by monitoring process.
Again such as, loop control variable is made mistakes, state machine process mistake, the software systems BUG such as signal quantization deadlock cause business processing thread to occur, and execution be exited or be stagnated to endless loop cannot, business processing thread is caused to carry out regular traffic process, to this, system can create a monitoring process and carry out heartbeat monitor to business process, the business process cycle sends heartbeat message to monitoring process, if monitoring process is processing this signal, and find that business process heartbeat is lost, then monitoring process sends signal to business process, business process receives this signal, carry out information acquisition in the signal processing, after having recorded the information of collection, business process exits, be responsible for business process to restart by monitoring process.。
Again such as, the software systems BUG such as the message storm of the unreasonable initiation of business processing Mechanism Design cause a business processing thread to take a large amount of CPU to carry out business processing working time, thus cause other business processing thread to carry out regular traffic process, to this, business process can start all business threads of a monitoring thread to this business process and carry out CPU usage monitoring, if the CPU usage of a business thread will exceed setting threshold value, then monitoring thread sends signal to business processing thread, business process receives this signal, carry out information acquisition in the signal processing, after having recorded the information of collection, business process exits, be responsible for business process to restart by monitoring process.
Business process (in other words, the main thread of business process, namely, one example of subject thread) mode of being taken over by signal monitors signal that above-mentioned kernel sends, monitoring process sends signal and the signal that CPU usage monitoring thread sends, and by carrying out signal transacting to above-mentioned signal, obtain the data structure snapshot etc. of fault type, current register information, call stack information, thread stack contents, related service, these information are recorded in dying words, carry out software fault location by these information.
When carrying out above-mentioned signal transacting, need in internal memory, store the process variable produced in this signal transacting.
Therefore, the internal memory (the second memory size) required for this signal transacting (being specifically, store the process variable produced in this signal transacting) can also be determined at S110, MMU.Further, in embodiments of the present invention, determine that the method for this second memory size can be similar to prior art, here, in order to avoid repeating, the description thereof will be omitted.
At S120, MMU can according to the first memory size determined as mentioned above and the second memory size, from memory headroom (specifically, in stack memory headroom) be this subject thread establishment thread stack, above-mentioned first memory size and the second memory size sum is more than or equal to make the created thread stack size of thread stack (specifically, be).
And, in embodiments of the present invention, the thread stack created can comprise A(threads store space, space) and space B (signal storage space), this space A is used for the process variable that storage running subject thread produces, this space A(specifically, is the size of space A) be more than or equal to this first memory size, this space B is for storing the process variable of carrying out this signal transacting and producing, this space B size of space B (specifically, be) is more than or equal to this second memory size.
Alternatively, in embodiments of the present invention, in this thread stack created, the start address in this threads store space is identical with the start address of this thread stack.
Specifically, in embodiments of the present invention, this space A(can be made in internal memory) start address identical with the start address of this thread stack (in internal memory), accordingly, the start address that the start address of this space B (in internal memory) equals this thread stack (in internal memory) adds the length (the first memory size) of space A.That is, in embodiments of the present invention, this space A can be positioned at the stack bottom side of thread stack, and space B can be positioned at the stack top side of thread stack.Here, it should be noted that, " stack bottom side " and " stack top side " position in the thread stack direction of growth should be referred to.
By making the start address in threads store space identical with the start address of this thread stack, thus when storing the process variable that subject thread produces, the method can continuing to use prior art stores, thus can improve the applicability of the method for signal transacting of the present invention.
Should understand, the threads store space more than enumerated and the position relationship in signal storage space are only exemplary illustration, the present invention is not limited thereto, such as, also the start address in signal storage space can be made identical with the start address of thread stack, in the case, can the start address of internal memory of notification target threads store process variable, such as, the start address in this threads store space is relative to the skew (corresponding with the size in signal storage space) of the start address of this thread stack.Thus make subject thread according to the start address in this threads store space, storing process variable.
Alternatively, in embodiments of the present invention, it is the first read-only or not read-write insulating space that this thread stack created also comprises attribute, and this first insulating space is between this threads store space and this signal storage space.
Specifically, such as, when there is the inefficacy of recursive call control variable, use super large local variable in software systems, storage overflow may be there is (namely in this space A, the process variable that should be stored in the subject thread of space A takes up room B), cause signal transacting cannot be performed by exception throw, software fault information cannot gather.To this; in embodiments of the present invention; page guard space C(first insulating space can be set between space A and space B); the attribute of this page of guard space C can be read-only or not read-write; thus, when the size of process variable of the subject thread that should be stored in space A exceedes the size of space A, the exception throw because page guard space C is not read-write; thus there will not be the occupied situation of space B, and then the carrying out of signal transacting can be guaranteed.It should be noted that, in embodiments of the present invention, the size of this first insulating space C can set arbitrarily, such as, can arrange according to the regulation of operating system, such as, in linux system, can be 4KBytes(kilobyte).Further, in embodiments of the present invention, this page of guard space C is positioned on the A of space under space B, not overlapping with this space B or space A.
Optionally, in embodiments of the present invention, it is the second read-only or not read-write insulating space that this thread stack created also comprises attribute, and this second insulating space is positioned at the stack top of this thread stack, and this second insulating space not with this threads store space or this signal storage space overlap.
Specifically, such as, when the process variable that signal transacting produces exceedes the second memory size determined as mentioned above, possible initiating system fault, therefore, can arrange page guard space D(second insulating space in this thread stack top).The attribute of this page of guard space D can be read-only or not read-write; thus; when the size of process variable of the signal transacting that should be stored in space B exceedes the size of space B, the exception throw because page guard space D is not read-write, thus can not initiating system fault.It should be noted that, in embodiments of the present invention, the size of this second insulating space D can set arbitrarily, such as, can arrange according to the regulation of operating system, such as, in linux system, can be 4KBytes(kilobyte).Further, in embodiments of the present invention, this page of guard space D is positioned on space B, not overlapping with this space B.
Should be understood that this page of guard space D is positioned on the A of space, not overlapping with this space A when space A is positioned at space B supreme (that is, space A is positioned at stack top side).
Fig. 3 shows the schematic diagram of the thread stack of configuration as mentioned above.As shown in Figure 3, the thread stack created according to the method for the signal transacting of the embodiment of the present invention comprises space A for storing the process variable that subject thread produces, produce for storage signal process the space B (being positioned at the top of the direction of growth along stack of space A) of process variable, the attribute between space A and space B are read-only or not read-write protection page C and the attribute being positioned at stack top (being positioned at the top of the direction of growth along stack of space B) is read-only or not read-write protection page D.
At S130, MMU when running this subject thread to realize business processing, according to the start address of space A and size, the process variable that this subject thread produces can be stored in this space A.Further, when carrying out signal transacting, according to the start address of space B and size, the process variable that this signal transacting produces can be stored in this space B.
Fig. 4 shows the creation method of thread stack and the indicative flowchart of using method of the embodiment of the present invention.As shown in Figure 4, at S201, such as, MMU can according to the first memory size that will determine as mentioned above, the second memory size and the first insulating space sum, as the size of the thread stack of actual allocated.
Can the record object thread thread entrance function of specifying at S202, MMU, using a general purpose function as the entrance function of subject thread, to create thread stack.
Threads store space (space A) start address of subject thread can be obtained at S203, MMU.
Thread stack start address can be added the start address of result of calculation as the signal storage space (space B) of subject thread of the first memory size (or, the size of the first memory size and the first insulating space) at S204, MMU.Here, it should be noted that, because the heap space of the system that is stored in of the business datum of subject thread carries out, therefore ensure that signal storage space can not be occupied at the storage overflow of business datum.MMU can use, and such as, the thread signal stack that linux system provides arranges function sigaltstack and the start address of space B is set in subject thread.
Optionally; can use at S205, MMU, such as; what linux system provided arranges the function mprotect of internal storage access authority by protection page space C(first insulating space between space B and space A) be set to read only attribute or can not read-write properties; carry out the isolated area of signal stack and thread stack, with when the read-write for space A is crossed the border, guard space B is not destroyed; now; because space A is separated with space B, even if subject thread breaks down, signal transacting still can normally perform.
At S206, the subject thread entrance function that invoke user is specified, to carry out the read-write of process variable (comprising the process variable of subject thread stack generation and the process variable of signal transacting generation).
At S207, the subject thread entrance function that user specifies is finished, and exits thread execution, and system kernel will the thread stack of the automatic recovery subject thread; It is the part of thread stack that subject thread is distributed that space B due to subject thread belongs to system kernel, and therefore space B also can by the automatic recovery, thus, without the need to creating monitoring thread Monitor thread monitor subject thread and discharging its signal storage space.
Should understand; creation method and the process of the thread stack more than enumerated are only exemplary illustration; the present invention is not limited thereto; such as; when the size of the thread stack of the determination actual allocated of S201; also can not calculate the first insulating space, or above-mentioned protection page space D(second insulating space can also be calculated).The process of other steps is similar, and here, in order to avoid repeating, the description thereof will be omitted.
According to the method for the signal transacting of the embodiment of the present invention, by the subject thread run as required and the signal transacting needing to carry out, determine thread stack, this thread stack is made to comprise the threads store space of the process variable for storing this subject thread and the signal storage space for the process variable that stores this signal transacting, make the size in this threads store space be more than or equal to this thread run required for internal memory, the size in this signal storage space is made to be more than or equal to internal memory required for this signal transacting, the storage space of the process variable for storage signal process can be guaranteed, thus carry out of thread to signal transacting can be guaranteed.
Here, it should be noted that, in embodiments of the present invention, also space A and space B can not be distinguished when creating thread stack, and according to the start address of thread stack and the first memory size, the process variable that read-write subject thread produces, and when needs carry out signal transacting, from thread stack, according to the second memory size opening space B, according to start address and second memory size of space B, the process variable that read-write process produces.
Above, composition graphs 1 to Fig. 4 describes the method for the signal transacting according to the embodiment of the present invention in detail, below, composition graphs 5 describes the device of the signal transacting according to the embodiment of the present invention in detail.
Fig. 5 shows the schematic block diagram of the device 300 according to the signal transacting of the embodiment of the present invention.As shown in Figure 5, this device 300 comprises:
Capacity determining unit 310, for determining the first memory size of operational objective thread and carrying out the second memory size of the signal transacting corresponding with the operation of this subject thread;
Thread stack creating unit 320, for this first memory size of determining according to this capacity determining unit 310 and this second memory size, create this thread stack, wherein, this thread stack comprises threads store space and signal storage space, this threads store space is used for the process variable that this subject thread of storage running produces, the size in this threads store space is more than or equal to this first memory size, this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size;
Processing unit 330, for when this subject thread carries out this signal transacting, accesses the process variable that this signal transacting produces in this signal storage space that this thread stack creating unit 320 creates.
Alternatively, this signal transacting comprises: the process of the fault-signal produced when breaking down to this subject thread; And
This processing unit 330 is specifically for accessing the process variable produced when this subject thread processes this fault-signal in this signal storage space of creating in this thread stack creating unit 320.
Alternatively, in this thread stack that this thread stack creating unit 320 creates, the start address in this threads store space is identical with the start address of this thread stack.
Alternatively, it is the first read-only or not read-write insulating space that this thread stack that this thread stack creating unit 320 creates also comprises attribute, and this first insulating space is between this threads store space and this signal storage space.
Alternatively, it is the second read-only or not read-write insulating space that this thread stack that this thread stack creating unit 320 creates also comprises attribute, this the second insulating space is positioned at the stack top of this thread stack, and this second insulating space not with this threads store space or this signal storage space overlap.
MMU(and/or CUP according to the device 300 of the signal transacting of the embodiment of the present invention may correspond in the method for the embodiment of the present invention), and, each unit in the device 300 of this signal transacting and module and other operations above-mentioned and/or function are respectively in order to realize the corresponding flow process of the method 100 in Fig. 2, for simplicity, do not repeat them here.
According to the device of the signal transacting of the embodiment of the present invention, by the subject thread run as required and the signal transacting needing to carry out, determine thread stack, this thread stack is made to comprise the threads store space of the process variable for storing this subject thread and the signal storage space for the process variable that stores this signal transacting, make the size in this threads store space be more than or equal to this thread run required for internal memory, the size in this signal storage space is made to be more than or equal to internal memory required for this signal transacting, the storage space of the process variable for storage signal process can be guaranteed, thus carry out of thread to signal transacting can be guaranteed.
Above, composition graphs 1 to Fig. 4 describes the method for the signal transacting according to the embodiment of the present invention in detail, below, composition graphs 6 describes the equipment of the signal transacting according to the embodiment of the present invention in detail.
Fig. 6 shows the schematic block diagram of the equipment 400 according to the signal transacting of the embodiment of the present invention.As shown in Figure 6, this equipment 400 comprises:
Bus 410;
The processor 420 be connected with this bus 410;
The storer 430 be connected with this bus 410;
Wherein, this processor 420, by this bus 410, calls the program stored in this storer 430, carries out the second memory size required for signal transacting for the first memory size determined required for operational objective thread and this subject thread;
For according to this first memory size and this second memory size, create thread stack, wherein, this thread stack comprises threads store space and signal storage space, this threads store space is used for the process variable that this subject thread of storage running produces, the size in this threads store space is more than or equal to this first memory size, and this signal storage space is for storing the process variable of carrying out this signal transacting and producing, and the size in this signal storage space is more than or equal to this second memory size;
For when this subject thread carries out this signal transacting, in this signal storage space, access the process variable that this signal transacting produces.
Alternatively, this signal transacting comprises: the process of the fault-signal produced when breaking down to this subject thread; And
This processor 420 specifically for accessing the process variable produced when this subject thread processes this fault-signal in this signal storage space.
Alternatively, in this thread stack that this processor 420 creates, the start address in this threads store space is identical with the start address of this thread stack.
Alternatively, it is the first read-only or not read-write insulating space that this thread stack that this processor 420 creates also comprises attribute, and this first insulating space is between this threads store space and this signal storage space.
Alternatively, it is the second read-only or not read-write insulating space that this thread stack that this processor 420 creates also comprises attribute, this the second insulating space is positioned at the stack top of this thread stack, and this second insulating space not with this threads store space or this signal storage space overlap.
Should understand, in embodiments of the present invention, this processor 420 can be Memory Management Unit (MMU, MemoryManagementUnit), also can be CPU (central processing unit) (CentralProcessingUnit, referred to as " CPU "), this processor 420 can also be other general processors, digital signal processor (DSP), special IC (ASIC), ready-made programmable gate array (FPGA) or other programmable logic device (PLD), discrete gate or transistor logic, discrete hardware components etc.The processor etc. of general processor can be microprocessor or this processor also can be any routine.
This storer 430 can comprise ROM (read-only memory) and random access memory, and provides instruction and data to processor 420.A part for storer 430 can also comprise nonvolatile RAM.Such as, the information of all right storage device type of storer 430.
This bus 410, except comprising data bus, can also comprise power bus, control bus and status signal bus in addition etc.But for the purpose of clearly demonstrating, in the drawings various bus is all designated as bus 410.
In implementation procedure, each step of said method can be completed by the instruction of the integrated logic circuit of the hardware in processor 420 or software form.Step in conjunction with the method disclosed in the embodiment of the present invention can directly be presented as that hardware processor is complete, or hardware in purpose processor and software module combination complete.Software module can be positioned at random access memory, flash memory, ROM (read-only memory), in the storage medium of this area maturations such as programmable read only memory or electrically erasable programmable storer, register.This storage medium is positioned at storer 430, and processor 420 reads the information in storer 430, completes the step of said method in conjunction with its hardware.For avoiding repetition, be not described in detail here.
MMU(and/or CUP according to the equipment 400 of the signal transacting of the embodiment of the present invention may correspond in the method for the embodiment of the present invention), and, each unit in the equipment 400 of this signal transacting and module and other operations above-mentioned and/or function are respectively in order to realize the corresponding flow process of the method 100 in Fig. 2, for simplicity, do not repeat them here.
According to the equipment of the signal transacting of the embodiment of the present invention, by the subject thread run as required and the signal transacting needing to carry out, determine thread stack, this thread stack is made to comprise the threads store space of the process variable for storing this subject thread and the signal storage space for the process variable that stores this signal transacting, make the size in this threads store space be more than or equal to this thread run required for internal memory, the size in this signal storage space is made to be more than or equal to internal memory required for this signal transacting, the storage space of the process variable for storage signal process can be guaranteed, thus carry out of thread to signal transacting can be guaranteed.
Should be understood that term "and/or" herein, being only a kind of incidence relation describing affiliated partner, can there are three kinds of relations in expression, and such as, A and/or B, can represent: individualism A, exists A and B simultaneously, these three kinds of situations of individualism B.In addition, character "/" herein, general expression forward-backward correlation is to the relation liking a kind of "or".
Should understand, in various embodiments of the present invention, the size of the sequence number of above-mentioned each process does not also mean that the priority of execution sequence, and the execution sequence of each process should be determined with its function and internal logic, and should not form any restriction to the implementation process of the embodiment of the present invention.
Those of ordinary skill in the art can recognize, in conjunction with unit and the algorithm steps of each example of embodiment disclosed herein description, can realize with the combination of electronic hardware or computer software and electronic hardware.These functions perform with hardware or software mode actually, depend on application-specific and the design constraint of technical scheme.Professional and technical personnel can use distinct methods to realize described function to each specifically should being used for, but this realization should not thought and exceeds scope of the present invention.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the specific works process of the system of foregoing description, device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
In several embodiments that the application provides, should be understood that disclosed system, apparatus and method can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.
If described function using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part of the part that technical scheme of the present invention contributes to prior art in essence in other words or this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, ROM (read-only memory) (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), magnetic disc or CD etc. various can be program code stored medium.
The above; be only the specific embodiment of the present invention, but protection scope of the present invention is not limited thereto, is anyly familiar with those skilled in the art in the technical scope that the present invention discloses; change can be expected easily or replace, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of described claim.
Claims (10)
1. a method for signal transacting, is characterized in that, described method comprises:
Determine that the first memory size required for operational objective thread and described subject thread carry out the second memory size required for signal transacting;
According to described first memory size and described second memory size, create thread stack, wherein, described thread stack comprises threads store space and signal storage space, described threads store space is used for the process variable that described in storage running, subject thread produces, the size in described threads store space is more than or equal to described first memory size, described signal storage space is for storing the process variable of carrying out described signal transacting and producing, and the size in described signal storage space is more than or equal to described second memory size;
When described subject thread carries out described signal transacting, in described signal storage space, access the process variable that described signal transacting produces.
2. method according to claim 1, is characterized in that, described signal transacting comprises: the process of the fault-signal produced when breaking down to described subject thread; And
The described process variable accessing described signal transacting and produce in described signal storage space, comprising:
The process variable produced when described subject thread processes described fault-signal is accessed in described signal storage space.
3. method according to claim 1 and 2, is characterized in that, in the described thread stack created, the start address in described threads store space is identical with the start address of described thread stack.
4. method according to claim 1 and 2, is characterized in that, it is the first read-only or not read-write insulating space that the described thread stack created also comprises attribute, and described first insulating space is between described threads store space and described signal storage space.
5. method according to claim 1 and 2, it is characterized in that, it is the second read-only or not read-write insulating space that described thread stack also comprises attribute, described second insulating space is positioned at the stack top of described thread stack, and described second insulating space not with described threads store space or described signal storage space overlap.
6. a device for signal transacting, is characterized in that, described device comprises:
Capacity determining unit, for determining the first memory size of operational objective thread and carrying out the second memory size of the signal transacting corresponding with the operation of described subject thread;
Thread stack creating unit, for described first memory size determined according to described capacity determining unit and described second memory size, create described thread stack, wherein, described thread stack comprises threads store space and signal storage space, described threads store space is used for the process variable that described in storage running, subject thread produces, the size in described threads store space is more than or equal to described first memory size, described signal storage space is for storing the process variable of carrying out described signal transacting and producing, the size in described signal storage space is more than or equal to described second memory size,
Processing unit, for when described subject thread carries out described signal transacting, accesses the process variable that described signal transacting produces in the described signal storage space that described thread stack creating unit creates.
7. device according to claim 6, is characterized in that, described signal transacting comprises: the process of the fault-signal produced when breaking down to described subject thread; And
Described processing unit specifically for accessing the process variable produced when described subject thread processes described fault-signal in the described signal storage space of described thread stack creating unit establishment.
8. the device according to claim 6 or 7, is characterized in that, in the described thread stack that described thread stack creating unit creates, the start address in described threads store space is identical with the start address of described thread stack.
9. the device according to claim 6 or 7, it is characterized in that, it is the first read-only or not read-write insulating space that the described thread stack that described thread stack creating unit creates also comprises attribute, and described first insulating space is between described threads store space and described signal storage space.
10. the device according to claim 6 or 7, it is characterized in that, it is the second read-only or not read-write insulating space that the described thread stack that described thread stack creating unit creates also comprises attribute, described second insulating space is positioned at the stack top of described thread stack, and described second insulating space not with described threads store space or described signal storage space overlap.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310150277.8A CN103246591B (en) | 2013-04-26 | 2013-04-26 | The method and apparatus of signal transacting |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310150277.8A CN103246591B (en) | 2013-04-26 | 2013-04-26 | The method and apparatus of signal transacting |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103246591A CN103246591A (en) | 2013-08-14 |
CN103246591B true CN103246591B (en) | 2016-01-27 |
Family
ID=48926121
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310150277.8A Expired - Fee Related CN103246591B (en) | 2013-04-26 | 2013-04-26 | The method and apparatus of signal transacting |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103246591B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103778184A (en) * | 2013-12-26 | 2014-05-07 | 深圳市华仁达技术有限公司 | Intelligent transportation massive checkpoint passage data transmission system |
CN110391952B (en) * | 2018-04-17 | 2023-03-14 | 阿里巴巴集团控股有限公司 | Performance analysis method, device and equipment |
CN110362991A (en) * | 2019-07-19 | 2019-10-22 | 上海睿赛德电子科技有限公司 | A kind of method of the thread stack space protection of real time operating system |
CN112965844B (en) * | 2019-12-12 | 2025-01-14 | 北京沃东天骏信息技术有限公司 | A CPU surge accident processing method and device |
CN113672388B (en) * | 2021-08-18 | 2023-09-05 | 广州虎牙科技有限公司 | Thread stack space adjustment method and related device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1271435A (en) * | 1997-10-02 | 2000-10-25 | 西门子公司 | Responsive system for processing digital signals and operation method for a responsive system |
CN100405247C (en) * | 1999-03-03 | 2008-07-23 | 索尼公司 | Data processing device, data processing method, terminal, transmission method for data processing device |
CN101446918A (en) * | 2008-12-10 | 2009-06-03 | 中兴通讯股份有限公司 | Method for realizing debugging of single function by user state debugger and system thereof |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2240778A1 (en) * | 1995-12-19 | 1997-06-26 | Telefonaktiebolaget Lm Ericsson | Job scheduling for instruction processor |
-
2013
- 2013-04-26 CN CN201310150277.8A patent/CN103246591B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1271435A (en) * | 1997-10-02 | 2000-10-25 | 西门子公司 | Responsive system for processing digital signals and operation method for a responsive system |
CN100405247C (en) * | 1999-03-03 | 2008-07-23 | 索尼公司 | Data processing device, data processing method, terminal, transmission method for data processing device |
CN101446918A (en) * | 2008-12-10 | 2009-06-03 | 中兴通讯股份有限公司 | Method for realizing debugging of single function by user state debugger and system thereof |
Non-Patent Citations (1)
Title |
---|
嵌入式系统线程技术研究;江兰帆;《中国优秀硕士学位论文全文数据库》;20080315(第3期);全文 * |
Also Published As
Publication number | Publication date |
---|---|
CN103246591A (en) | 2013-08-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103246591B (en) | The method and apparatus of signal transacting | |
EP3583504B1 (en) | Resource reclamation method and apparatus | |
US9146855B2 (en) | Systems and methods for tracking and managing non-volatile memory wear | |
CN108874624B (en) | Server, method for monitoring Java process and storage medium | |
US8516462B2 (en) | Method and apparatus for managing a stack | |
US20170180220A1 (en) | Techniques to Generate Workload Performance Fingerprints for Cloud Infrastructure Elements | |
KR20200086381A (en) | Blockchain consensus method and device | |
CN109669640A (en) | A kind of date storage method, device, electronic equipment and medium | |
WO2015090113A1 (en) | Data processing method and device | |
CN107480011A (en) | BIOS switching devices | |
US10127017B2 (en) | Devops management | |
KR101551206B1 (en) | A vehicle data control system and a control method | |
CN103455750B (en) | The high peace verification method of a kind of embedded device and device | |
CN106708865B (en) | Method and device for accessing window data in stream processing system | |
US8479040B2 (en) | Storage system and control method | |
US11360714B2 (en) | Method and controller for processing, based on global write stamp, cold and disturbed data block | |
CN104778087B (en) | A kind of information processing method and information processing unit | |
CN105279094A (en) | NAND Flash operation processing method, NAND Flash operation processing device and logic device | |
CN104699410B (en) | A kind of information processing method and electronic equipment | |
CN113704177B (en) | Storage method, system and related components of server firmware upgrade file | |
CN109213422A (en) | Bedding storage method, bedding storage device and computer readable storage medium | |
JP5948416B2 (en) | Information processing apparatus, information storage processing program, and information storage processing method | |
EP3640806B1 (en) | Memory block type processing method, device, electronic device, and readable storage medium | |
CN112542204A (en) | Low-voltage alarm method and device for nonvolatile chip, storage medium and terminal | |
CN105808322A (en) | Mapping control method and device for multi-partition virtual memory |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160127 Termination date: 20180426 |
|
CF01 | Termination of patent right due to non-payment of annual fee |