KR100319763B1 - Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system - Google Patents

Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system Download PDF

Info

Publication number
KR100319763B1
KR100319763B1 KR1019990061219A KR19990061219A KR100319763B1 KR 100319763 B1 KR100319763 B1 KR 100319763B1 KR 1019990061219 A KR1019990061219 A KR 1019990061219A KR 19990061219 A KR19990061219 A KR 19990061219A KR 100319763 B1 KR100319763 B1 KR 100319763B1
Authority
KR
South Korea
Prior art keywords
thread
transaction
requesting
deadlock
lock
Prior art date
Application number
KR1019990061219A
Other languages
Korean (ko)
Other versions
KR20010057809A (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 KR1019990061219A priority Critical patent/KR100319763B1/en
Publication of KR20010057809A publication Critical patent/KR20010057809A/en
Application granted granted Critical
Publication of KR100319763B1 publication Critical patent/KR100319763B1/en

Links

Classifications

    • 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
    • G06F9/524Deadlock detection or avoidance
    • 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/466Transaction processing

Abstract

본 발명은 쓰래드 풀을 기반으로 한 트랜잭션 처리시스템에서 쓰래드 복합 교착상태의 검출 및 해결 방법과 상기 방법을 실현시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체에 관한 것으로, 쓰래드 풀을 기반으로 한 트랜잭션 처리시스템에서 트랜잭션들간의 로크들에 의해서만 발생하는 일반적인 교착상태가 아닌 쓰래드와 로크가 복합된 교착 상태에서 교착 상태를 쉽게 검출하고, 이를 트랜잭션의 철회없이 해결하기 위한 쓰래드 복합 교착상태의 검출 및 해결 방법과 상기 방법을 실현시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공하기 위하여, 쓰래드 풀을 기반으로 하고 있는 트랜잭션 처리시스템에서 트랜잭션의 액션 단위로 쓰래드를 할당할 때 발생하는 로크와 쓰래드가 복합된 교착상태를 검출하고 이를 해결하는 방법에 있어서, 로크를 기다리는 트랜잭션과 쓰래드를 요청하는 트랜잭션간의 복합된 교착상태를 검사하기 위하여, 쓰래드를 요청한 트랜잭션이 점유하고 있는 로크를 요청하는 트랜잭션간의 사이클만을 조사하는 제 1 단계; 쓰래드를 요청하는 트랜잭션에 대해 상기 쓰래드를 요청하는 트랜잭션이 점유하고 있는 로크를 요청하는 다른 트랜잭션이 현재 점유하고 있는 쓰래드를 재배치하는 제 2 단계; 및 상기 쓰래드를 요청하는 트랜잭션의 완료 후, 재배치를 당했던 트랜잭션에 대해 쓰래드를 재할당하는 제 3 단계를 포함를 포함하며, 트랜잭션 처리시스템 등에 이용됨.The present invention relates to a method for detecting and resolving thread deadlocks in a thread pool based transaction processing system, and to a computer readable recording medium recording a program for realizing the method. In the processing system, a deadlock is easily detected in a deadlock with a combination of threads and locks rather than a normal deadlock only caused by locks between transactions. And a combination of locks and threads that occur when a thread is allocated on a transactional basis in a transaction processing system based on a thread pool to provide a computer-readable recording medium that records a program for realizing the above method. Detected deadlocks A method for solving this problem, the method comprising: a first step of examining only a cycle between a transaction requesting a lock occupied by a transaction requesting a thread to check a complex deadlock between a transaction waiting for a lock and a transaction requesting a thread; Relocating a thread that is currently occupied by another transaction requesting a lock occupied by the thread requesting transaction for the thread requesting a thread; And a third step of reallocating a thread for a transaction that has been relocated after completion of the transaction requesting the thread, for use in a transaction processing system or the like.

Description

쓰래드 풀을 기반으로 한 트랜잭션 처리시스템에서 쓰래드 복합 교착상태의 검출 및 해결 방법{Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system}Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system}

본 발명은 쓰래드(Thread) 풀을 기반으로 한 트랜잭션 처리시스템에서 쓰래드와 로크(Lock)가 복합된 교착 상태를 효과적으로 검출하고, 이를 트랜잭션의 철회없이 해결할 수 있는 쓰래드 복합 교착상태의 검출 및 해결 방법과 상기 방법을 실현시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체에 관한 것이다.The present invention provides a method for detecting and resolving a threaded deadlock that effectively detects a deadlock in which a thread and a lock are combined in a transaction processing system based on a thread pool, and resolves the transaction without retracting the transaction. A computer readable recording medium having recorded thereon a program for realizing the method.

데이터베이스 관리시스템(DBMS : Database Management System)과 같은 트랜잭션 처리시스템에서는 여러 트랜잭션이 동시에 액세스하는 데이터의 일관성을 보장하기 위해 테이타에 대한 로크(Lock)를 유지한다. 이러한 로크에는 배타적인 로크(X 로크 : Exclusive Lock)와 공유 로크(S 로크 : Shared Lock)가 있다.Transaction processing systems such as the Database Management System (DBMS) maintain locks on data to ensure the consistency of data accessed by multiple transactions simultaneously. These locks include an exclusive lock (X lock: Exclusive Lock) and a shared lock (S lock: Shared Lock).

어떤 데이터를 갱신하고자 하는 경우에, 먼저 해당 데이터에 대해 X 로크를 요청하고, 데이터를 참조하고자 하는 경우 다른 트랜잭션에 의해 갱신되지 못하도록 하기 위해 먼저 S 로크를 요청한다.If you want to update some data, you first request an X lock for that data, and if you want to refer to the data, you first request an S lock to prevent it from being updated by another transaction.

도 1 은 일반적인 교착 상태를 나타낸 설명도로서, 두 트랜잭션들의 로크에 의한 일반적인 교착상태를 나타낸 것이다.1 is an explanatory diagram showing a general deadlock, which shows a general deadlock due to locking of two transactions.

도 1에 도시된 바와 같이, 트랜잭션 T1이 객체 O1에 대한 로크를 요청하고 있으나 이 로크는 트랜잭션 T2가 점유하고 있으므로 T1은 대기 상태에 빠지게 되고, T2가 O2에 대한 로크를 요청하고 있으나 O2는 T1에 의해 점유되어 있으므로 T2는 대기 상태에 빠지게 된다. 즉, 두 트랜잭션(T1,T2)은 각각 상대 트랜잭션이 점유하고 있는 로크를 요청함으로써 무한 대기 상태에 빠지게 된다.As shown in FIG. 1, transaction T 1 is requesting a lock on object O 1 , but this lock is occupied by transaction T 2 , so T 1 is in a waiting state, and T 2 locks on O 2 . The request is made, but O 2 is occupied by T 1 so T 2 is in a waiting state. In other words, the two transactions (T 1 , T 2 ) each fall into an infinite waiting state by requesting a lock that the other transaction occupies.

여기서, 교착 상태에 빠진 트랜잭션들은 더 이상 실행되지 않을 뿐만아니라, 시스템의 자원을 점유하고 있기 때문에 다른 트랜잭션의 실행을 방해하여 시스템의 성능을 떨어뜨리게 된다. 심한 경우, 전체 시스템이 무력(Idle)한 상태에 빠질 수도 있다.Here, the deadlocked transactions are not only executed anymore, but also occupy system resources, thereby interfering with the execution of other transactions, thereby degrading the performance of the system. In severe cases, the entire system may be idle.

따라서, 다사용자용 트랜잭션 처리시스템에서는 교착 상태를 회복하기 위해서 시스템이 교착 상태에 빠졌는지 여부를 검출하고 이를 해결하는 기법이 필수적으로 요구된다.Therefore, in a multi-user transaction processing system, a technique for detecting and resolving a deadlock is essential to recover a deadlock.

일반적으로, 교착 상태를 검출하기 위해서는 트랜잭션에 걸친 사이클(Cycle)을 검출하는 방안을 사용한다. 상기 도 1에 대해서는 도 2와 같은 사이클을 찾을 수 있다.In general, to detect deadlocks, a method of detecting a cycle over a transaction is used. 1, the same cycle as in FIG. 2 can be found.

도 2에 도시된 바와 같이, T1이 T2가 점유한 로크를 요청하므로 T1에서 T2로의 화살표를 그리고, T2가 T1이 점유한 로크를 요청하므로 T2에서 T1으로의 화살표을 그리면 T1→T2→T1으로의 사이클이 형성된다.As shown in Figure 2, T 1 is T, so 2 requests the occupied lock the arrow to T 2 from T 1, and, T 2 is hwasalpyoeul of a T T at 21, because the request for a lock by the T 1 occupies Then a cycle from T 1 → T 2 → T 1 is formed.

교착 상태를 검출하기 위해 현재 수행중인 모든 트랜잭션이 점유하거나 요청중인 모든 로크에 대해 사이클의 여부를 조사해야 하기 때문에 교착 상태 검출 알고리즘은 복잡도가 높다. 뿐만아니라, 교착 상태를 해결하기 위해서는 희생자 트랜잭션을 선정하여 철회시켜야 하는 오버헤드가 있다. 예를 들면, 도 1의 경우 두 트랜잭션중 하나는 반드시 철회되어야 한다.Deadlock detection algorithms are complex because deadlock detection requires cycle checking for all locks that are currently being occupied or requested to detect deadlocks. In addition, to resolve deadlocks, there is overhead to select and withdraw victim transactions. For example, in the case of FIG. 1 one of the two transactions must be withdrawn.

쓰래드를 기반으로 하는 다사용자 트랜잭션 처리시스템에서는 사용자 트랜잭션을 효율적으로 처리하기 위해 쓰래드 풀을 많이 사용하고 있다. 이는 사용자 트랜잭션마다 쓰래드를 새로 생성하고 반환하는 경우 쓰래드 생성 오버헤드로 인해 성능이 떨어지질 수 있기 때문에 미리 고정된 수의 쓰래드를 생성해 놓고 요청이 있을 때 쓰래드를 할당하여 사용하는 것이다.A thread-based multiuser transaction processing system uses a lot of thread pools to efficiently process user transactions. When creating and returning a new thread for each user transaction, performance may be degraded due to the thread creation overhead. Therefore, a predetermined number of threads are created and the threads are allocated and used when requested.

트랜잭션은 액션(Action)의 순차(Sequence)로 이루어진다. 일괄 작업(Batch Job)이 아닌 응용 프로그램의 경우 사용자 또는 응용 프로그램과의 상호작용(Interaction)을 위해 한 액션을 수행하고, 다음 액션을 수행하기 위해 프로세스간 통신(IPC : Inter-process Communication)이 발생한다.A transaction consists of a sequence of actions. For non-batch applications, inter-process communication (IPC) occurs to perform one action to interact with the user or application, and to perform the next. do.

트랜잭션에 대해 하나의 쓰래드를 할당하는 경우에, 이러한 IPC 동안에 해당 쓰래드는 다음 액션이 도착할 때까지 대기 상태에 빠지게 된다. 심한 경우에, 모든 쓰래드가 이러한 대기 상태에 빠질 수도 있다. 이러한 성능 저하 문제를 해결하기 위해서는 트랜잭션 단위가 아니라, 액션 단위로 쓰래드를 할당할 필요가 있다. 그러나, 이렇게 액션 단위로 쓰래드를 할당하는 경우 하기의 도 3과 같은 쓰래드 복합 교착 상태에 빠질 수 있다.In the case of assigning a thread to a transaction, during this IPC, the thread will wait until the next action arrives. In severe cases, all threads may fall into this waiting state. To solve this problem of performance degradation, it is necessary to allocate threads on an action basis, not on a transactional basis. However, in the case of assigning a thread in an action unit as described above, a thread complex deadlock state as shown in FIG.

도 3 은 쓰래드 복합 교착 상태를 나타낸 설명도로서, 쓰래드 풀에 두 개의 쓰래드가 관리되는 경우에 발생할 수 있는 쓰래드 복합 교착 상태를 나타낸다.FIG. 3 is an explanatory diagram illustrating a thread compound deadlock, and shows a thread compound deadlock that may occur when two threads are managed in a thread pool.

도 3에 도시된 바와 같이, T2, T3이 객체 O2에 대한 로크를 요청하고 있으나 이 로크는 T1에 의해 점유된 상태이다. 그런데, T2과 T3가 각각 쓰래드 th1, th2를 점유하고 있기 때문에 T1은 th1, th2쓰래드가 반환되기를 기다리게 되어 T1-T2-T1또는 T1-T3-T1의 교착 상태가 발생하게 된다.As shown in FIG. 3, T 2 and T 3 are requesting a lock for object O 2 , but this lock is occupied by T 1 . However, since T 2 and T 3 occupy the threads th 1 and th 2 , respectively, T 1 waits for the th 1 and th 2 threads to return and either T 1 -T 2 -T 1 or T 1 -T 3 -T 1 deadlock occurs.

이러한 쓰래드 복합 교착 상태를 종래의 교착 상태 검출 및 해결 방식으로 처리하고자 하는 경우에 이를 제안하고자 하는 기법과 비교하면, 교착 상태를 검출하는 알고리즘의 복잡도가 높아서 성능이 떨어지고, 희생자 트랜잭션이 철회되어야 하는 오버헤드가 발생하는 문제점이 있었다.Compared to the proposed technique when the thread complex deadlock is processed by the conventional deadlock detection and resolution method, the complexity of the algorithm for detecting the deadlock is high, resulting in poor performance, and overloading the victim transaction. There was a problem with the head.

본 발명은 상기한 바와 같은 문제점을 해결하기 위하여 제안된 것으로, 쓰래드(Thread) 풀을 기반으로 한 트랜잭션 처리시스템에서 트랜잭션들간의 로크들에 의해서만 발생하는 일반적인 교착상태가 아닌 쓰래드와 로크(Lock)가 복합된 교착 상태에서 교착 상태를 쉽게 검출하고, 이를 트랜잭션의 철회없이 해결하기 위한 쓰래드 복합 교착상태의 검출 및 해결 방법과 상기 방법을 실현시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공하는데 그 목적이 있다.The present invention has been proposed to solve the above problems, and in a thread pool based transaction processing system, threads and locks are not commonly deadlocked only by locks between transactions in a thread pool based transaction processing system. A method for detecting and resolving a deadlock in a complex deadlock and resolving it without reversal of a transaction, and a computer-readable recording medium recording a program for realizing the method. There is a purpose.

도 1 은 일반적인 교착 상태를 나타낸 설명도.1 is an explanatory diagram showing a general deadlock.

도 2 는 상기 도 1의 트랜잭션 대기 상태를 나타낸 설명도.2 is an explanatory diagram showing a transaction waiting state of FIG.

도 3 은 쓰래드 복합 교착 상태를 나타낸 설명도.3 is an explanatory diagram showing a threaded composite deadlock;

도 4 는 본 발명에 따른 쓰래드 복합 교착상태의 검출 및 해결 방법중 쓰래드 복합 교착 상태를 피하기 위한 쓰래드 할당 및 재배치 과정에 대한 일실시예 흐름도.4 is a flowchart illustrating a thread allocation and relocation process for avoiding a threaded composite deadlock in a method for detecting and resolving a threaded deadlock according to the present invention.

도 5 는 본 발명에 따른 쓰래드 복합 교착상태의 검출 및 해결 방법중 쓰래드 복합 교착 상태를 피하기 위한 쓰래드 반환 및 재배치 과정에 대한 일실시예 흐름도.5 is a flow diagram of an embodiment of a thread return and relocation process for avoiding a threaded composite deadlock in a method for detecting and resolving a threaded composite deadlock in accordance with the present invention.

상기 목적을 달성하기 위한 본 발명은, 쓰래드(Thread) 풀을 기반으로 하고 있는 트랜잭션 처리시스템에서 트랜잭션의 액션 단위로 쓰래드를 할당할 때 발생하는 로크와 쓰래드가 복합된 교착상태(Deadlock)를 검출하고 이를 해결하는 방법에 있어서, 로크를 기다리는 트랜잭션과 쓰래드를 요청하는 트랜잭션간의 복합된 교착상태를 검사하기 위하여, 쓰래드를 요청한 트랜잭션이 점유하고 있는 로크를 요청하는 트랜잭션간의 사이클만을 조사하는 제 1 단계; 쓰래드를 요청하는 트랜잭션에 대해 상기 쓰래드를 요청하는 트랜잭션이 점유하고 있는 로크를 요청하는 다른 트랜잭션이 현재 점유하고 있는 쓰래드를 재배치하는 제 2 단계; 및 상기 쓰래드를 요청하는 트랜잭션의 완료 후, 재배치를 당했던 트랜잭션에 대해 쓰래드를 재할당하는 제 3 단계를 포함하여 이루어진 것을 특징으로 한다.In order to achieve the above object, the present invention provides a method for detecting a deadlock in which a lock and a thread are combined, which occurs when a thread is allocated in a transaction unit in a transaction processing system based on a thread pool. A method for solving this problem, the method comprising: a first step of examining only a cycle between a transaction requesting a lock occupied by a transaction requesting a thread to check a complex deadlock between a transaction waiting for a lock and a transaction requesting a thread; Relocating a thread that is currently occupied by another transaction requesting a lock occupied by the thread requesting transaction for the thread requesting a thread; And a third step of reallocating the thread for the transaction that was relocated after completion of the transaction requesting the thread.

한편, 본 발명은 프로세서를 구비한 트랜잭션 처리시스템에, 로크를 기다리는 트랜잭션과 쓰래드를 요청하는 트랜잭션간의 복합된 교착상태를 검사하기 위하여, 쓰래드를 요청한 트랜잭션이 점유하고 있는 로크를 요청하는 트랜잭션간의 사이클만을 조사하는 제 1 기능; 쓰래드를 요청하는 트랜잭션에 대해 상기 쓰래드를 요청하는 트랜잭션이 점유하고 있는 로크를 요청하는 다른 트랜잭션이 현재 점유하고 있는 쓰래드를 재배치하는 제 2 기능; 및 상기 쓰래드를 요청하는 트랜잭션의 완료 후, 재배치를 당했던 트랜잭션에 대해 쓰래드를 재할당하는 제 3 기능을 실현시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체를 제공한다.On the other hand, the present invention, in order to check the complex deadlock between the transaction waiting for the lock and the transaction requesting the thread in the transaction processing system having a processor, only the cycle between the transaction requesting the lock occupied by the transaction requesting the thread A first function to investigate; A second function for relocating a thread currently occupied by another transaction requesting a lock occupied by the transaction requesting the thread for a transaction requesting the thread; And a computer readable recording medium having recorded thereon a program for realizing a third function of reallocating threads for transactions which have been relocated after completion of the transaction requesting the threads.

본 발명은 고정된 쓰래드(thread) 풀을 기반으로 하고 있는 클라이언트-서버 트랜잭션 처리시스템에서 트랜잭션의 단위 연산인 액션 단위로 쓰래드를 할당할 때 발생하는 로크와 쓰래드가 복합된 교착 상태(Deadlock)를 효과적으로 검출하고 해결(Resolve)할 수 있는 기법을 제안하는 것이다.The present invention effectively solves a deadlock in which a lock and a thread are generated when a thread is allocated to an action unit, which is a unit operation of a transaction, in a client-server transaction processing system based on a fixed thread pool. It is to propose a technique that can detect and resolve.

트랜잭션 단위로 쓰래드를 할당하는 방안은 수행중인 트랜잭션상에서 사용자 또는 응용 프로그램과의 통신이 수행되는 동안 해당 쓰래드가 대기 상태에 있는 것에 반하여, 액션 단위로 쓰래드를 할당하는 방안은 이러한 통신이 수행되는 동안 해당 쓰래드를 다른 트랜잭션의 액션에 대해 할당할 수 있기 때문에 사용자의 응답시간을 줄이고 작업량(Throughput)을 향상시킬 수 있다. 그러나, 이 방안은 더 이상 가용한 쓰래드가 없을 때 쓰래드를 요청하는 어떤 트랜잭션과 이 트랜잭션이 점유하고 있는 임의의 로크가 반환되기를 기다리는 다른 트랜잭션들(쓰래드들)간의 복합된 교착상태가 발생하는 문제점이 있다.The method of allocating threads on a transaction basis is that while the thread is in a waiting state while communicating with a user or application on a running transaction, the method of assigning threads on an action basis is applicable while such communication is performed. By assigning threads to actions in other transactions, you can reduce user response time and improve throughput. However, this solution avoids the problem of a complex deadlock between a transaction requesting a thread and other transactions (threads) waiting for the return of any locks it occupies when no more threads are available. have.

이러한 교착상태의 해결을 위해, 기존에 제안된 일반적인 검출 및 해결 기법을 그대로 적용하는 경우 희생자로 선정된 트랜잭션은 반드시 철회되어야 하는 문제점이 있다.In order to resolve such a deadlock, a transaction selected as a victim has to be withdrawn when the conventional detection and resolution technique proposed previously is applied as it is.

일반적으로, 교착 상태를 검출하기 위해 사이클을 찾고 희생자 트랜잭션을 철회하는 기법은 성능 및 자원 면에서 상당한 오버헤드가 있다.In general, techniques for finding cycles and withdrawing victim transactions to detect deadlocks have significant overhead in terms of performance and resources.

따라서, 본 발명에서는 로크와 구별되는 쓰래드라는 특성의 차이를 이용하여 이러한 교착 상태를 효과적으로 검출하고 트랜잭션을 철회하지 않고 해결하는 방안을 제시한다.Accordingly, the present invention proposes a method for effectively detecting such a deadlock and solving the transaction without withdrawing the transaction by using the difference in the characteristics of the thread distinguished from the lock.

이를 위해, 본 발명에서는 이러한 복합된 교착상태에서 쓰래드를 요청하는 트랜잭션이 점유하고 있는 로크의 반환을 기다리는 트랜잭션의 쓰래드를 쓰래드를 요청하는 트랜잭션으로 재배치함으로써 문제를 해결한다. 제안된 기법은 쓰래드 뿐만아니라 프로세스(Process)와 프로세서(Processor)에 대해서도 동일하게 적용될수 있다.To this end, the present invention solves the problem by relocating the thread of the transaction waiting for the return of the lock occupied by the transaction requesting the thread in the complex deadlock to the transaction requesting the thread. The proposed technique can be applied to not only threads but also processes and processors.

상술한 목적, 특징들 및 장점은 첨부된 도면과 관련한 다음의 상세한 설명을 통하여 보다 분명해 질 것이다. 이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 일실시예를 상세히 설명한다.The above objects, features and advantages will become more apparent from the following detailed description taken in conjunction with the accompanying drawings. Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

본 발명은 트랜재션들간의 로크들에 의해서만 발생하는 일반적인 교착상태가 아닌 쓰래드 복합 교착상태에서 교착상태를 쉽게 검출하고 해결하는 방법에 관한 것이다.The present invention relates to a method for easily detecting and resolving deadlocks in a threaded composite deadlock, rather than a general deadlock only caused by locks between transactions.

액션 단위로 쓰래드를 할당하는 방식에서는 트랜잭션의 수행중에 사용자 또는 응용 프로그램과의 통신이 이루어지고 새로운 액션의 처리가 요청되면 이 액션을 처리하기 위해 쓰래드를 요청하고 할당받은 쓰래드를 통해 요구한 액션을 수행한 후 쓰래드를 반납한다.In the method of allocating threads on a per-action basis, when a communication with a user or an application is made during a transaction and a new action is requested, a thread is requested to process the action and the requested thread is executed through the assigned thread. Then return the thread.

액션을 수행할 때 액세스하는 객체의 일관성을 유지하기 위해 액세스전에 해당 객체에 대해 로크를 요청하게 된다. 획득하고자 하는 로크가 이미 다른 트랜잭션에 의해 점유되었으면 요청한 로크를 획득할 때까지 대기하게 된다. 가용한 쓰래드가 없는 상태에서는 액션의 처리를 위해 쓰래드를 요청하는 트랜잭션은 쓰래드를 할당받은 다른 트랜잭션이 현재 진행중인 액션의 처리가 완료될 때까지 대기하여야 한다.When performing an action, to ensure consistency of the object being accessed, a lock is requested for that object before access. If the lock to be acquired is already occupied by another transaction, it will wait until the requested lock is acquired. In the absence of an available thread, a transaction requesting a thread to process an action must wait until another transaction that has been assigned a thread has completed processing the current action.

그러나, 쓰래드를 점유한 모든 트랜잭션이 대기 상태에 있는 경우에는 무한히 기다리게 된다. 쓰래드를 점유한 트랜잭션이 대기 상태에 있는 이유는 액세스하고자 하는 객체의 로크를 획득하기 위해서이다.However, if all transactions that occupy a thread are waiting, they will wait indefinitely. The reason the transaction that occupied the thread is in the waiting state is to obtain the lock of the object to be accessed.

쓰래드 복합 교착상태는 쓰래드를 요청하는 트랜잭션과 이 트랜잭션이 점유한 로크를 요청한 트랜잭션에 의해 발생한다. 따라서, 쓰래드 복합 교착상태를 검출하기 위해서는, 일반 교착 상태 검출과 달리 모든 트랜잭션을 검사하는 것이 아니라, 쓰래드를 요청한 트랜잭션이 관련된 싸이클만을 검사하면 된다.A threaded deadlock is caused by the transaction requesting the thread and the transaction requesting the lock it occupies. Therefore, to detect a threaded deadlock, it is not necessary to check every transaction, unlike general deadlock detection, but only a cycle related to a transaction requesting a thread.

일반 교착 상태 검출 및 해결 기법에서는 교착 상태가 검출되면 교착상태에 참여하는 한 트랜잭션을 희생자로 선정하고 철회시켜야 하는데 반하여, 제안된 기법에서는 참여 트랜잭션을 철회하는 것이 아니라, 참여한 트랜잭션이 점유하고 있는 쓰래드를 재배치함으로써 쓰래드 복합 교착상태를 해결한다. 쓰래드를 요청하는 트랜잭션을 Tr이라 하고 Tr이 점유하고 있는 로크를 요청하는 트랜잭션을 Tw라 하면 Tw가 점유하고 있는 쓰래드를 Tr로 재배치한다.In the general deadlock detection and resolution technique, if a deadlock is detected, one transaction that participates in the deadlock must be selected as a victim and withdrawn, whereas the proposed technique does not retract the participating transaction, but rather the thread occupied by the participating transaction. Relocation resolves threaded composite deadlocks. A transaction requesting a thread is called T r , and a transaction requesting a lock occupied by T r is T w . The thread occupied by T w is relocated to T r .

도 4 는 본 발명에 따른 쓰래드 복합 교착상태의 검출 및 해결 방법중 쓰래드 복합 교착 상태를 피하기 위한 쓰래드 할당 및 재배치 과정에 대한 일실시예 흐름도이다.4 is a flowchart illustrating a thread allocation and relocation process for avoiding a threaded composite deadlock in a method for detecting and resolving a threaded deadlock according to the present invention.

도 4에 도시된 바와 같이, 본 발명에 따른 쓰래드 복합 교착 상태를 피하기 위한 쓰래드 할당 및 재배치 과정은, 먼저 큐에서 임의의 트랜잭션 Tr의 한 액션을 가져온다(401). 이때, 현재 가용한 쓰래드가 있는지를 검사한다(402).As shown in FIG. 4, the thread allocation and relocation process to avoid thread compound deadlocks in accordance with the present invention first results in an action of any transaction T r in the queue (401). At this time, it is checked whether there is a thread currently available (402).

검사 결과, 가져온 액션을 처리할 가용한 쓰래드가 있으면, 가용한 쓰래드를 트랜잭션 Tr에 할당한다(403).As a result of the check, if there are available threads to process the imported action, the available threads are allocated to transaction T r (403).

검사 결과, 가용한 쓰래드가 없으면, 쓰래드를 요청하는 트랜잭션 Tr이 점유한 로크를 요청중인 활성화(ACTIVE) 상태의 트랜잭션 Tw가 있는지를 분석한다(404).As a result of the check, if there is no thread available, it is analyzed whether there is an active transaction T w requesting the lock occupied by the transaction T r requesting the thread (404).

분석 결과, 쓰래드를 요청하는 트랜잭션 Tr이 점유한 로크를 요청중인 활성(ACTIVE) 상태의 트랜잭션 Tw가 없으면, 해당 액션을 큐에 다시 추가한 후에(405) 큐에서 임의의 트랜잭션 Tr의 한 액션을 가져오는 단계(401)로 넘어간다.If the analysis reveals that there is no active transaction T w requesting the lock occupied by the transaction Tr requesting the thread, the action is added back to the queue (405) and then one action of any transaction T r in the queue. Proceed to step 401 to obtain.

분석 결과, 쓰래드를 요청하는 트랜잭션 Tr이 점유한 로크를 요청중인 활성화(ACTIVE) 상태의 트랜잭션 Tw가 있으면, 대기중인 Tw의 상태를 비활성화(UNACTIVE) 상태로 지정하고 쓰래드를 반환한다(406). 이후에, 반환받은 쓰래드를 트랜잭션 Tr에 할당하고(407), 트랜잭션 Tr의 waitingThreadList에 Tw를 추가한다(408).As a result of analysis, if there is an active transaction T w requesting the lock occupied by the transaction requesting thread r r , the state of waiting T w is set as UNACTIVE and the thread is returned (406). ). Thereafter, the returned thread is allocated to transaction T r (407), and T w is added to the waitingThreadList of transaction T r (408).

트랜잭션 Tw의 대기 상태는 트랜잭션 Tr이 종료될 때까지 지속되어야 하므로 이러한 쓰래드의 재배치로 인하여 트랜잭션 Tw의 액션의 처리상 아무 문제도 발생하지 않는다. 단지, 트랜잭션 Tr이 종료된 다음에는 트랜잭션 Tw의 액션을 계속해서 처리할 수 있도록 다시 쓰래드를 재배치해 주어야 한다. 또한, 임의의 트랜잭션의 한 액션에 대해 쓰래드를 할당하고 그 액션을 처리하고 나면 다시 쓰래드를 반환하기 때문에 한 트랜잭션의 여러 액션들의 처리를 위해 여러 번의 쓰래드 재배치가 수행될 수 있다. 즉, 한 트랜잭션이 종료될 때 여러 트랜잭션이 그 수행을 계속할 수 있도록 재배치가 이루어져야 한다.Since the wait state of transaction T w must persist until transaction T r terminates, this thread relocation does not cause any problem in the processing of transaction T w 's action. However, after transaction T r terminates, the thread must be redeployed to continue processing transaction T w 's actions. In addition, since a thread is assigned to an action of an arbitrary transaction and the action is processed, the thread is returned again, so that multiple thread relocations can be performed to process multiple actions of a transaction. In other words, when a transaction ends, it must be relocated so that multiple transactions can continue to execute it.

도 5 는 본 발명에 따른 쓰래드 복합 교착상태의 검출 및 해결 방법중 쓰래드 복합 교착 상태를 피하기 위한 쓰래드 반환 및 재배치 과정에 대한 일실시예 흐름도이다.5 is a flowchart illustrating a thread return and relocation process for avoiding a threaded composite deadlock in a method for detecting and resolving a threaded deadlock according to the present invention.

도 5에 도시된 바와 같이, 본 발명에 따른 쓰래드 복합 교착 상태를 피하기 위한 쓰래드 반환 및 재배치 과정은, 먼저 Tr이 종료되었고 Tr의 'waitingThreadList'가 비어있는지를 확인한다(501).As shown in FIG. 5, the thread return and relocation process for avoiding a threaded deadlock according to the present invention first checks whether T r is terminated and 'waitingThreadList' of T r is empty (501).

확인 결과, Tr이 종료되었고 Tr의 waitingThreadList가 비어있지 않으면, 트랜잭션 Tr의 waitingThreadList에 있는 트랜잭션 Tw들에 대해 Tw의 상태를 활성화(ACTIVE) 상태로 지정하고, 가용한 쓰래드를 Tw에 할당하여 남은 액션을 수행하게 한다(502). 그리고, 트랜잭션 Tr이 점유한 쓰래드를 반환한다(503). 여기서, 가용한 쓰래드를 할당하기 위해서는 상기 도 4의 기술한 쓰래드 할당 및 재배치 과정을 거쳐야 한다.If T r is terminated and waitingThreadList of T r is not empty, then the status of T w is set to ACTIVE for transaction T w in waitingThreadList of transaction T r , and the available thread is T w. In operation 502, the remaining actions are assigned to the control unit. Then, the thread occupied by the transaction T r is returned (503). In order to allocate an available thread, the thread allocation and relocation process described with reference to FIG. 4 is required.

확인 결과, Tr이 종료되었고 Tr의 waitingThreadList가 비어있으면, 트랜잭션 Tr이 점유한 쓰래드를 반환한다(503).Check result, if T r was the end of the waitingThreadList T r is empty, return the thread is occupied by the transaction T r 503.

상기한 바와 같은 본 발명에 따르면, 기존의 교착 상태 검출 및 해결 알고리즘에 비해 다음과 같은 장점을 가진다.According to the present invention as described above, has the following advantages over the existing deadlock detection and resolution algorithm.

첫째, 제안된 기법에서는 기존의 기법과 같이 희생자 트랜잭션을 철회하지 않고 희생자 트랜잭션의 쓰래드만을 쓰래드를 요청한 트랜잭션에 재배치하고 다시 이 트랜잭션이 종료하면 희생자 트랜잭션에 쓰래드를 재배치하기 때문에 트랜잭션의 철회를 줄여 시스템의 성능을 향상시킬 수 있다.First, in the proposed scheme, the thread of the victim transaction is relocated to the transaction that requested the thread, and the thread is relocated to the victim transaction when the transaction is terminated. It can improve performance.

둘째, 쓰래드 복합 교착상태를 검출하기 위해 대기 그래프 전체에서 사이클의 존재 여부를 검토하지 않고 현재 쓰래드를 요구하는 트랜잭션이 점유한 로크를 요청하는 트랜잭션을 하나만 발견하면 되기 때문에 쓰래드 복합 교착 상태의 검출 알고리즘의 성능이 기존의 교착 상태 검출 알고리즘에 비해 월등히 뛰어나다. 이러한 발명은 쓰래드 풀을 사용할 경우에만 국한되는 것이 아니라, 쓰래드 풀대신 프로세스 풀나 프로세서 풀를 사용하는 경우에도 그대로 적용될 수 있다.상술한 바와 같은 본 발명의 방법은 프로그램으로 구현되어 컴퓨터로 읽을 수 있는 기록매체(씨디롬, 램, 롬, 플로피 디스크, 하드 디스크, 광자기 디스크 등)에 저장될 수 있다.Second, we do not examine the existence of a cycle in the wait graph to detect a threaded deadlock, so we only need to find one transaction requesting the lock occupied by the transaction that requires the current thread. The performance is much better than the existing deadlock detection algorithm. This invention is not limited to the use of thread pools, but may be applied to process pools or processor pools instead of thread pools. The method of the present invention as described above is implemented as a program and can be read by a computer. (CD-ROM, RAM, ROM, floppy disk, hard disk, magneto-optical disk, etc.).

이상에서 설명한 본 발명은, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에 있어 본 발명의 기술적 사상을 벗어나지 않는 범위내에서 여러 가지 치환, 변형 및 변경이 가능하므로 전술한 실시예 및 첨부된 도면에 한정되는 것이 아니다.The present invention described above is capable of various substitutions, modifications, and changes without departing from the spirit of the present invention for those skilled in the art to which the present invention pertains, and the above-described embodiments and accompanying It is not limited to the drawing.

상기한 바와 같은 본 발명은, 쓰래드 풀을 기반으로 한 트랜잭션 처리시스템에서 발생할 수 있는 쓰래드가 복합된 복합 교착상태를 효과적으로 검출하고 트랜잭션의 철회없이 이를 해결함으로써 전체 시스템의 성능을 향상시킬 수 있는 효과가 있다.As described above, the present invention has an effect of effectively detecting a complex deadlock in which a thread may occur in a transaction processing system based on a thread pool, and improving the performance of the entire system by resolving the transaction without retraction. have.

Claims (5)

삭제delete 쓰래드(Thread) 풀을 기반으로 하고 있는 트랜잭션 처리시스템에서 트랜잭션의 액션 단위로 쓰래드를 할당할 때 발생하는 로크와 쓰래드가 복합된 교착상태(Deadlock)를 검출하고 이를 해결하는 방법에 있어서,In a method of detecting and solving a deadlock in which a lock and a thread are generated when allocating a thread as an action unit of a transaction in a transaction processing system based on a thread pool, 로크를 기다리는 트랜잭션과 쓰래드를 요청하는 트랜잭션간의 복합된 교착상태를 검사하기 위하여, 쓰래드를 요청한 트랜잭션이 점유하고 있는 로크를 요청하는 트랜잭션간의 사이클만을 조사하는 제 1 단계;A first step of examining only a cycle between a transaction requesting a lock occupied by a transaction requesting a thread to examine a complex deadlock between the transaction waiting for the lock and the transaction requesting the thread; 쓰래드를 요청하는 트랜잭션에 대해 상기 쓰래드를 요청하는 트랜잭션이 점유하고 있는 로크를 요청하는 다른 트랜잭션이 현재 점유하고 있는 쓰래드를 재배치하는 제 2 단계; 및Relocating a thread that is currently occupied by another transaction requesting a lock occupied by the thread requesting transaction for the thread requesting a thread; And 상기 쓰래드를 요청하는 트랜잭션의 완료 후, 재배치를 당했던 트랜잭션에 대해 쓰래드를 재할당하는 제 3 단계A third step of reallocating threads for transactions that have been relocated after completion of the transaction requesting the threads; 를 포함하는 쓰래드 풀을 기반으로 한 트랜잭션 처리시스템에서 쓰래드 복합 교착상태의 검출 및 해결 방법.A method for detecting and resolving threaded deadlocks in a transaction processing system based on a thread pool that includes a. 제 2 항에 있어서,The method of claim 2, 상기 교착상태(Deadlock)를 검출하고 이를 해결하는 방법은,The method for detecting and solving the deadlock (Deadlock), 상기 쓰래드외에, 프로세스(Process)와 프로세서(Processor)에 대해서도 동일하게 적용되는 것을 특징으로 하는 쓰래드 풀을 기반으로 한 트랜잭션 처리시스템에서 쓰래드 복합 교착상태의 검출 및 해결 방법.In addition to the above threads, a method of detecting and resolving a thread complex deadlock in a thread processing transaction processing system based on a thread pool, characterized in that the same applies to a process and a processor. 삭제delete 프로세서를 구비한 트랜잭션 처리시스템에,In a transaction processing system having a processor, 로크를 기다리는 트랜잭션과 쓰래드를 요청하는 트랜잭션간의 복합된 교착상태를 검사하기 위하여, 쓰래드를 요청한 트랜잭션이 점유하고 있는 로크를 요청하는 트랜잭션간의 사이클만을 조사하는 제 1 기능;A first function of examining only cycles between transactions requesting a lock occupied by a transaction requesting a thread to check for a complex deadlock between the transaction waiting for the lock and the transaction requesting the thread; 쓰래드를 요청하는 트랜잭션에 대해 상기 쓰래드를 요청하는 트랜잭션이 점유하고 있는 로크를 요청하는 다른 트랜잭션이 현재 점유하고 있는 쓰래드를 재배치하는 제 2 기능; 및A second function for relocating a thread currently occupied by another transaction requesting a lock occupied by the transaction requesting the thread for a transaction requesting the thread; And 상기 쓰래드를 요청하는 트랜잭션의 완료 후, 재배치를 당했던 트랜잭션에 대해 쓰래드를 재할당하는 제 3 기능A third function of reallocating threads for transactions that have been relocated after completion of the transaction requesting the threads 을 실현시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록매체.A computer-readable recording medium having recorded thereon a program for realizing this.
KR1019990061219A 1999-12-23 1999-12-23 Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system KR100319763B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1019990061219A KR100319763B1 (en) 1999-12-23 1999-12-23 Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1019990061219A KR100319763B1 (en) 1999-12-23 1999-12-23 Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system

Publications (2)

Publication Number Publication Date
KR20010057809A KR20010057809A (en) 2001-07-05
KR100319763B1 true KR100319763B1 (en) 2002-01-05

Family

ID=19628867

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1019990061219A KR100319763B1 (en) 1999-12-23 1999-12-23 Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system

Country Status (1)

Country Link
KR (1) KR100319763B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100667700B1 (en) 2004-12-02 2007-01-12 한국전자통신연구원 Terminal of portable internet system and method of transmitting uplink data in terminal

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH05233414A (en) * 1992-02-18 1993-09-10 Toshiba Corp Deadlock detecting system
US5377351A (en) * 1990-06-20 1994-12-27 Oki Electric Industry Co., Ltd. Device for controlling multiple transactions contending concurrently for the same resource in a distributed database system
JPH07175764A (en) * 1993-12-20 1995-07-14 Nec Corp Deadlock avoidance system in distributed system
JPH08263352A (en) * 1994-12-07 1996-10-11 Stc Internatl Computers Ltd Deadlock detection mechanism
JPH10283243A (en) * 1997-02-05 1998-10-23 Fuji Xerox Co Ltd Data base management system
US5940828A (en) * 1997-11-18 1999-08-17 International Business Machines Corporation Locking contention resolution for shared resources

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5377351A (en) * 1990-06-20 1994-12-27 Oki Electric Industry Co., Ltd. Device for controlling multiple transactions contending concurrently for the same resource in a distributed database system
JPH05233414A (en) * 1992-02-18 1993-09-10 Toshiba Corp Deadlock detecting system
JPH07175764A (en) * 1993-12-20 1995-07-14 Nec Corp Deadlock avoidance system in distributed system
JPH08263352A (en) * 1994-12-07 1996-10-11 Stc Internatl Computers Ltd Deadlock detection mechanism
JPH10283243A (en) * 1997-02-05 1998-10-23 Fuji Xerox Co Ltd Data base management system
US5940828A (en) * 1997-11-18 1999-08-17 International Business Machines Corporation Locking contention resolution for shared resources

Also Published As

Publication number Publication date
KR20010057809A (en) 2001-07-05

Similar Documents

Publication Publication Date Title
US8209692B2 (en) Deallocation of computer data in a multithreaded computer
US5872981A (en) Method for managing termination of a lock-holding process using a waiting lock
US6041384A (en) Method for managing shared resources in a multiprocessing computer system
US8881153B2 (en) Speculative thread execution with hardware transactional memory
EP0783150B1 (en) System, method, storage medium and computer-readable modules for space efficient object locking
US8438571B2 (en) Thread speculative execution and asynchronous conflict
US8473969B2 (en) Method and system for speeding up mutual exclusion
US20080209422A1 (en) Deadlock avoidance mechanism in multi-threaded applications
US7185339B2 (en) Victim selection for deadlock detection
US20150052529A1 (en) Efficient task scheduling using a locking mechanism
US6842809B2 (en) Apparatus, method and computer program product for converting simple locks in a multiprocessor system
Zhang et al. Scalable adaptive NUMA-aware lock
KR100319763B1 (en) Method of detection and resolution thread-combined-deadlock in a thread pool based transaction processing system
US8793464B2 (en) Memory management in multi-threaded multi-processor computing system
Devor et al. Structural locking mechanisms and their effect on database management system performance
KR100317229B1 (en) Mutual Exclusion of Locked Standby Information for Deadlock Detection
Kaspi et al. Performance analysis of concurrency control mechanisms for OLTP databases
JP3320320B2 (en) A buffer management method using a buffer lock technique in a multi-user environment storage system
KR100253627B1 (en) Transaction control method not to be selected as deadlock sacrificer in transaction abortion in a data storage system
WO2022001629A1 (en) Database system, and method and apparatus for managing transactions
KR100570731B1 (en) An Enhanced Second Chance Method for Selecting a Victim Buffer Page in a Multi-User Storage System
Depoutovitch et al. Taurus MM: Bringing Multi-Master to the Cloud
KR0139724B1 (en) How to Detect and Process Zombie Transactions in a DBMS on Unix Environments
Kaieda et al. Analysis and measurement of the effect of kernel locks in SMP systems
JP2001256065A (en) Exclusive control method and computer system

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20091113

Year of fee payment: 9

LAPS Lapse due to unpaid annual fee