KR20200077297A - Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread - Google Patents

Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread Download PDF

Info

Publication number
KR20200077297A
KR20200077297A KR1020180166667A KR20180166667A KR20200077297A KR 20200077297 A KR20200077297 A KR 20200077297A KR 1020180166667 A KR1020180166667 A KR 1020180166667A KR 20180166667 A KR20180166667 A KR 20180166667A KR 20200077297 A KR20200077297 A KR 20200077297A
Authority
KR
South Korea
Prior art keywords
thread
shared memory
function
write
read
Prior art date
Application number
KR1020180166667A
Other languages
Korean (ko)
Other versions
KR102141620B1 (en
Inventor
최병주
박지현
Original Assignee
국방과학연구소
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 국방과학연구소 filed Critical 국방과학연구소
Priority to KR1020180166667A priority Critical patent/KR102141620B1/en
Publication of KR20200077297A publication Critical patent/KR20200077297A/en
Application granted granted Critical
Publication of KR102141620B1 publication Critical patent/KR102141620B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3612Software analysis for verifying properties of programs by runtime analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3037Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a memory, e.g. virtual memory, cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

According to the present invention, provided is a method for detecting an atomicity violation defect for a shared memory used in a multi-process/multi-thread. The method comprises: a shared memory analysis step of pre-analyzing a shared memory before executing a process and extracting a function pair which should access the shared memory atomically, wherein the function pair is associated with a shared memory atomic pair; an execution log collection step of calling a function to access the analyzed shared memory and collecting execution information of each process/thread; and a defect analysis step for analyzing a defect using the execution information and the shared memory atomic pair. Shared memory calls which should be atomisticaly made are analyzed through pre-binary analysis, and the shared memory calls are applied to execution data analysis obtained through hooking, so that atomicity violations in a shared memory can be detected.

Description

멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치{Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread}Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread}

본 발명은 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치에 관한 것이다. 보다 상세하게는, 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치에 관한 것이다. The present invention relates to a method and apparatus for detecting atomic violation defects in shared memory. More particularly, the present invention relates to a method and apparatus for detecting an atomic violation defect for shared memory used by multi-process/multi-thread.

최근 다중 CPU 환경이 일반화되고 있다. 한편, 하나의 CPU 환경에서는Multi-thread라고 하더라도 진정한 동시성이 없었다. 그렇기 때문에 스레드 혹은 프로세스간의 경쟁 조건으로 인해 결함이 발생할 확률이 아주 낮았다. 그러나 다중CPU 환경이 일반화되면서, 여러 CPU가 동시에 공유 자원에 접근하거나, 스레드의 실행 순서가 뒤바뀌는 것과 같은 병행성 결함(Concurrency bug)이 더 자주 발생하고 있다.Recently, a multi-CPU environment has been generalized. On the other hand, in one CPU environment, there was no true concurrency even if it was a multi-thread. Therefore, the probability of a defect occurring due to a race condition between threads or processes was very low. However, as the multi-CPU environment is generalized, concurrency bugs, such as multiple CPUs accessing shared resources at the same time or changing the execution order of threads, are more frequently occurring.

병행성 결함은 데드락, 원자성 위반(Atomicity violation), 그리고 순서 위반(Ordering violation)으로 분류할 수 있다. 일단 병행성 결함이 발생하게 되면, 단순히 프로그램이 멈추거나 종료되는 현상이 발생하거나, 심각하게는 방사능 사고와 같은 인명 사고를 발생시킬 수도 있다. 따라서 테스트가 집중되어야 할 매우 심각한 결함 중 하나이다. 그러나, concurrent systems은 동일한 실행에서도 프로세스 또는 스레드의 스케쥴링이 달라질 수 있는 비결정적인(non-deterministic) 실행 특징을 가지기 때문에, 시스템의 특정 실행 상황에서 발생하는 병행성 결함을 미리 예측하기 어렵고, 결함이 발생했을 때 결함 디버깅을 위해 원인을 찾아 상황을 재현하는 것도 쉽지 않다.Concurrent defects can be classified into deadlock, atomicity violation, and ordering violation. Once a parallel defect occurs, the program simply stops or ends, or it can seriously cause a human accident, such as a radioactive accident. Therefore, testing is one of the very serious flaws that need to be focused. However, since concurrent systems have a non-deterministic execution characteristic in which the scheduling of a process or a thread can be changed even in the same execution, it is difficult to predict the concurrency defect occurring in a specific execution situation of the system in advance, and a defect occurs It is also not easy to find the cause and reproduce the situation when debugging a defect.

병행성 결함 중에서도 특히 원자성 위반은 발생 빈도가 높고 반드시 해결되어야 하는 결함이다. 데드락이나 순서 위반은 결함이 발생할 수 있는 함수가 제한적이고 일단 결함이 발생하면 멈추거나(hang) 시스템 중단(crash)과 같은 현상이 발생한다. 그러나 원자성 위반은 공유 메모리에 하나의 연산처럼 취급되어야 하는 접근 연산 중간에 다른 연산이 끼어든 것이므로 그 자체로는 시스템을 멈추거나 종료시키지 않는다. 그리고 잘못된 접근으로 인한 영향이 비결정적으로 나타나기 때문에 결함이 탐지되더라도 원자성 위반 결함으로 판정하기 어렵다는 문제점이 있다.Among the parallel defects, the atomic violation is a defect that has a high incidence and must be solved. Deadlocks or sequence violations have limited functions that can cause defects, and once a defect occurs, hang or crash. However, the atomic violation does not stop or shut down the system by itself because another operation is intervened in the access operation that should be treated as one operation in shared memory. In addition, there is a problem in that it is difficult to determine the defect as an atomic violation even if a defect is detected because the influence of the wrong approach is indeterminate.

공유 메모리에 대한 원자성 위반을 탐지하기 위한 방안은 다양하게 연구되고 있다. 원자성 위반은 실행 환경에 따라 결함의 발생 여부가 달라질 수 있으므로 정적인 분석보다는 실행 기반의 동적 분석을 통해 결함을 탐지한다.Various methods for detecting atomic violations of shared memory have been studied. Atomic violation may detect defects through execution-based dynamic analysis rather than static analysis, since the occurrence of defects may vary depending on the execution environment.

대부분의 원자성 위반 탐지 방안들은 동기화에 사용되는 변수(lock)를 분석하여 lock으로 보호되는 공유 메모리에 대한 원자성 위반 결함을 탐지한다. 이와 관련하여, 멀티 스레드 프로그램에서 스레드간 공유 메모리 접근을 모니터링하여 원자성 위반을 탐지한다. lock으로 보호되고 있는 스레드의 공유 메모리나 공유 변수에 대해 타 스레드가 접근하는지 여부를 확인하여 결함으로 검출하는 방안이다. 또한, 동기화에 사용되는 변수를 분석한 후, 프로그램의 실행을 분석하여 원자성 위반 결함을 탐지하는 방안을 제안되었다. 하지만, 이와 같이 동기화에 사용되는 변수를 분석하여 결함을 탐지하는 방안은 동기화 변수로 보호되지 않는 공유 메모리 영역에서 발생하는 원자성 위반 결함에 대해서는 탐지할 수 없다는 문제점이 있다.Most atomic violation detection methods analyze locks used for synchronization to detect atomic violation defects in shared memory protected by locks. In this regard, multi-threaded programs monitor shared memory access between threads to detect atomic violations. It is a method to detect whether a thread is protected by a lock, or whether another thread accesses the shared memory or shared variable as a defect. In addition, after analyzing the variables used for synchronization, it was proposed to analyze the execution of the program to detect atomic violation defects. However, the method of detecting a defect by analyzing the variable used for synchronization has a problem in that it cannot detect an atomic violation defect occurring in a shared memory area that is not protected by the synchronization variable.

또한, read/write 함수에 대한 lock/unlock 코드 추가를 통해 현재 read/write 하는 대상에 대한 원자성 위반 결함을 탐지하는 방안을 고려할 수 있다. 그러나 이러한 방안은 실행 바이너리를 변경시키는 방안이므로 원래의 실행 환경을 깨뜨리게 된다는 문제점이 있다.In addition, by adding lock/unlock code for the read/write function, it is possible to consider a method of detecting an atomic violation defect for a current read/write target. However, this method has a problem in that it breaks the original execution environment because it is a method of changing the execution binary.

본 발명의 목적은 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치를 제공하는 것이다.It is an object of the present invention to provide a method and apparatus for detecting an atomic violation defect for shared memory used in multi-process/multi-thread.

또한, 본 발명의 목적은, 프로세스 실행 전 공유 메모리를 사전 분석하고 이를 실행 로그와 함께 분석함으로써 공유 메모리에 대한 원자성 위반을 탐지하는 방법 및 장치를 제공하는 것이다.In addition, it is an object of the present invention to provide a method and apparatus for detecting an atomic violation of a shared memory by pre-analyzing the shared memory before executing the process and analyzing it together with the execution log.

상기와 같은 과제를 해결하기 위한 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법이 제공된다. 상기 방법은, 프로세스 실행 전 공유 메모리를 사전 분석하고 상기 공유 메모리에 atomic하게 접근하여야 하는 함수 pair를 추출하는 공유 메모리 분석 단계 - 상기 함수 pair는 공유 메모리 atomic pair와 연관됨 - ; 상기 분석된 공유 메모리에 접근하기 위해 함수를 호출하고, 각 프로세스/스레드의 실행 정보를 수집하는 실행 로그 수집 단계; 및 상기 실행 정보와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석하는 결함 분석 단계를 포함하고, 사전 바이너리 분석을 통해 atomistic하게 이루어져야 하는 공유 메모리 호출을 분석하고, 이를 후킹을 통해 얻은 실행 데이터 분석에 적용시켜 공유 메모리에 대한 원자성 위반에 대해 탐지할 수 있다.A method for detecting an atomic violation defect for a shared memory used in a multi-process/multi-thread according to the present invention for solving the above problems is provided. The method includes: a shared memory analysis step of pre-analyzing shared memory and extracting a function pair that needs to be atomically accessed to the shared memory before the process is executed, wherein the function pair is associated with a shared memory atomic pair; An execution log collection step of calling a function to access the analyzed shared memory and collecting execution information of each process/thread; And a defect analysis step of analyzing a defect using the execution information and the shared memory atomic pair, analyzing a shared memory call that needs to be made atomistic through dictionary binary analysis, and applying it to analysis of execution data obtained through hooking. It can detect atomic violations of shared memory.

일 실시 예에 따르면, 상기 실행 로그 수집 단계는, 실행 환경에 미치는 영향을 최소화 하면서 상기 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링할 수 있다. 이때, 상기 수집되는 실행 정보는 상기 read/write 함수에서 사용하는 파라미터 값과 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태를 포함할 수 있다.According to an embodiment of the present disclosure, the execution log collection step may monitor a read/write function call to collect execution logs accessing the shared memory while minimizing the impact on the execution environment. At this time, the collected execution information may include the parameter value used in the read/write function and the ID and state of each process/thread as execution information of each process/thread.

일 실시 예에 따르면, 상기 결함 분석 단계는, 테스트 대상 시스템의 실행이 종료된 후, 상기 read/write 함수에서 사용하는 파라미터 값, 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석할 수 있다.According to one embodiment, the defect analysis step, after the execution of the system under test is finished, the parameter value used in the read/write function, the ID and state of each process/thread with execution information of each process/thread And the shared memory atomic pair can be used to analyze defects.

일 실시 예에 따르면, 상기 결함 분석 단계에서, 상기 read/write 함수의 실행 로그를 수집하여 분석하고, Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정할 수 있다.According to an embodiment, in the defect analysis step, the execution log of the read/write function is collected and analyzed, and read() or write of Thread 2 is performed before read() of Thread 1 is performed and write() is performed. When the function () is performed, it can be determined as an atomic violation defect candidate for the shared memory.

일 실시 예에 따르면, 상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되는 경우, 상기 Thread 1의 read()가 수행되고 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 결함 분석 단계에서 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정할 수 있다.According to an embodiment, when global variables used in Thread 1 and Thread 2 are used in both the first function and the second function executed by Thread 1 and Thread 2, read() of Thread 1 When the read() or write() function of Thread 2 is performed before is executed and write() is performed, it may be determined as an atomic violation defect candidate for the shared memory in the defect analysis step.

일 실시 예에 따르면, 상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되는 경우, 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()가 호출된 경우, 상기 Thread 1의 write()가 수행된 이후에 상기 Thread 2의 read()가 수행되도록 제어하는 멀티 프로세스/멀티 스레드 제어 단계를 더 포함할 수 있다.According to an embodiment, when the global variable used in Thread 1 and Thread 2 is used in both the first function and the second function executed by Thread 1 and Thread 2, write() of Thread 1 When the read() of the Thread 2 is called before the execution is performed, the multi-process/multi-thread control step of controlling the read() of the Thread 2 to be performed after the write() of the Thread 1 is performed further includes can do.

일 실시 예에 따르면, 상기 멀티 프로세스/멀티 스레드 제어 단계에서, 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 Thread 1의 write()에 의해 변경되는 특징에 따라 상기 전역 변수를 변경하고, 상기 변경된 전역 변수에 따라 상기 Thread 2의 read()를 다시 수행하도록 제어할 수 있다.According to an embodiment, in the multi-process/multi-thread control step, when the read() or write() function of Thread 2 is performed before the write() of Thread 1 is performed, the write() of Thread 1 ) To change the global variable according to the characteristic changed by ), and to perform read() of Thread 2 again according to the changed global variable.

본 발명의 다른 측면에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 장치가 제공된다. 상기 장치는, 멀티 프로세스/멀티 스레드에서 접근 가능하도록 구성되고, 변수와 정보를 저장하는 공유 메모리; 프로세스 실행 전 상기 공유 메모리를 사전 분석하고 상기 공유 메모리에 atomic하게 접근하여야 하는 함수 pair를 추출하는 공유 메모리 분석 모듈 - 상기 함수 pair는 공유 메모리 atomic pair와 연관됨 - ; 상기 분석된 공유 메모리에 접근하기 위해 함수를 호출하고, 각 프로세스/스레드의 실행 정보를 수집하는 실행 로그 수집 모듈; 및 상기 실행 정보와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석하는 결함 분석 모듈을 포함한다.A device for detecting an atomic violation defect for shared memory used in multi-process/multi-thread according to another aspect of the present invention is provided. The apparatus comprises: a shared memory configured to be accessible by multi-process/multi-thread, and storing variables and information; A shared memory analysis module that pre-analyzes the shared memory and extracts a function pair that needs to be atomically accessed to the shared memory before the process is executed-the function pair is associated with a shared memory atomic pair; An execution log collection module that calls a function to access the analyzed shared memory and collects execution information of each process/thread; And a defect analysis module for analyzing defects using the execution information and the shared memory atomic pair.

일 실시 예에 따르면, 상기 실행 로그 수집 모듈은, 실행 환경에 미치는 영향을 최소화 하면서 상기 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링할 수 있다. 이때, 상기 수집되는 실행 정보는 상기 read/write 함수에서 사용하는 파라미터 값과 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태를 포함할 수 있다.According to one embodiment, the execution log collection module may monitor a read/write function call in order to collect execution logs accessing the shared memory while minimizing the impact on the execution environment. At this time, the collected execution information may include the parameter value used in the read/write function and the ID and state of each process/thread as execution information of each process/thread.

일 실시 예에 따르면, 상기 결함 분석 모듈은, 테스트 대상 시스템의 실행이 종료된 후, 상기 read/write 함수에서 사용하는 파라미터 값, 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석할 수 있다.According to an embodiment of the present disclosure, after the execution of the system under test is completed, the defect analysis module uses parameter values used in the read/write function and ID and status of each process/thread as execution information of each process/thread. And the shared memory atomic pair can be used to analyze defects.

일 실시 예에 따르면, 상기 실행 로그 수집 모듈에서, 상기 read/write 함수의 실행 로그를 수집하고, 상기 결함 분석 모듈에서, Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정할 수 있다.According to an embodiment, in the execution log collection module, the execution log of the read/write function is collected, and in the defect analysis module, before the read() of Thread 1 is performed and the write() is performed, Thread 2 When the read() or write() function is performed, it can be determined as an atomic violation defect candidate for the shared memory.

일 실시 예에 따르면, 상기 결함 분석 모듈에서, 상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되어 상기 원자성 위반 결함 후보로 판정한 경우, 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()가 호출된 경우, 상기 Thread 1의 write()가 수행된 이후에 상기 Thread 2의 read()가 수행되도록 제어하는 프로세스/스레드 제어부를 더 포함할 수 있다.According to an embodiment, in the defect analysis module, global variables used in Thread 1 and Thread 2 are used in both the first function and the second function executed by Thread 1 and Thread 2, and the atomicity If it is determined as a violation defect candidate, if the read() of the thread 2 is called before the write() of the thread 1 is performed, the read() of the thread 2 after the write() of the thread 1 is performed It may further include a process / thread control to control the execution.

본 발명에 따르면, 사전 바이너리 분석을 통해 atomistic하게 이루어져야 하는 공유 메모리 호출을 분석하고, 이를 후킹을 통해 얻은 실행 데이터 분석에 적용시켜 공유 메모리에 대한 원자성 위반에 대해 탐지할 수 있다는 장점이 있다.According to the present invention, there is an advantage in that it is possible to detect an atomic violation of the shared memory by analyzing the shared memory call that needs to be made atomistic through dictionary binary analysis and applying it to the execution data analysis obtained through hooking.

또한, 본 발명에 따르면, 사전 분석을 통해 원자성 위반 탐지가 발생할 수 있는 범위를 축소시키고 실제 프로세스/스레드가 실행되는 상황에 기반하여 분석하므로 오탐율(false positive rate)이 낮다는 장점이 있다. In addition, according to the present invention, it is advantageous in that a false positive rate is low because it reduces the range in which an atomic violation detection can occur through pre-analysis and analyzes based on a situation in which an actual process/thread is executed.

또한, 본 발명에 따르면, 테스트 대상을 변경시키지 않고 탐지하는 방안으로 인하여 오버헤드도 적어 런타임 상태를 그대로 유지할 수 있다는 장점이 있다.In addition, according to the present invention, there is an advantage in that the runtime state can be maintained as there is less overhead due to the method of detecting the test object without changing it.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시 예를 가질 수 있는바, 특정 실시 예들을 도면에 예시하고 상세한 설명에 구체적으로 설명하고자 한다. 그러나 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.The present invention can be variously changed and can have various embodiments, and specific embodiments will be illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, and should be understood to include all modifications, equivalents, and substitutes included in the spirit and scope of the present invention.

도 1은 본 발명에 따른 OS에서 관리하는 공유 메모리에 접근하는 방안에 대한 도면이다.
도 2 는 본 발명에 따른 전역 변수를 공유하여 사용하는 방안에 대한 도면이다.
도 3 은 본 발명에 따른 원자성 공유 위반에 관한 실시 예를 설명하는 도면이다.
도 4는 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법의 흐름도를 나타낸다.
도 5는 본 발명에 따른 원자성 위반 결함 탐지 장치의 상세한 구성을 나타낸다.
1 is a diagram for a method of accessing a shared memory managed by an OS according to the present invention.
2 is a diagram for a method of sharing and using global variables according to the present invention.
3 is a view for explaining an embodiment of the atomic sharing violation according to the present invention.
4 is a flowchart of an atomic violation defect detection method for shared memory used in multi-process/multi-thread according to the present invention.
5 shows a detailed configuration of an atomic violation defect detection apparatus according to the present invention.

상술한 본 발명의 특징 및 효과는 첨부된 도면과 관련한 다음의 상세한 설명을 통하여 보다 분명해 질 것이며, 그에 따라 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 본 발명의 기술적 사상을 용이하게 실시할 수 있을 것이다. The above-described features and effects of the present invention will become more apparent through the following detailed description in connection with the accompanying drawings, and accordingly, those skilled in the art to which the present invention pertains can easily implement the technical spirit of the present invention. Will be able to.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시 예를 가질 수 있는바, 특정 실시 예들을 도면에 예시하고 상세한 설명에 구체적으로 설명하고자 한다. 그러나 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.The present invention can be variously changed and can have various embodiments, and specific embodiments will be illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, and should be understood to include all modifications, equivalents, and substitutes included in the spirit and scope of the present invention.

각 도면을 설명하면서 유사한 참조부호를 유사한 구성요소에 대해 사용한다.In describing each drawing, similar reference numerals are used for similar components.

제1, 제2등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다.Terms such as first and second may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from other components.

예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. 및/또는 이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함한다.For example, the first component may be referred to as a second component without departing from the scope of the present invention, and similarly, the second component may be referred to as a first component. The term and/or includes a combination of a plurality of related described items or any one of a plurality of related described items.

다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미가 있다.Unless otherwise defined, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by a person skilled in the art to which the present invention pertains.

일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥상 가지는 의미와 일치하는 의미를 가지는 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않아야 한다.Terms such as those defined in a commonly used dictionary should be interpreted as having meanings consistent with meanings in the context of related technologies, and should not be interpreted as ideal or excessively formal meanings unless explicitly defined in the present application. Should not.

이하의 설명에서 사용되는 구성요소에 대한 접미사 모듈, 블록 및 부는 명세서 작성의 용이함만이 고려되어 부여되거나 혼용되는 것으로서, 그 자체로 서로 구별되는 의미 또는 역할을 갖는 것은 아니다. The suffix modules, blocks, and parts for components used in the following description are given or mixed only considering the ease of writing the specification, and do not have a meaning or a role that is distinguished from each other.

이하, 본 발명의 바람직한 실시 예를 첨부한 도면을 참조하여 당해 분야에 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 설명한다. 하기에서 본 발명의 실시 예를 설명함에 있어, 관련된 공지의 기능 또는 공지의 구성에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우에는 그 상세한 설명을 생략한다. Hereinafter, with reference to the accompanying drawings, preferred embodiments of the present invention will be described so that those skilled in the art can easily carry out. In the following description of embodiments of the present invention, when it is determined that detailed descriptions of related well-known functions or well-known configurations may unnecessarily obscure the subject matter of the present invention, detailed descriptions thereof will be omitted.

이하에서는, 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치에 대해 구체적으로 설명하기로 한다. Hereinafter, a method and apparatus for detecting an atomic violation defect for a shared memory used in a multi-process/multi-thread according to the present invention will be described in detail.

도 1은 본 발명에 따른 OS에서 관리하는 공유 메모리에 접근하는 방안에 대한 도면이다. 도 1을 참조하면, OS에서 제공하는 공유 메모리 관리 함수 호출을 통해 공유 메모리를 할당받아 사용한 후 해제할 수 있다.1 is a diagram for a method of accessing a shared memory managed by an OS according to the present invention. Referring to FIG. 1, a shared memory may be allocated through a call to a shared memory management function provided by an OS and released after being used.

도 2 는 본 발명에 따른 전역 변수를 공유하여 사용하는 방안에 대한 도면이다. 도 2를 참조하면, 프로그램 어디에서나 접근이 가능한 전역 변수는 하나의 프로세스 내부에 있는 여러 개의 스레드가 접근이 가능하므로 스레드 간 공유 메모리로 사용할 수 있다.2 is a diagram for a method of sharing and using global variables according to the present invention. Referring to FIG. 2, global variables that can be accessed from anywhere in a program can be used as shared memory between threads because multiple threads within a process can access them.

도 3 은 본 발명에 따른 원자성 공유 위반에 관한 실시 예를 설명하는 도면이다. 구체적으로, 도 3 은 본 발명에 따른 원자성 공유 위반이 발생할 수 있도록 구성된 멀티 스레드 환경에서의 소스 코드를 나타낸다.3 is a view for explaining an embodiment of the atomic sharing violation according to the present invention. Specifically, FIG. 3 shows source code in a multi-threaded environment configured to cause an atomic sharing violation according to the present invention.

이하에서는, 도 1 내지 도 3을 참조하여, 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치에 대해 살펴보기로 한다.Hereinafter, with reference to FIGS. 1 to 3, a method and apparatus for detecting an atomic violation defect for a shared memory used in a multi-process/multi-thread according to the present invention will be described.

구체적으로, 본 발명에서는 프로세스 실행 전 공유 메모리를 사전 분석하고 이를 실행 로그와 함께 분석함으로써 공유 메모리에 대한 원자성 위반을 탐지하는 방안을 제안한다.Specifically, the present invention proposes a method of detecting an atomic violation of the shared memory by pre-analyzing the shared memory before executing the process and analyzing it together with the execution log.

이와 관련하여, 도 4는 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법의 흐름도를 나타낸다. 도 4를 참조하면, 원자성 위반 결함 탐지 방법은 공유 메모리 분석 단계(S110), 실행 로그 수집 단계(S120), 결함 분석 단계(S130) 및 멀티 프로세스/멀티 스레드 제어 단계(S140)를 포함한다.In this regard, FIG. 4 shows a flowchart of an atomic violation defect detection method for a shared memory used in a multi-process/multi-thread according to the present invention. Referring to FIG. 4, the method for detecting an atomic violation defect includes a shared memory analysis step (S110 ), an execution log collection step (S120 ), a defect analysis step (S130 ), and a multi-process/multi-thread control step (S140 ).

공유 메모리 분석 단계(S110)에서, 프로세스 실행 전 공유 메모리를 사전 분석하고 상기 공유 메모리에 atomic하게 접근하여야 하는 함수 pair를 추출한다. 이때, 상기 함수 pair는 공유 메모리 atomic pair와 연관된다.In the shared memory analysis step (S110), the shared memory is pre-analyzed before the process is executed, and a function pair that needs to be atomically accessed is extracted. At this time, the function pair is associated with the shared memory atomic pair.

실행 로그 수집 단계(S120)에서, 상기 분석된 공유 메모리에 접근하기 위해 함수를 호출하고, 각 프로세스/스레드의 실행 정보를 수집한다. 이때, 실행 로그 수집 단계(S120)에서, 실행 환경에 미치는 영향을 최소화 하면서 상기 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링할 수 있다. 이에 따라, 상기 수집되는 실행 정보는 상기 read/write 함수에서 사용하는 파라미터 값과 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태를 포함할 수 있다.In the execution log collection step (S120 ), a function is called to access the analyzed shared memory, and execution information of each process/thread is collected. At this time, in the execution log collection step (S120 ), a read/write function call may be monitored to collect execution logs accessing the shared memory while minimizing the impact on the execution environment. Accordingly, the collected execution information may include the parameter value used in the read/write function and the ID and state of each process/thread as execution information of each process/thread.

결함 분석 단계(S130)에서, 상기 실행 정보와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석한다. 구체적으로, 결함 분석 단계(S130)에서, 테스트 대상 시스템의 실행이 종료된 후, 결함을 분석할 수 있다. 이를 위해, 테스트 대상 시스템의 실행이 종료된 후, 상기 read/write 함수에서 사용하는 파라미터 값, 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석할 수 있다.In the defect analysis step (S130), the defect is analyzed using the execution information and the shared memory atomic pair. Specifically, in the defect analysis step (S130), after the execution of the system under test is finished, the defect may be analyzed. To this end, after the execution of the system under test is terminated, using the parameter value used in the read/write function, the ID and status of each process/thread as the execution information of each process/thread, and the atomic pair of the shared memory Defects can be analyzed.

한편, 결함 분석 단계(S130)에서의 원자성 위반 결함 후보로 판정 방법의 구체적인 방법은 다음과 같다. 이와 관련하여, 상기 read/write 함수의 실행 로그를 수집하고, 결함 분석 단계(S130)에서 이를 분석할 수 있다. 또한, 결함 분석 단계(S130)에서, Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정할 수 있다.Meanwhile, a specific method of the determination method as a candidate for an atomic violation defect in the defect analysis step S130 is as follows. In this regard, execution logs of the read/write function may be collected and analyzed in the defect analysis step (S130). In addition, in the defect analysis step (S130), if read() or write() function of Thread 2 is performed before read() of Thread 1 is performed and write() is performed, atomic violation of the shared memory It can be judged as a defect candidate.

구체적으로, 상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되는 경우, 원자성 위반 결함 후보로 판정할 수 있다. 이에 따라, 전역 변수가 제1 함수와 제2 함수에서 모두 사용되고, 상기 Thread 1의 read()가 수행되고 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우, 결함 분석 단계(S130)에서 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정할 수 있다.Specifically, when global variables used in Thread 1 and Thread 2 are used in both the first function and the second function executed by Thread 1 and Thread 2, it can be determined as an atomic violation defect candidate. . Accordingly, when the global variable is used in both the first and second functions, and the read() or write() function of Thread 2 is executed before the read() of Thread 1 is performed and the write() is performed. , In the defect analysis step (S130), it may be determined as an atomic violation defect candidate for the shared memory.

한편, 전술된 공유 메모리 분석 단계(S110), 실행 로그 수집 단계(S120) 및 결함 분석 단계(S130)에서의 구체적인 동작에 대해 살펴보면 다음과 같다.Meanwhile, a detailed operation of the above-described shared memory analysis step (S110), execution log collection step (S120), and defect analysis step (S130) is as follows.

<Step 1. 공유 메모리 분석(S110)><Step 1. Shared memory analysis (S110)>

프로세스/스레드에서 공유 메모리를 사용하는 방법은 크게 두 가지로 나눌 수 있다. 첫 번째는 OS에서 제공하는 공유 메모리 생성 함수를 호출하여 공유 메모리를 생성 후 사용하는 방법이고 두 번째는 프로세스 내부에 전역 변수를 만들고 이를 멀티스레드에서 공유하여 사용하는 방법이다. There are two ways to use shared memory in a process/thread. The first method is to create and use the shared memory by calling the shared memory creation function provided by the OS, and the second is to create a global variable inside the process and share it in multi-thread.

첫 번째 방법의 경우는 공유 메모리와 관련된 함수 호출을 통하여 도 1과 같이 OS에서 관리하는 공유 메모리를 사용하는 것이다. 리눅스의 경우 shmget, shmat, shmdt과 같은 공유 메모리 관리 함수를 제공한다. Shmget 함수를 통해 공유 메모리를 생성하게 되면 리눅스 커널에서 공유 메모리 공간을 할당하게 되고, shmat/shmdt 함수를 통해 프로세스에 접근 권한을 추가/해제할 수 있다.In the first method, the shared memory managed by the OS is used as shown in FIG. 1 through a function call related to the shared memory. Linux provides shared memory management functions such as shmget, shmat, and shmdt. When shared memory is created through the Shmget function, the shared memory space is allocated by the Linux kernel, and access to the process can be added/released through the shmat/shmdt function.

두 번째로 전역 변수를 이용하여 공유 메모리처럼 사용하는 방법은 도 2와 같다. 프로그램에서 사용하는 변수는 크게 특정한 함수 내부에서만 호출이 가능한 지역변수와 어떤 함수에서도 접근이 가능한 전역 변수로 나누어진다. 전역 변수는 프로세스의 data 영역에 저장되는 변수로 타 프로세스에서는 접근할 수 없지만 한 프로세스 내부에서는 어떤 함수에서든 접근이 가능하므로 공유가 가능하다. Second, a method of using a global variable like a shared memory is shown in FIG. 2. The variables used in the program are largely divided into local variables that can be called only within a specific function and global variables that can be accessed from any function. Global variables are variables stored in the data area of the process, and cannot be accessed from other processes, but can be shared because they can be accessed from any function within one process.

공유 메모리 분석이 끝난 후에는 공유 메모리에atomic하게 접근하여야 하는 함수 pair를 추출한다. 먼저 pthread_mutex_lock/unlock 과 같은 자원 접근 제한 함수의 lock/unlock으로 묶여있는 영역이 존재할 경우에는 lock/unlock으로 보호되는 내부의 공유 메모리 접근을 ‘공유 메모리 atomic pair’로 저장한다. Lock/unlock으로 보호되는 영역이 아닌 경우에도 하나의 함수 내부에서 공유 메모리에 대한 접근이 두 번 이상 발생하는 경우에는 연속된 공유 메모리 접근을 ‘공유 메모리 atomic pair candidate’로 저장한다.After the shared memory analysis is over, a function pair that needs to be accessed atomically is extracted. First, when an area bound by lock/unlock of a resource access restriction function such as pthread_mutex_lock/unlock exists, the internal shared memory access protected by lock/unlock is stored as a “shared memory atomic pair”. When access to the shared memory occurs more than once within a function even in areas not protected by lock/unlock, the continuous shared memory access is stored as a “shared memory atomic pair candidate”.

<Step 2. 실행 로그 수집 (S120)><Step 2. Collect execution log (S120)>

‘공유 메모리 분석’ 단계에서 분석한 공유 메모리에 대해 접근하기 위해서는 read/write와 같은 함수를 호출하거나 공유 메모리 변수에 직접 값을 읽고 쓰는 방법이 있다. 공유 메모리 변수 자체를 모니터링하기 위해서는 모니터링을 위한 오버헤드가 커지게 되므로 실시간 실행 환경을 깨뜨릴 수 있어 실행 기반으로 결함을 탐지하기에는 적합하지 않다. 따라서 실행 환경에 미치는 영향을 최소화 하면서 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링한다.In order to access the shared memory analyzed in the'Shared Memory Analysis' step, there is a method of calling a function such as read/write or reading and writing a value directly to a shared memory variable. In order to monitor the shared memory variable itself, the overhead for monitoring increases, which can break the real-time execution environment and is not suitable for detecting defects based on execution. Therefore, read/write function calls are monitored to collect execution logs that access shared memory with minimal impact on the execution environment.

이 때 수집하는 정보는 read/write 함수에서 사용하는 파라미터 값 뿐만 아니라 프로세스/스레드의 실행 정보도 함께 수집하여야 한다. 공유메모리에 대한 원자성 위반과 같은 병행성 결함의 경우에는 프로세스나 스레드의 실행 상황에 따라 결함의 발생 여부가 달라지기 때문이다. 즉, 프로세스나 스레드의 실행 환경에 따라 결함의 발생 여부가 달라지게 되므로 결함을 탐지하기 위해서는 공유 메모리에 대해 접근하는 함수 호출뿐만 아니라 프로세스/스레드의 실행 정보를 함께 수집하여야 한다.In this case, the information to be collected should not only collect parameter values used in read/write functions, but also process/thread execution information. This is because, in the case of concurrency defects, such as an atomic violation of shared memory, whether a defect occurs depends on the execution status of a process or thread. That is, since the occurrence of a defect depends on the execution environment of the process or thread, in order to detect the defect, it is necessary to collect execution information of the process/thread as well as a function call to access the shared memory.

프로세스/스레드의 실행 정보에는 각 프로세스/스레드의 ID, 상태가 포함된다. 또한 read/write 함수 호출이 발생했을 때 프로세스/스레드가 어떤 순서로 실행되고 있었는지를 확인할 수 있는 시간도 함께 수집하여야 한다. 이와 관련하여, read/write 함수 내부와 외부에서 수집하는 정보는 아래의 표 1과 같다.Process/thread execution information includes the ID and status of each process/thread. In addition, you should also collect the time to check in what order the process/thread was executing when the read/write function call occurred. In this regard, information collected inside and outside of the read/write function is shown in Table 1 below.

함수function 함수 내부에서 수집하는 정보Information collected inside the function 함수 외부에서 수집하는 정보Information collected outside the function ReadRead Read 함수 호출 시간, Read의 대상이 되는 bufRead function call time, buf to be read 프로세스 ID, 스레드 ID, 프로세스 상태, 스레드 상태Process ID, thread ID, process status, thread status writewrite Write 함수 호출 시간, Write의 대상이 되는 bufWrite function call time, buf to be written 프로세스 ID, 스레드 ID, 프로세스 상태, 스레드 상태Process ID, thread ID, process status, thread status

<Step 3. 결함 분석 (S130)><Step 3. Defect analysis (S130)>

테스트 대상 시스템의 실행이 종료된 후 수집된 실행 로그와 사전에 분석한 ‘공유 메모리 atomic pair’를 이용하여 결함을 분석한다. 원자성 위반 결함의 경우 발생 여부가 비결정적이므로 한 번 이상의 실행 로그를 분석하여야 한다. 실행 로그를 분석할 때 공유 메모리에 접근하는 함수 호출이 ‘공유 메모리 atomic pair’에 해당하는 함수 호출인 경우, 실행 도중에 다른 접근 함수의 호출이 있다면 원자성 위반 결함으로 판정한다. ‘공유 메모리 atomic pair candidate’에 해당하는 함수 호출 실행 도중 다른 프로세스/스레드에서 접근한 경우에는 원자성 위반 결함 후보로 판정한다.After the execution of the system under test is completed, defects are analyzed using the collected execution log and the previously analyzed'shared memory atomic pair'. In the case of an atomic violation defect, it is indeterminate that it should be analyzed more than once. When analyzing the execution log, if the function call to access the shared memory is a function call corresponding to the'shared memory atomic pair', if there is a call to another access function during execution, it is determined as an atomic violation defect. When a function call corresponding to the “shared memory atomic pair candidate” is accessed from another process/thread, it is determined as an atomic violation defect candidate.

<실시 예><Example>

전술한 바와 같이, 도 3 은 본 발명에 따른 원자성 공유 위반(atomicity violation)에 관한 실시 예를 설명하는 도면이다. 구체적으로, 도 3 은 본 발명에 따른 원자성 공유 위반이 발생할 수 있도록 구성된 멀티 스레드 환경에서의 소스 코드를 나타낸다.As described above, FIG. 3 is a diagram illustrating an embodiment of an atomicity violation according to the present invention. Specifically, FIG. 3 shows source code in a multi-threaded environment configured to cause an atomic sharing violation according to the present invention.

Thread 1과 Thread 2에서 사용하는 변수 bal은 전역 변수이고 Bank_update()와 Bank_Withdraw() 함수 내부는 하나의 연산처럼 실행되어야 한다. 그러나 스레드의 실행이 온전히 보장되지 않고 lock으로 보호되지 않으므로 스레드 실행 도중 context switch가 발생하면 원자성 위반이 발생할 수 있다. The variables bal used in Thread 1 and Thread 2 are global variables, and inside the Bank_update() and Bank_Withdraw() functions must be executed as a single operation. However, since the execution of the thread is not completely guaranteed and is not protected by a lock, an atomic violation may occur if a context switch occurs during thread execution.

본 발명에서는 공유 메모리 사전 분석을 통해 전역 변수 bal을 공유 메모리로 분석한다. 그리고 Bank_Update()와 Bank_Withdraw()의 코드 분석을 통해 bal에 접근하는 연산을 추출하고 이를 ‘공유 메모리 atomic pair candidate’로 저장한다.In the present invention, the global variable bal is analyzed as the shared memory through the pre-analysis of the shared memory. Then, through the code analysis of Bank_Update() and Bank_Withdraw(), the operation to access bal is extracted and stored as a'shared memory atomic pair candidate'.

함수의 실행 로그를 수집한 후, 이를 분석하는데Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우에는 이를 원자성 위반 결함 후보로 판정한다.After collecting the execution log of the function, if the read() or write() function of Thread 2 is executed before the read() of Thread 1 is executed and the write() is executed, it is a candidate for an atomic violation defect. It is judged as.

한편, 이러한 원리에 기반하여 구체적인 원자성 위반 결함 후보로 판정 방법과 원자성 위반이 발생하지 않도록 제어하거나 도는 공유 위반 발생 시에 제어 방법에 대해 살펴보기로 한다.On the other hand, based on this principle, a method for determining a specific atomic violation defect candidate and a control method for preventing an atomic violation from occurring or a control method for a shared violation will be described.

이와 관련하여, 상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되는 경우, 멀티 프로세스/멀티 스레드 제어 단계(S140)가 수행될 수 있다. 멀티 프로세스/멀티 스레드 제어 단계(S140)에서, 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()가 호출된 경우, 상기 Thread 1의 write()가 수행된 이후에 상기 Thread 2의 read()가 수행되도록 제어할 수 있다. 따라서, 상기 Thread 2의 실행을 일시 유보하고, 상기 Thread 1의 실행 결과를 반영하여 변경되는 전역변수에 따라 상기 Thread 2를 실행할 수 있다는 장점이 있다.In this regard, when the global variables used in Thread 1 and Thread 2 are used in both the first function and the second function executed by Thread 1 and Thread 2, the multi-process/multi-thread control step (S140) ) Can be performed. In the multi-process/multi-thread control step (S140), when the read() of the thread 2 is called before the write() of the thread 1 is performed, the thread 2 after the write() of the thread 1 is performed You can control the read() to be performed. Therefore, there is an advantage in that the execution of the Thread 2 is temporarily suspended, and the Thread 2 can be executed according to the global variable changed by reflecting the execution result of the Thread 1.

반면에, 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우, 멀티 프로세스/멀티 스레드 제어 단계(S140)가 수행될 수 있다. 이때, 멀티 프로세스/멀티 스레드 제어 단계(S140)에서, 상기 Thread 1의 write()에 의해 변경되는 특징에 따라 상기 전역 변수를 변경하고, 상기 변경된 전역 변수에 따라 상기 Thread 2의 read()를 다시 수행하도록 제어할 수 있다. 따라서, 이미 상기 Thread 2가 실행되어 원자성 공유 위반이 발생한 경우에도, 상기 Thread 1이 실행 완료된 이후 이를 보상하여 상기 Thread 2를 재실행할 수 있다는 장점이 있다.On the other hand, when the read() or write() function of Thread 2 is performed before the write() of Thread 1 is performed, a multi-process/multi-thread control step S140 may be performed. At this time, in the multi-process/multi-thread control step (S140), the global variable is changed according to the characteristic changed by the write() of the thread 1, and the read() of the thread 2 is read again according to the changed global variable. It can be controlled to perform. Therefore, even if the thread 2 is already executed and an atomic sharing violation occurs, there is an advantage that the thread 2 can be re-executed by compensating it after the thread 1 is completed.

이상에서는, 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법에 대해 살펴보았다. 이하에서는, 본 발명의 다른 측면에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 장치에 대해 살펴보기로 한다.In the above, the method for detecting an atomic violation defect for the shared memory used in the multi-process/multi-thread according to the present invention has been described. Hereinafter, an atomic violation defect detection apparatus for shared memory used in multi-process/multi-thread according to another aspect of the present invention will be described.

이와 관련하여, 전술한 원자성 위반 결함 탐지 방법에 대한 설명이 원자성 위반 결함 탐지 장치에도 적용 가능하다. 한편, 상기 원자성 위반 결함 탐지 장치는 이러한 원자성 위반 결함을 탐지하는 임의의 제어 장치, 컴퓨터, 제어부, 프로세서 등일 수 있다. 구체적으로, 상기 원자성 위반 결함 탐지 장치는 이러한 원자성 위반 결함을 탐지할 수 있는 임의의 OS 또는 프로그램이 탑재된 임의의 제어 장치, 컴퓨터, 제어부, 프로세서 등일 수 있다. In this regard, the description of the method for detecting an atomic violation defect described above is also applicable to the device for detecting an atomic violation defect. On the other hand, the atomic violation defect detection device may be any control device, computer, control unit, processor, etc. that detects the atomic violation defect. Specifically, the atomic violation defect detection device may be any control device, computer, control unit, processor, or the like equipped with any OS or program capable of detecting such atomic violation defects.

이와 관련하여, 도 5는 본 발명에 따른 원자성 위반 결함 탐지 장치의 상세한 구성을 나타낸다. 도 5를 참조하면, 공유 메모리(110), 공유 메모리 분석 모듈(120), 실행 로그 수집 모듈(130), 결함 분석 모듈(140) 및 프로세스/스레드 제어부(150)를 포함한다. In this regard, FIG. 5 shows a detailed configuration of an atomic violation defect detection apparatus according to the present invention. Referring to FIG. 5, the shared memory 110, the shared memory analysis module 120, the execution log collection module 130, the defect analysis module 140 and the process/thread control unit 150 are included.

여기서, 도 3과 같이 공유 메모리(110)를 참조하여 멀티 스레드를 수행하는 프로세스 A (Process A)를 수행하는 구성을 제1 프로세서 (또는 제1 제어부)로 지칭할 수 있다. 반면에, 도 5와 같이, 프로세스/스레드 제어부(150)에 따라 공유 메모리 위반 탐지 및 제어를 수행하는 구성을 제2 프로세서 (또는 제2 제어부)로 지칭할 수 있다. 이때, 공유 메모리 분석 모듈(120), 실행 로그 수집 모듈(130) 및 결함 분석 모듈(140) 중 일부는 제1 프로세서에 의해 수행되고, 나머지는 제2 프로세서에 의해 수행될 수 있다. 예를 들어, 공유 메모리 분석 모듈(120)은 제1 프로세서에 의해 수행되고, 실행 로그 수집 모듈(130) 및 결함 분석 모듈(140)은 제2 프로세서에 의해 수행될 수 있다. 하지만, 이러한 수행 방식은 이에 한정되는 것은 아니고, 응용에 따라 변경 가능하다.Here, referring to the shared memory 110 as shown in FIG. 3, a configuration for performing Process A performing multi-threading may be referred to as a first processor (or first controller). On the other hand, as illustrated in FIG. 5, a configuration for detecting and controlling shared memory violation according to the process/thread controller 150 may be referred to as a second processor (or second controller). At this time, some of the shared memory analysis module 120, the execution log collection module 130, and the defect analysis module 140 may be performed by the first processor, and the rest may be performed by the second processor. For example, the shared memory analysis module 120 may be performed by the first processor, and the execution log collection module 130 and the defect analysis module 140 may be performed by the second processor. However, the implementation method is not limited thereto, and may be changed according to application.

한편, 상기 제1 및 제2 프로세서 (또는 상기 제1 및 제2 제어부)는 논리적 또는 기능적으로 분리될 뿐, 물리적으로는 하나의 프로세서로 구현될 수도 있다. Meanwhile, the first and second processors (or the first and second controllers) are logically or functionally separated, and may be physically implemented as a single processor.

공유 메모리(110)는 멀티 프로세스/멀티 스레드에서 접근 가능하도록 구성되고, 변수와 정보를 저장할 수 있다. 공유 메모리 분석 모듈(120)은 프로세스 실행 전 상기 공유 메모리를 사전 분석하고 상기 공유 메모리에 atomic하게 접근하여야 하는 함수 pair를 추출하도록 구성된다. 이때, 상기 함수 pair는 공유 메모리 atomic pair와 연관된다.The shared memory 110 is configured to be accessible by multi-process/multi-thread, and can store variables and information. The shared memory analysis module 120 is configured to pre-analyze the shared memory before executing a process and extract a function pair that needs to be atomically accessed to the shared memory. At this time, the function pair is associated with the shared memory atomic pair.

실행 로그 수집 모듈(130)은 상기 분석된 공유 메모리에 접근하기 위해 함수를 호출하고, 각 프로세스/스레드의 실행 정보를 수집하도록 구성된다. 구체적으로, 실행 로그 수집 모듈(130)은 실행 환경에 미치는 영향을 최소화 하면서 상기 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링하도록 구성될 수 있다. 이때, 상기 수집되는 실행 정보는 상기 read/write 함수에서 사용하는 파라미터 값과 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태를 포함할 수 있다.The execution log collection module 130 is configured to call a function to access the analyzed shared memory and collect execution information of each process/thread. Specifically, the execution log collection module 130 may be configured to monitor read/write function calls to collect execution logs accessing the shared memory while minimizing the impact on the execution environment. At this time, the collected execution information may include the parameter value used in the read/write function and the ID and state of each process/thread as execution information of each process/thread.

또한, 결함 분석 모듈(140)은 상기 실행 정보와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석한다. 구체적으로, 결함 분석 모듈(140)은 테스트 대상 시스템의 실행이 종료된 후, 상기 read/write 함수에서 사용하는 파라미터 값, 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석할 수 있다.In addition, the defect analysis module 140 analyzes a defect using the execution information and the shared memory atomic pair. Specifically, after the execution of the system under test is finished, the defect analysis module 140 uses the parameter value used in the read/write function, the ID and status of each process/thread, and the execution information of each process/thread. Defects can be analyzed using shared memory atomic pairs.

구체적인 결함 분석 방법은 다음과 같다. 실행 로그 수집 모듈(130)에서, 상기 read/write 함수의 실행 로그를 수집하여 이를 결함 분석 모듈(130)로 전달할 수 있다. 이에 따라, 결함 분석 모듈(130)에서, Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정할 수 있다.The specific defect analysis method is as follows. In the execution log collection module 130, the execution log of the read/write function may be collected and transmitted to the defect analysis module 130. Accordingly, when the read() of Thread 1 is performed in the defect analysis module 130 and the read() or write() function of Thread 2 is performed before write() is performed, the atomicity for the shared memory is It can be judged as a violation defect candidate.

한편, 전술한 프로세스/스레드 제어부(150)의 원자성 공유 위반 제어 방식은 다음과 같다. 이와 관련하여, 결함 분석 모듈(130)에서, 상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되어 상기 원자성 위반 결함 후보 여부를 판정할 수 있다. 이에 따라, 프로세스/스레드 제어부(150)는 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()가 호출된 경우, 상기 Thread 1의 write()가 수행된 이후에 상기 Thread 2의 read()가 수행되도록 제어할 수 있다.On the other hand, the above-described control method of the atomic sharing violation of the process/thread control unit 150 is as follows. In this regard, in the defect analysis module 130, global variables used in the Thread 1 and the Thread 2 are used in both the first function and the second function executed by the Thread 1 and the Thread 2, and the atomicity It is possible to determine whether a candidate for a defect is violated. Accordingly, the process/thread control unit 150 may execute the write() of the thread 1 before the write() of the thread 1 is performed before the write() of the thread 1 is performed. You can control read() to be performed.

또한, 전술한 프로세스/스레드 제어부(150)는 이미 원자성 공유 위반이 발생한 경우에도 다음과 같은 제어 방식을 수행할 수 있다는 차별점을 갖는다. 이와 관련하여, 상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우, 프로세스/스레드 제어부(150)는 다음과 같은 동작을 수행할 수 있다. 이때, 프로세스/스레드 제어부(150)는, 상기 Thread 1의 write()에 의해 변경되는 특징에 따라 상기 전역 변수를 변경하고, 상기 변경된 전역 변수에 따라 상기 Thread 2의 read()를 다시 수행하도록 제어할 수 있다. 따라서, 이미 상기 Thread 2가 실행되어 원자성 공유 위반이 발생한 경우에도, 상기 Thread 1이 실행 완료된 이후 이를 보상하여 상기 Thread 2를 재실행할 수 있다는 장점이 있다.In addition, the above-described process/thread control unit 150 has a difference in that it can perform the following control scheme even when an atomic sharing violation has already occurred. In this regard, when the read() or write() function of Thread 2 is performed before the write() of Thread 1 is performed, the process/thread controller 150 may perform the following operations. At this time, the process/thread control unit 150 controls to change the global variable according to the feature changed by the write() of Thread 1, and perform read() of the Thread 2 again according to the changed global variable. can do. Therefore, even if the thread 2 is already executed and an atomic sharing violation occurs, there is an advantage that the thread 2 can be re-executed by compensating it after the thread 1 is completed.

이상에서는 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치에 대해 살펴보았다. 이와 관련하여, 본 발명에 따른 멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법 및 장치의 기술적 효과는 다음과 같다.In the above, a method and apparatus for detecting an atomic violation defect for a shared memory used in a multi-process/multi-thread according to the present invention have been described. In this regard, the technical effects of the method and apparatus for detecting an atomic violation defect for a shared memory used in a multi-process/multi-thread according to the present invention are as follows.

본 발명에 따르면, 사전 바이너리 분석을 통해 atomistic하게 이루어져야 하는 공유 메모리 호출을 분석하고, 이를 후킹을 통해 얻은 실행 데이터 분석에 적용시켜 공유 메모리에 대한 원자성 위반에 대해 탐지할 수 있다는 장점이 있다.According to the present invention, there is an advantage in that it is possible to detect an atomic violation of the shared memory by analyzing the shared memory call that needs to be made atomistic through dictionary binary analysis and applying it to the execution data analysis obtained through hooking.

또한, 본 발명에 따르면, 사전 분석을 통해 원자성 위반 탐지가 발생할 수 있는 범위를 축소시키고 실제 프로세스/스레드가 실행되는 상황에 기반하여 분석하므로 오탐율(false positive rate)이 낮다는 장점이 있다. In addition, according to the present invention, it is advantageous in that a false positive rate is low because it reduces the range in which an atomic violation detection can occur through pre-analysis and analyzes based on a situation in which an actual process/thread is executed.

또한, 본 발명에 따르면, 테스트 대상을 변경시키지 않고 탐지하는 방안으로 인하여 오버헤드도 적어 런타임 상태를 그대로 유지할 수 있다는 장점이 있다.In addition, according to the present invention, there is an advantage in that the runtime state can be maintained as there is less overhead due to the method of detecting the test object without changing it.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시 예를 가질 수 있는바, 특정 실시 예들을 도면에 예시하고 상세한 설명에 구체적으로 설명하고자 한다. 그러나 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.The present invention can be variously changed and can have various embodiments, and specific embodiments will be illustrated in the drawings and described in detail in the detailed description. However, this is not intended to limit the present invention to specific embodiments, and should be understood to include all modifications, equivalents, and substitutes included in the spirit and scope of the present invention.

소프트웨어적인 구현에 의하면, 본 명세서에서 설명되는 절차 및 기능뿐만 아니라 각각의 구성 요소들에 대한 설계 및 파라미터 최적화는 별도의 소프트웨어 모듈로도 구현될 수 있다. 적절한 프로그램 언어로 쓰여진 소프트웨어 어플리케이션으로 소프트웨어 코드가 구현될 수 있다. 상기 소프트웨어 코드는 메모리에 저장되고, 제어부(controller) 또는 프로세서(processor)에 의해 실행될 수 있다.According to the software implementation, design and parameter optimization for each component as well as the procedures and functions described herein may be implemented as separate software modules. Software code can be implemented in a software application written in an appropriate programming language. The software code is stored in a memory and can be executed by a controller or processor.

Claims (12)

멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 방법에서,
프로세스 실행 전 공유 메모리를 사전 분석하고 상기 공유 메모리에 atomic하게 접근하여야 하는 함수 pair를 추출하는 공유 메모리 분석 단계 - 상기 함수 pair는 공유 메모리 atomic pair와 연관됨 - ;
상기 분석된 공유 메모리에 접근하기 위해 함수를 호출하고, 각 프로세스/스레드의 실행 정보를 수집하는 실행 로그 수집 단계; 및
상기 실행 정보와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석하는 결함 분석 단계를 포함하는, 원자성 위반 결함 탐지 방법.
In the method of detecting atomic violation defects for shared memory used by multi-process/multi-thread,
Shared memory analysis step of pre-analyzing shared memory before process execution and extracting function pairs that need to be atomically accessed to the shared memory-the function pair is associated with the shared memory atomic pair-;
An execution log collection step of calling a function to access the analyzed shared memory and collecting execution information of each process/thread; And
And a defect analysis step of analyzing a defect using the execution information and the shared memory atomic pair.
제1 항에 있어서,
상기 실행 로그 수집 단계는,
실행 환경에 미치는 영향을 최소화 하면서 상기 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링하고,
상기 수집되는 실행 정보는 상기 read/write 함수에서 사용하는 파라미터 값과 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태를 포함하는, 원자성 위반 결함 탐지 방법.
According to claim 1,
The execution log collection step,
Monitoring read/write function calls to collect execution logs accessing the shared memory with minimal impact on the execution environment,
The collected execution information includes the parameter value used in the read/write function and the ID and status of each process/thread as execution information of each process/thread.
제2 항에 있어서,
상기 결함 분석 단계는,
테스트 대상 시스템의 실행이 종료된 후, 상기 read/write 함수에서 사용하는 파라미터 값, 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석하는 것을 특징으로 하는, 원자성 위반 결함 탐지 방법.
According to claim 2,
The defect analysis step,
After the execution of the system under test is finished, the defect value is analyzed by using the ID/status of each process/thread and the atomic pair of the shared memory as parameter values used in the read/write function, execution information of each process/thread Characterized in that, atomic defect detection method.
제2 항에 있어서,
상기 결함 분석 단계에서,
상기 read/write 함수의 실행 로그를 수집하여 분석하고,
Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정하는 것을 특징으로 하는, 원자성 위반 결함 탐지 방법.
According to claim 2,
In the defect analysis step,
Collect and analyze the execution log of the read/write function,
When the read() or write() function of Thread 2 is performed before the read() of Thread 1 is performed and the write() is performed, it is characterized by determining as an atomic violation defect candidate for the shared memory, Atomic Violation Defect Detection Method.
제4 항에 있어서,
상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되는 경우,
상기 Thread 1의 read()가 수행되고 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우,
상기 결함 분석 단계에서 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정하는 것을 특징으로 하는, 원자성 위반 결함 탐지 방법.
According to claim 4,
When global variables used in Thread 1 and Thread 2 are used in both the first function and the second function executed by Thread 1 and Thread 2,
When the read() or write() function of Thread 2 is executed before the read() of Thread 1 is performed and the write() is performed,
A method for detecting an atomic violation defect, characterized in that in the defect analysis step, it is determined as an atomic violation defect candidate for the shared memory.
제4 항에 있어서,
상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되는 경우,
상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()가 호출된 경우, 상기 Thread 1의 write()가 수행된 이후에 상기 Thread 2의 read()가 수행되도록 제어하는 멀티 프로세스/멀티 스레드 제어 단계를 더 포함하는, 원자성 위반 결함 탐지 방법.
According to claim 4,
When global variables used in Thread 1 and Thread 2 are used in both the first function and the second function executed by Thread 1 and Thread 2,
If the read() of the thread 2 is called before the write() of the thread 1 is executed, the multi-process that controls the read() of the thread 2 to be performed after the write() of the thread 1 is executed/ A method for detecting an atomic violation defect further comprising a multi-thread control step.
제6 항에 있어서,
상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()나 write() 함수가 수행된 경우,
상기 멀티 프로세스/멀티 스레드 제어 단계에서,
상기 Thread 1의 write()에 의해 변경되는 특징에 따라 상기 전역 변수를 변경하고, 상기 변경된 전역 변수에 따라 상기 Thread 2의 read()를 다시 수행하도록 제어하는, 원자성 위반 결함 탐지 방법.
The method of claim 6,
When the read() or write() function of Thread 2 is executed before the write() of Thread 1 is performed,
In the multi-process / multi-thread control step,
A method for detecting an atomic violation defect by changing the global variable according to a characteristic changed by write() of Thread 1 and controlling to read() of Thread 2 again according to the changed global variable.
멀티 프로세스/멀티 스레드에서 사용하는 공유 메모리에 대한 원자성 위반 결함 탐지 장치에서,
멀티 프로세스/멀티 스레드에서 접근 가능하도록 구성되고, 변수와 정보를 저장하는 공유 메모리;
프로세스 실행 전 상기 공유 메모리를 사전 분석하고 상기 공유 메모리에 atomic하게 접근하여야 하는 함수 pair를 추출하는 공유 메모리 분석 모듈 - 상기 함수 pair는 공유 메모리 atomic pair와 연관됨 - ;
상기 분석된 공유 메모리에 접근하기 위해 함수를 호출하고, 각 프로세스/스레드의 실행 정보를 수집하는 실행 로그 수집 모듈; 및
상기 실행 정보와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석하는 결함 분석 모듈을 포함하는, 원자성 위반 결함 탐지 장치.
In the device for detecting atomic violations of shared memory used by multi-process/multi-thread,
A shared memory configured to be accessible by multi-process/multi-thread and storing variables and information;
A shared memory analysis module that pre-analyzes the shared memory and extracts a function pair that needs to be atomically accessed to the shared memory before the process is executed-the function pair is associated with a shared memory atomic pair-;
An execution log collection module that calls a function to access the analyzed shared memory and collects execution information of each process/thread; And
And a defect analysis module for analyzing defects using the execution information and the shared memory atomic pair.
제8 항에 있어서,
상기 실행 로그 수집 모듈은,
실행 환경에 미치는 영향을 최소화 하면서 상기 공유 메모리에 접근하는 실행 로그를 수집하기 위해서 read/write 함수 호출을 모니터링하고,
상기 수집되는 실행 정보는 상기 read/write 함수에서 사용하는 파라미터 값과 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태를 포함하는, 원자성 위반 결함 탐지 장치.
The method of claim 8,
The execution log collection module,
Monitoring read/write function calls to collect execution logs accessing the shared memory with minimal impact on the execution environment,
The collected execution information includes a parameter value used in the read/write function and an ID and a state of each process/thread as execution information of each process/thread.
제9 항에 있어서,
상기 결함 분석 모듈은,
테스트 대상 시스템의 실행이 종료된 후, 상기 read/write 함수에서 사용하는 파라미터 값, 상기 각 프로세스/스레드의 실행 정보로 각 프로세스/스레드의 ID와 상태와 상기 공유 메모리 atomic pair를 이용하여 결함을 분석하는 것을 특징으로 하는, 원자성 위반 결함 탐지 장치
The method of claim 9,
The defect analysis module,
After the execution of the system under test is finished, the defect value is analyzed by using the ID/status of each process/thread and the atomic pair of the shared memory as parameter values used in the read/write function, execution information of each process/thread Characterized in that, the atomic violation defect detection device
제9 항에 있어서,
상기 실행 로그 수집 모듈에서,
상기 read/write 함수의 실행 로그를 수집하고,
상기 결함 분석 모듈에서,
Thread 1의 read()가 수행되고 write()가 수행되기 전에 Thread 2의 read()나 write() 함수가 수행된 경우, 상기 공유 메모리에 대한 원자성 위반 결함 후보로 판정하는 것을 특징으로 하는, 원자성 위반 결함 탐지 장치.
The method of claim 9,
In the execution log collection module,
Collect the execution log of the read/write function,
In the defect analysis module,
When the read() or write() function of Thread 2 is performed before the read() of Thread 1 is performed and the write() is performed, it is characterized by determining as an atomic violation defect candidate for the shared memory, Atomic violation defect detection device.
제11 항에 있어서,
상기 결함 분석 모듈에서,
상기 Thread 1 및 상기 Thread 2에서 사용되는 전역 변수가 상기 Thread 1 및 상기 Thread 2에 의해 실행되는 제1 함수와 제2 함수에서 모두 사용되어 상기 원자성 위반 결함 후보로 판정한 경우,
상기 Thread 1의 write()가 수행되기 전에 상기 Thread 2의 read()가 호출된 경우, 상기 Thread 1의 write()가 수행된 이후에 상기 Thread 2의 read()가 수행되도록 제어하는 프로세스/스레드 제어부를 더 포함하는, 원자성 위반 결함 탐지 장치.
The method of claim 11,
In the defect analysis module,
When the global variable used in the Thread 1 and the Thread 2 is used in both the first function and the second function executed by the Thread 1 and the Thread 2 and is determined as the atomic violation defect candidate,
If the read() of the Thread 2 is called before the write() of the Thread 1 is executed, the process/thread controlling to perform the read() of the Thread 2 after the write() of the Thread 1 is performed An atomic violation defect detection apparatus further comprising a control unit.
KR1020180166667A 2018-12-20 2018-12-20 Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread KR102141620B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020180166667A KR102141620B1 (en) 2018-12-20 2018-12-20 Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180166667A KR102141620B1 (en) 2018-12-20 2018-12-20 Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread

Publications (2)

Publication Number Publication Date
KR20200077297A true KR20200077297A (en) 2020-06-30
KR102141620B1 KR102141620B1 (en) 2020-08-06

Family

ID=71121363

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180166667A KR102141620B1 (en) 2018-12-20 2018-12-20 Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread

Country Status (1)

Country Link
KR (1) KR102141620B1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022086807A1 (en) * 2020-10-20 2022-04-28 Micron Technology, Inc. On-demand programmable atomic kernel loading
KR20220087247A (en) * 2020-12-17 2022-06-24 경상국립대학교산학협력단 A System and Method of Health Management for On-the-fly Repairing of Order Violation in Airborne Software

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080005193A1 (en) * 2006-06-09 2008-01-03 Sun Microsystems, Inc. Delayed breakpoints
US20100088680A1 (en) * 2008-10-07 2010-04-08 Nec Laboratories America, Inc. Methods and systems for reducing verification conditions for concurrent programs using mutually atomic transactions
KR101041777B1 (en) * 2009-06-08 2011-06-17 엠텍비젼 주식회사 Method for processing multi thread and Processor device using the same
KR20140147318A (en) * 2013-06-19 2014-12-30 한국전자통신연구원 Apparatus and method for detecting concurrency error of parallel program for multicore

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080005193A1 (en) * 2006-06-09 2008-01-03 Sun Microsystems, Inc. Delayed breakpoints
US20100088680A1 (en) * 2008-10-07 2010-04-08 Nec Laboratories America, Inc. Methods and systems for reducing verification conditions for concurrent programs using mutually atomic transactions
KR101041777B1 (en) * 2009-06-08 2011-06-17 엠텍비젼 주식회사 Method for processing multi thread and Processor device using the same
KR20140147318A (en) * 2013-06-19 2014-12-30 한국전자통신연구원 Apparatus and method for detecting concurrency error of parallel program for multicore

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Jie Yu 외, ‘A Case for an Interleaving Constrained Shared-Memory Multi-Processor’, ISCA '09, 2009.06.* *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022086807A1 (en) * 2020-10-20 2022-04-28 Micron Technology, Inc. On-demand programmable atomic kernel loading
US11409539B2 (en) 2020-10-20 2022-08-09 Micron Technology, Inc. On-demand programmable atomic kernel loading
US11698791B2 (en) 2020-10-20 2023-07-11 Micron Technology, Inc. On-demand programmable atomic kernel loading
KR20220087247A (en) * 2020-12-17 2022-06-24 경상국립대학교산학협력단 A System and Method of Health Management for On-the-fly Repairing of Order Violation in Airborne Software

Also Published As

Publication number Publication date
KR102141620B1 (en) 2020-08-06

Similar Documents

Publication Publication Date Title
US10073719B2 (en) Last branch record indicators for transactional memory
US8176489B2 (en) Use of rollback RCU with read-side modifications to RCU-protected data structures
US8661450B2 (en) Deadlock detection for parallel programs
US7899997B2 (en) Systems and methods for implementing key-based transactional memory conflict detection
US9513959B2 (en) Contention management for a hardware transactional memory
US8949671B2 (en) Fault detection, diagnosis, and prevention for complex computing systems
US20120254846A1 (en) System and Method for Optimizing a Code Section by Forcing a Code Section to be Executed Atomically
EP2037368A2 (en) Simulation of program execution to detect problem such as deadlock
US20070271450A1 (en) Method and system for enhanced thread synchronization and coordination
US9513911B2 (en) Method of detecting stack overflows and processor for implementing such a method
US20110252424A1 (en) System and method for detecting deadlock in a multithread program
US9086969B2 (en) Establishing a useful debugging state for multithreaded computer program
JP2013513885A (en) Processing operating system (OS) transactions in unlimited transactional memory (UTM) mode
CN103399818A (en) Deadlock detection method in operating system
KR19980086609A (en) Blocking Symbol Control in Computer Systems for Serializing Access to Data Resources by Concurrent Processor Requests
US20100186013A1 (en) Controlling Access to a Shared Resource in a Computer System
KR102141620B1 (en) Method and Apparatus for detecting atomicity violation for shared memory used in multi-process/multi-thread
US20160188441A1 (en) Testing multi-threaded applications
US8135690B2 (en) Concurrency object classification
US9697040B2 (en) Software replayer for transactional memory programs
CN114428733A (en) Kernel data competition detection method based on static program analysis and fuzzy test
CN109885489B (en) Data race detection method and device in driver
KR20120022467A (en) Apparatus and method for detecting data race
US10346196B2 (en) Techniques for enhancing progress for hardware transactional memory
US9477515B2 (en) Handling operating system (OS) transitions in an unbounded transactional memory (UTM) mode

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right