KR20070082620A - Timer and method of managing timer event - Google Patents

Timer and method of managing timer event Download PDF

Info

Publication number
KR20070082620A
KR20070082620A KR1020060015433A KR20060015433A KR20070082620A KR 20070082620 A KR20070082620 A KR 20070082620A KR 1020060015433 A KR1020060015433 A KR 1020060015433A KR 20060015433 A KR20060015433 A KR 20060015433A KR 20070082620 A KR20070082620 A KR 20070082620A
Authority
KR
South Korea
Prior art keywords
timer
timer event
event
expiration time
pool
Prior art date
Application number
KR1020060015433A
Other languages
Korean (ko)
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 KR1020060015433A priority Critical patent/KR20070082620A/en
Publication of KR20070082620A publication Critical patent/KR20070082620A/en

Links

Images

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/22Microcontrol or microprogram arrangements
    • G06F9/26Address formation of the next micro-instruction ; Microprogram storage or retrieval arrangements
    • G06F9/262Arrangements for next microinstruction selection
    • G06F9/264Microinstruction selection based on results of processing

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

A timer and an event processing method thereof are provided to generate a reliable timer event to an application process requesting registration of the timer event by causing no performance degradation while accepting the registration of lots of timer events. A timer event registration message receiver(110) receives a message for requesting the registration of the timer event from the application process(10). A free pool(130) is a memory space secured to assign the timer event. An active pool(140) is the memory area for storing the timer event by being assigned from the free pool. A timer event expiration calculator(150) calculates expiration of the timer events stored in the active pool. A timer event notification message transmitter(120) transmits the message for notifying the application process of the timer event on the expiration of the timer event stored in the active pool. If the memory space is not found in the free pool, the new memory space is assigned to the free pool and the memory space corresponding to the expired timer event is collected to the free pool.

Description

타이머 및 타이머 이벤트 처리 방법{Timer and Method of managing timer event} Timer and method of managing timer event

도 1은 본 발명의 일 실시예에 따른 타이머의 블록도이다. 1 is a block diagram of a timer according to an embodiment of the present invention.

도 2는 본 발명의 일 실시예에 따른 타이머 프로세스의 흐름도를 나타낸 것이다. 2 shows a flow diagram of a timer process according to one embodiment of the invention.

도 3은 본 발명의 일 실시예에 따른 타이머의 액티브 풀로 타이머 이벤트가 삽입되는 과정을 나타내는 순서도이다. 3 is a flowchart illustrating a process of inserting a timer event into an active pool of timers according to an embodiment of the present invention.

도 4는 본 발명에 따른 일 실시예로, 타이머 이벤트 A가 삽입되기 전후의 액티브 풀을 도시한 것이다. 4 illustrates an active pool before and after the insertion of a timer event A according to an embodiment of the present invention.

본 발명은 타이머에 관한 것으로, 보다 상세하게는 대용량의 타이머 이벤트를 처리할 수 있는 타이머 및 타이머 이벤트 처리 방법에 관한 것이다. The present invention relates to a timer, and more particularly, to a timer and a timer event processing method capable of processing a large number of timer events.

일반적으로 UNIX OS는 시분할 제어를 채택하고 있어, 동시에 다수의 사용자를 위한 멀티 태스킹이 지원된다. 일반적인 이동 통신 운용 서버는 UNIX 환경에서 구동되는 시스템으로 운용자가 시스템의 상태 및 성능을 확인하기 위하여 감시 기 능을 수행하거나, 주기적으로 통계 처리를 수행하거나, 이동 통신 가입자에게 서비스를 제공하는 등 다수의 작업이 동시에 수행된다. In general, UNIX operating systems adopt time-sharing control, which supports multitasking for multiple users at the same time. The general mobile communication operation server is a system running in a UNIX environment. The operator performs a monitoring function to check the status and performance of the system, periodically performs statistical processing, or provides a service to a mobile subscriber. The work is carried out simultaneously.

상기의 기능들이 어느 특정 시각에 또는 주기적으로 수행될 수 있도록, 상기의 기능들을 수행하는 프로세스들은 타이머를 필요로 하는데, 이동 통신 가입자가 수천만에 달하고 있으며, 다양한 컨텐츠의 개발로 서비스의 종류도 다양해짐에 따라, 프로세스의 개수가 증가하고, 이에 따라 프로세스가 필요로 하는 타이머의 수가 증가되었다. In order to perform the above functions at any particular time or periodically, processes that perform the above functions require timers, which have reached tens of millions of mobile subscribers, and various types of services have been developed due to the development of various contents. As the number of processes increases, the number of timers required by the process increases.

UNIX 환경 뿐만 아니라, 거의 모든 시스템에서 다수의 프로세스가 동시에 수행되는 것이 일반화되면서, 각각의 프로세스들이 타이머가 필요할 때마다, 타이머 프로세스를 생성하는 기존의 방법은, 다수의 프로세스가 실행되는 시스템에 엄청난 부하를 가져올 수 있다. 이 문제를 해결하기 위하여, 다수의 프로세스로부터 필요로 하는 타이머를 일률적으로 등록하고 관리하는 타이머 프로세스가 등장하였다. As it is common for many processes to run concurrently on almost all systems, as well as UNIX environments, the traditional method of creating a timer process whenever each process needs a timer is a tremendous load on a system that runs multiple processes. Can be imported. To solve this problem, a timer process has emerged which uniformly registers and manages timers needed from multiple processes.

그러나 기존의 타이머 프로세스는 등록될 수 있는 타이머 이벤트가 제한되어 있으며, 타이머 이벤트가 등록될 때마다 동적으로 메모리가 할당되고, 각각의 타이머 이벤트의 만료 시각을 일일이 검사한다. However, existing timer processes have a limited number of timer events that can be registered, and memory is dynamically allocated every time a timer event is registered, and the expiration time of each timer event is checked.

따라서, 프로세스로부터 요구되는 타이머 이벤트가 상당히 많아지면, 기존의 타이머 프로세스에 타이머 이벤트를 등록할 수 없을 뿐만 아니라, 등록되더라도 다수의 타이머 이벤트가 등록된 타이머 프로세스의 성능이 저하되어 타이머 이벤트를 정상적으로 처리할 수 없는 상황에 이르게 된다. Therefore, if the number of timer events required from the process is considerably increased, not only can the timer event be registered in the existing timer process, but even if it is registered, the performance of the timer process in which a plurality of timer events are registered is degraded and the timer event can be processed normally. It leads to an impossible situation.

본 발명이 이루고자 하는 기술적 과제는 다수의 타이머 이벤트의 등록을 수용하면서도 성능 저하가 없는 대용량 타이머 및 타이머 이벤트 처리 방법을 제공하는데 있다. The technical problem to be achieved by the present invention is to provide a large-scale timer and timer event processing method without the performance degradation while accepting the registration of a plurality of timer events.

상기와 같은 기술적 과제를 달성하기 위한 본 발명의 바람직한 일 면에 따른 타이머는, 응용 프로세스로부터 타이머 이벤트의 등록을 요청하는 메시지를 수신하는 타이머 이벤트 등록 메시지 수신부, 타이머 이벤트를 할당하기 위하여 미리 확보된 메모리 영역인 프리 풀(free pool), 상기 프리 풀로부터 할당되어 상기 타이머 이벤트가 저장되는 메모리 영역인 액티브 풀(active pool), 상기 액티브 풀에 저장된 타이머 이벤트들 의 만료 시각을 계산하는 타이머 이벤트 만료 시각 계산부 및 상기 액티브 풀에 저장된 상기 타이머 이벤트의 만료 시각이 경과하면, 상기 타이머 이벤트를 요청한 상기 응용 프로세스로 상기 타이머 이벤트를 통보하는 메시지를 송신하는 타이머 이벤트 통보 메시지 송신부를 포함한다. Timer according to a preferred aspect of the present invention for achieving the above technical problem, the timer event registration message receiving unit for receiving a message requesting the registration of the timer event from the application process, the memory secured in advance to allocate the timer event Calculation of a timer event expiration time for calculating an expiration time of a free pool which is an area, an active pool which is allocated from the free pool, and a memory area in which the timer event is stored, and timer events stored in the active pool. And a timer event notification message transmitter configured to transmit a message for notifying the timer event to the application process that has requested the timer event when an expiration time of the timer event stored in the active pool has elapsed.

상기와 같은 기술적 과제를 달성하기 위한 본 발명의 바람직한 다른 일 면에 따른 타이머는, 응용 프로세스로부터 타이머 이벤트의 등록을 요청하는 메시지를 수신하는 타이머 이벤트 등록 메시지 수신부, 상기 타이머 이벤트를 다른 타이머 이벤트들과 비교하여, 만료 시각이 빠른 순으로 정렬되어 저장되는 메모리 영역인 액티브 풀(active pool), 상기 액티브 풀에 저장된 타이머 이벤트들의 만료 시각을 계산하는 타이머 이벤트 만료 시각 계산부, 및 상기 타이머 이벤트의 만료 시각에 상기 응용 프로세스로 상기 타이머 이벤트를 통보하는 메시지를 송신하는 타이머 이벤트 통보 메시지 송신부를 구비한다. According to another aspect of the present invention for achieving the above technical problem, a timer, a timer event registration message receiving unit for receiving a message requesting registration of a timer event from an application process, the timer event and other timer events In comparison, an active pool, which is a memory area in which the expiration time is sorted in order of rapidity, is stored, a timer event expiration time calculator for calculating expiration time of timer events stored in the active pool, and an expiration time of the timer event. And a timer event notification message transmitter for transmitting a message for notifying the timer event to the application process.

상기 액티브 풀의 타이머 이벤트들은 각각의 타이머 이벤트 만료 시각과 각각의 타이머 이벤트 바로 전에 발생될 타이머 이벤트의 만료 시각과의 차이인 소정의 시간을 포함하여 만료시각 순으로 정렬되는 것이 바람직하다. 상기와 같은 기술적 과제를 달성하기 위한 본 발명의 타이머 이벤트 처리 방법은 응용 프로세스로부터 타이머 이벤트 등록을 요청하는 메시지가 수신되면, 미리 확보된 메모리 영역인 프리 풀로부터 상기 타이머 이벤트를 위한 메모리가 할당되는 단계, 상기 타이머 이벤트를 다른 타이머 이벤트들과 비교하여, 만료 시각이 빠른 순으로 정렬되도록 액티브 풀에 삽입하는 단계, 상기 액티브 풀에 정렬되어 저장된 타이머 이벤트들의 만료 시각을 계산하는 단계 및 상기 타이머 이벤트의 만료 시각이 경과되면 상기 응용 프로세스로 상기 타이머 이벤트를 통보하는 메시지를 송신하는 단계를 구비한다. The timer events of the active pool are preferably arranged in the order of expiration time, including a predetermined time which is a difference between the expiration time of each timer event expiration time and the timer event to be generated immediately before each timer event. In the timer event processing method of the present invention for achieving the above technical problem, when a message for requesting timer event registration is received from an application process, the step of allocating a memory for the timer event from a free pool which is a reserved memory area; Comparing the timer event with other timer events, inserting the expiration time into the active pool so that the expiration time is arranged in ascending order, calculating an expiration time of the timer events arranged and stored in the active pool, and expiration of the timer event. And sending a message notifying the timer event to the application process when the time elapses.

본 발명과 본 발명의 동작상의 이점 및 본 발명의 실시에 의하여 달성되는 목적을 충분히 이해하기 위해서는 본 발명의 바람직한 실시 예를 예시하는 첨부 도면 및 첨부 도면에 기재된 내용을 참조하여야만 한다. In order to fully understand the present invention, the operational advantages of the present invention, and the objects achieved by the practice of the present invention, reference should be made to the accompanying drawings which illustrate preferred embodiments of the present invention and the contents described in the accompanying drawings.

이하, 첨부한 도면을 참조하여 본 발명의 바람직한 실시예를 설명함으로써, 본 발명을 상세히 설명한다. 각 도면에 제시된 동일한 참조부호는 동일한 부재를 나타낸다. Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. Like reference numerals in the drawings denote like elements.

도 1은 본 발명의 일 실시예에 따른 타이머의 블록도이다. 1 is a block diagram of a timer according to an embodiment of the present invention.

도 1을 참조하면, 본 발명의 일 실시예에 따른 타이머(100)는 타이머 이벤트 등록 메시지 수신부(110), 타이머 이벤트 통보 메세지 송신부(120), 프리 풀(130), 액티브 풀(140) 및 타이머 이벤트 만료 시각 계산부(150)를 구비한다. Referring to FIG. 1, the timer 100 according to an embodiment of the present invention may include a timer event registration message receiver 110, a timer event notification message transmitter 120, a free pool 130, an active pool 140, and a timer. The event expiration time calculation unit 150 is provided.

타이머 이벤트 등록 메시지 수신부(110)는 다수의 프로세스가 수행되는 응용 프로그램(10)의 소정의 프로세스로부터 타이머 이벤트 등록을 요청하는 메시지를 수신한다. 타이머 이벤트 등록 메시지 수신부(110)는 응용 프로그램(10)의 프로세스들 외에, 다른 응용 프로그램들의 다수의 프로세스들로부터 타이머 이벤트 등록을 요청하는 메시지를 수신할 수 있다. The timer event registration message receiving unit 110 receives a message for requesting timer event registration from a predetermined process of the application program 10 in which a plurality of processes are performed. The timer event registration message receiving unit 110 may receive a message for requesting timer event registration from a plurality of processes of other application programs, in addition to the processes of the application program 10.

상기 다수의 프로세스에는 서비스 프로세스, 운용 프로세스 및 통계 프로세스 등 다양한 프로세스가 포함될 수 있다.The plurality of processes may include various processes such as a service process, an operation process, and a statistical process.

프리 풀(130)은 타이머 프로세스가 기동할 때, 발생될 타이머 이벤트들을 저장하기 위하여 미리 확보된 메모리 영역이다. 즉, 프리 풀(130)은 예비 타이머 이벤트 저장소이다. 타이머 이벤트 등록 메시지 수신부(110)는 타이머 이벤트 등록 요청 메시지를 수신하면, 프리 풀(130)에 이미 할당되어 있는 예비 타이머 이벤트를, 후술하는 액티브 풀(140)에 등록한다. 액티브 풀(140)은 프리 풀(130)로부터 메모리가 할당된 타이머 이벤트들이 저장되는 메모리 영역이다. 즉, 액티블 풀(140)은 등록된 타이머 이벤트들의 저장소이다.The free pool 130 is a memory area reserved in advance for storing timer events to be generated when the timer process is started. That is, the free pool 130 is a reserve timer event store. When the timer event registration message receiving unit 110 receives the timer event registration request message, the timer event registration message receiving unit 110 registers a preliminary timer event already allocated to the free pool 130 to the active pool 140 described later. The active pool 140 is a memory area in which timer events allocated with memory from the free pool 130 are stored. In other words, the active pool 140 is a store of registered timer events.

타이머 이벤트는 지정된 시각에만 타이머 이벤트를 발생하는 앳(At) 타이머 이벤트와 주기적으로 타이머 이벤트를 발생하는 이터러티브(Iterative) 타이머 이벤트로 분류되고, 각각의 타이머 이벤트를 저장하는 액티브 풀(140)을 따로 구현할 수 있으나, 이에 한정되는 것은 아니다.The timer event is classified into an At timer event that generates a timer event only at a designated time and an iterative timer event that periodically generates a timer event, and includes an active pool 140 that stores each timer event. It may be implemented separately, but is not limited thereto.

액티브 풀(140)에 저장된 타이머 이벤트들은 타이머 이벤트 만료시각 순으로 정렬된다. 좀 더 구체적으로는, 액티브 풀(140)에 새로운 타이머 이벤트가 등록될 때, 새로운 타이머 이벤트와 다른 타이머 이벤트들(기 등록된 타이머 이벤트들) 각각의 만료시각을 비교하여, 만료시각이 빠른 순으로 정렬되고, 그 순서에 따른 위치에 새로운 타이머 이벤트가 삽입되는 것이 바람직하다. 더구나, 각각의 타이머 이벤트 만료 시각과 각각의 타이머 이벤트 바로 전에 발생될 타이머 이벤트의 만료 시각과의 차이인 소정의 시간을 포함하며, 만료 시각이 빠른 순으로 정렬될 수 있다. The timer events stored in the active pool 140 are arranged in order of timer event expiry time. More specifically, when a new timer event is registered in the active pool 140, the expiration time is compared in order of expiration time of the new timer event and the expiration time of each of the other timer events (pre-registered timer events). It is desirable that new timer events be inserted at a position that is aligned and in that order. Moreover, the timer may include a predetermined time that is a difference between the expiration time of each timer event and the expiration time of the timer event to be generated immediately before each timer event, and the expiration times may be sorted in ascending order.

타이머 이벤트 만료 시각 계산부(150)는 액티브 풀(140)의 타이머 이벤트들의 만료시각을 계산한다. 액티브 풀(140)의 타이머 이벤트들이 각각의 타이머 이벤트 만료 시각과 각각의 타이머 이벤트 바로 전에 발생될 타이머 이벤트의 만료 시각과의 차이인 소정의 시간을 포함하며, 만료 시각이 빠른 순으로 정렬된 경우에는, 첫 번째 타이머 이벤트의 만료 시각만을 계산한다. The timer event expiration time calculator 150 calculates expiration times of timer events of the active pool 140. The timer events of the active pool 140 include a predetermined time that is a difference between each timer event expiration time and the expiration time of the timer event to be generated immediately before each timer event, and when the expiration times are arranged in ascending order. Only the expiry time of the first timer event is calculated.

타이머 이벤트 통보 메시지 송신부(120)는 타이머 이벤트 만료 시각 계산부(150)의 만료시각 계산에 기초하여, 타이머 이벤트의 만료 시각이 경과되면, 상기 응용 프로그램(10)의 상기 소정의 프로세스로 타이머 이벤트를 통보한다. The timer event notification message transmitter 120 transmits a timer event to the predetermined process of the application program 10 when the expiration time of the timer event has elapsed, based on the expiration time calculation of the timer event expiration time calculator 150. Notify.

만료 시각이 경과되면, 특정 시각에만 타이머 이벤트를 발생시키는 앳 타이머 이벤트에 대해서는, 종료된 타이머 이벤트의 메모리가 프리 풀(130)로 회수된다. 그리고 주기적으로 타이머 이벤트를 발생시키는 이터러티브 타이머 이벤트에 대해서는, 타이머 이벤트 발생 횟수를 검사하여, 종료된 타이머 이벤트의 메모리는 프리 풀(130)로 회수되고, 더 반복해야 하는 타이머 이벤트는 상기 소정의 시간을 포함시켜 액티브 풀(140)의 소정의 위치로 삽입된다.When the expiration time elapses, the memory of the terminated timer event is recovered to the free pool 130 for the at timer event that generates the timer event only at a specific time. For an iterative timer event that periodically generates a timer event, the number of timer event occurrences is examined, and the memory of the terminated timer event is recovered to the free pool 130, and the timer event that should be repeated further is The time is inserted into the predetermined position of the active pool 140.

도 2는 타이머 프로세스의 흐름도를 나타낸 것이다. 2 shows a flow chart of a timer process.

도 1과 도 2를 참조하면, 타이머 프로세스로부터 타이머 이벤트가 등록되고 처리되는 과정은, 먼저, 응용 프로그램(10)의 소정의 프로세스로부터 타이머 이벤트 등록 메시지 수신부(110)로 타이머 이벤트 등록을 요청하는 메시지가 수신된다(S210). 1 and 2, a process of registering and processing a timer event from a timer process includes, first, a message for requesting timer event registration from the predetermined process of the application program 10 to the timer event registration message receiving unit 110. Is received (S210).

타이머 이벤트 등록을 요청하는 메시지가 수신되면, 타이머 이벤트 등록 메시지 수신부(110)는 프리 풀(130)로 상기 타이머 이벤트를 저장(등록)하기 위한 메모리를 요청한다(S220). When a message for requesting timer event registration is received, the timer event registration message receiving unit 110 requests a memory for storing (registering) the timer event to the free pool 130 (S220).

S220 단계로부터 상기 타이머 이벤트를 저장하기 위한 메모리가 할당되면, 상기 타이머 이벤트는 액티브 풀(140)에 저장된 다른 타이머 이벤트들과 비교하여 만료 시각이 빠른 순으로 정렬되도록 액티브 풀(140)로 삽입된다(S230). When the memory for storing the timer event is allocated from step S220, the timer event is inserted into the active pool 140 so that the expiration time is sorted in ascending order in comparison with other timer events stored in the active pool 140 ( S230).

액티브 풀(140)에 정렬되어 저장된 타이머 이벤트들은 타이머 이벤트 만료 시각 계산부(150)에 의하여 만료 시각이 계산된다(S240). The timer events are arranged and stored in the active pool 140 and the expiration time is calculated by the timer event expiration time calculation unit 150 (S240).

S230 단계에서 상기 타이머 이벤트가 삽입될 때, 상기 타이머 이벤트는 액티브 풀(140)에 저장된 다른 타이머 이벤트들 중, 바로 앞에 발생될 타이머 이벤트의 만료 시각과 상기 타이머 이벤트의 만료 시각의 차인 소정의 시간이 계산되어 저장되므로, S240 단계에서는 액티브 풀(140)에 정렬되어 저장된 타이머 이벤트들 중, 첫 번째 타이머 이벤트의 만료 시각만을 계산한다.When the timer event is inserted in step S230, the timer event has a predetermined time that is the difference between the expiration time of the timer event to be generated immediately before the expiration time of the timer event among other timer events stored in the active pool 140. Since it is calculated and stored, in operation S240, only the expiration time of the first timer event is calculated among the timer events arranged and stored in the active pool 140.

S240 단계의 계산 결과, 상기 첫 번째 타이머 이벤트의 만료 시각이 경과되면, 상기 첫 번째 타이머 이벤트를 타이머 이벤트 통보 메시지 송신부(120)로 추출한다(S250).As a result of the calculation in step S240, when the expiration time of the first timer event has elapsed, the first timer event is extracted to the timer event notification message transmitter 120 (S250).

S250단계에서 추출된 타이머 이벤트를 통보하는 메시지를 상기 소정의 프로세스로 송신한다(S260).A message for notifying the timer event extracted in step S250 is transmitted to the predetermined process (S260).

도 3는 액티브 풀(140)로 상기 타이머 이벤트가 삽입될 때, 소정의 시간이 계산되고, 만료 시각이 빠른 순으로 정렬되는 과정을 나타내는 흐름도이다. 3 is a flowchart illustrating a process in which a predetermined time is calculated when the timer event is inserted into the active pool 140 and the expiration time is sorted in ascending order.

도 1과 도3을 참조하면, 먼저, 타이머 이벤트 Q개가 만료 시각이 빠른 순으로 정렬되어 있는 액티브 풀(140)로 TICK이 T인 타이머 이벤트 A를 삽입하기 위하여 N을 1로 세팅한다(S310). Referring to FIGS. 1 and 3, first, N is set to 1 to insert a timer event A having a TICK T into the active pool 140 in which Q timer events are arranged in order of expiration time (S310). .

TICK은 타이머 이벤트의 만료 시각까지 남은 시간을 나타내고, N은 타이머 이벤트가 삽입될 위치를 결정하기 위하여 도입된 변수이다. TICK represents the time remaining until the expiration time of the timer event, and N is a variable introduced to determine the position where the timer event is to be inserted.

TICK은 본 발명의 일 실시예에 따른 타이머 이벤트 만료 시각을 계산하는 단위인 0.1초의 시간을 의미하나, 이에 한정되는 것은 아니다. TICK means a time of 0.1 seconds, which is a unit for calculating a timer event expiration time according to an embodiment of the present invention, but is not limited thereto.

정렬된 Q개의 타이머 이벤트들 중, N번째 타이머 이벤트의 TICK과 T를 비교한다(S320). Among the aligned Q timer events, TICK and T of the Nth timer event are compared (S320).

S320 단계의 비교 결과, 상기 N번째 타이머 이벤트의 TICK이 T보다 크면, 상기 N번째 타이머 이벤트 앞에 TICK을 상기 T로 하는 타이머 이벤트 A를 삽입하고, 상기 N번째 타이머 이벤트의 TICK을 상기 T만큼 감소하여 저장한다(S330). As a result of the comparison in step S320, if the TICK of the Nth timer event is greater than T, a timer event A having TICK as the T is inserted before the Nth timer event, and the TICK of the Nth timer event is decreased by the T. Save (S330).

S320 단계의 비교 결과, 상기 N번째 타이머 이벤트의 TICK이 T보다 작으면, 상기 T를 상기 N번째 타이머 이벤트의 TICK만큼 감소하여 저장한다(S340). As a result of the comparison in step S320, if the TICK of the Nth timer event is smaller than T, the T is reduced and stored by the TICK of the Nth timer event (S340).

S340 단계 후, 상기 N과 Q를 비교한다(S350). After step S340, the N and Q are compared (S350).

S350 단계의 비교 결과, N과 Q가 같으면, 상기 액티브 풀(140)의 모든 타이머 이벤트들보다도 상기 타이머 이벤트의 만료 시각까지 남은 시간이 가장 길므로, 상기 타이머 이벤트는 상기 N번째, 즉 Q번째 타이머 이벤트 뒤에 TICK을 상기 T로 하는 타이머 이벤트 A를 삽입한다(S360). As a result of the comparison in step S350, if N and Q are the same, since the remaining time until the expiration time of the timer event is longer than all the timer events of the active pool 140, the timer event is the Nth, that is, the Qth timer. After the event, a timer event A having TICK as the T is inserted (S360).

S350 단계의 비교 결과, N과 Q가 같지 않으면, N은 1만큼 증가되고(S370), S320 단계부터 반복된다. As a result of the comparison of step S350, if N and Q are not equal, N is increased by 1 (S370) and is repeated from step S320.

도 4는 본 발명에 따른 일 실시예로, 타이머 이벤트 A가 삽입되기 전후의 액티브 풀을 도시한 것이다. 4 illustrates an active pool before and after the insertion of a timer event A according to an embodiment of the present invention.

도 1과 도4를 참조하면, 삽입전의 액티브 풀(140)에는 TICK이 100인 이벤트 1, TICK이 5인 이벤트 2, TICK이 35인 이벤트 3 및 TICK이 10인 이벤트 10000을 포함하는 10000개의 타이머 이벤트가 만료 시각이 빠른 순으로 정렬되어 있다. Referring to FIGS. 1 and 4, the active pool 140 before insertion includes 10000 timers including an event 1 with a TICK of 100, an event 2 with a TICK of 5, an event 3 with a TICK of 35, and an event 10000 with a TICK of 10. The events are sorted in ascending expiration time.

이벤트 1은 만료 시각까지 남은 시간이 100의 0.1배 즉 10초이고, 이벤트 2의 만료 시각까지 남은 시간은 상기 이벤트 1의 만료 시각까지 남은 시간에 5의 0.1배를 더한 값, 즉 10.5초이다. 그리고 상기 이벤트 3의 만료 시각까지 남은 시간은 상기 이벤트 2의 만료 시각까지 남은 시간에 35의 0.1배를 더한 값, 즉 14초이며, 상기 이벤트 10000은 이벤트 9999의 만료 시각까지 남은 시간에 10의 0.1배를 더한 값만큼의 시간이 만료 시각까지 남아 있다.Event 1 has a time remaining until expiration time of 0.1 times that of 100, or 10 seconds, the time remaining until the expiration time of event 2 is the time remaining until the expiration time of the event 1 plus 0.1 times 5, that is 10.5 seconds. The time remaining until the expiration time of the event 3 is equal to the remaining time until the expiration time of the event 2 plus 0.1 times 35, that is, 14 seconds, and the event 10000 is 0.1 to 10 at the time remaining until the expiration time of the event 9999. The amount of time plus the ship remains until the expiration time.

상기와 같이 10000개의 타이머 이벤트가 정렬된 액티브 풀(140)로 TICK이 120인 이벤트 A가 저장되기 위해서, 액티브 풀(140)에 정렬되어 저장된 타이머 이벤트들과 상기 이벤트 A의 TICK을 비교한다. 먼저, 상기 이벤트 1의 TICK과 상기 이벤트 A의 TICK을 비교하면, 이벤트 A의 TICK이 이벤트 1의 TICK보다 크므로, 이벤트 A의 TICK은 이벤트 1의 TICK인 100만큼 감소되어 20이 된다. 그리고 이벤트 A의 TICK과 이벤트 2의 TICK을 비교하면, 이벤트 A의 TICK이 이벤트 2의 TICK보다 크므로, 이벤트 A의 TICK은 이벤트 2의 TICK인 5만큼 감소되어 15가 된다. 또, 이벤트 A의 TICK은 이벤트 3의 TICK과 비교되면, 이벤트 A의 TICK이 이벤트 3의 TICK보다 작으므로, 이벤트 A는 이벤트 3 앞에 삽입되고, 이벤트 3의 TICK은 이벤트 A의 TICK인 15만큼 감소되어 20이 된다. In order to store the event A having the TICK 120 as the active pool 140 in which 10000 timer events are arranged as described above, the TICKs of the event A are compared with the timer events arranged and stored in the active pool 140. First, when the TICK of the event 1 is compared with the TICK of the event A, since the TICK of the event A is larger than the TICK of the event 1, the TICK of the event A is reduced to 100, which is the TICK of the event 1, and becomes 20. When the TICK of the event A is compared with the TICK of the event 2, since the TICK of the event A is larger than the TICK of the event 2, the TICK of the event A is reduced by 5, which is the TICK of the event 2, to 15. In addition, when TICK of event A is compared to TICK of event 3, since event A TICK is smaller than event 3 TICK, event A is inserted before event 3, and event 3 TICK is reduced by 15, which is TICK of event A. It becomes 20.

타이머 이벤트 만료 시각 계산부(150)는 정렬된 타이머 이벤트들 중, 첫 번째 타이머 이벤트의 TICK을 0.1초마다 1씩 감소시킨다. The timer event expiration time calculator 150 decreases the TICK of the first timer event by 1 every 0.1 seconds among the aligned timer events.

상기와 같이 액티브 풀(140)에 저장된 타이머 이벤트들은 만료 시각이 빠른 순으로, 바로 전에 발생될 타이머 이벤트 만료 시각부터 남은 시간이 계산되어 저장되므로, 타이머 이벤트 만료 시각 계산부(150)가 상기 첫 번째 타이머 이벤트의 만료 시각만을 계산하여도 모든 타이머 이벤트의 만료 시각이 계산된다. As described above, the timer events stored in the active pool 140 have the remaining time calculated from the timer event expiration time to be generated just before the expiration time, and the timer event expiration time calculation unit 150 is the first. Even when only the expiration time of the timer event is calculated, the expiration time of all timer events is calculated.

본 발명의 일 실시예에 따라 액티브 풀(140)은 삽입되는 타이머 이벤트의 TICK이 액티브 풀(140)에 저장된 타이머 이벤트들의 TICK과 차이가 많이 나는 경우, 삽입 비용(insert cost)이 커지는 것을 방지하기 위하여, 단주기, 중주기 및 장주기의 액티브 풀로 나뉘어 구현된다. 삽입되는 타이머 이벤트는 TICK값에 따라, 상기 단주기, 중주기 및 장주기 액티브 풀 중, 어는 하나의 액티브 풀에 정렬되어 삽입된다. 따라서, 타이머 이벤트 만료 시각 계산부(150)는 상기 단주기 액티브 풀의 첫 번째 타이머 이벤트의 만료 시각만을 계산한다. 상기 단주기, 중주기 및 장주기 액티브 풀은, 타이머(100)로 삽입되는 타이머 이벤트들의 TICK 값의 통계로부터, 삽입 비용이 최소가 되도록, 상기 단주기, 중주기 및 장주기의 액티브 풀에 삽입되는 타이머 이벤트의 TICK값의 범위가 설정될 수 있으나, 이에 한정되는 것은 아니다.According to an embodiment of the present invention, the active pool 140 prevents the insertion cost from increasing when the TICK of the timer event to be inserted differs from the TICK of the timer events stored in the active pool 140. In order to achieve this, it is implemented by dividing into an active pool of short, medium and long periods. The inserted timer event is inserted into one active pool among the short, medium and long period active pools according to the TICK value. Accordingly, the timer event expiration time calculation unit 150 calculates only the expiration time of the first timer event of the short-period active pool. The short, medium and long period active pools are timers inserted into the short, medium and long periods active pools so that the insertion cost is minimal from the statistics of TICK values of the timer events inserted into the timer 100. The range of the TICK value of the event may be set, but is not limited thereto.

본 발명에 대해 상기 실시예를 참고하여 설명하였으나, 이는 예시적인 것에 불과하며, 본 발명에 속하는 기술 분야의 통상의 지식을 가진 자라면 이로부터 다양한 변형 및 균등한 타 실시예가 가능하다는 점을 이해할 것이다. 따라서 본 발명의 진정한 기술적 보호범위는 첨부된 특허청구범위의 기술적 사상에 의해 정해져야 할 것이다. Although the present invention has been described with reference to the above embodiments, it is merely illustrative, and those skilled in the art will understand that various modifications and equivalent other embodiments are possible therefrom. . Therefore, the true technical protection scope of the present invention will be defined by the technical spirit of the appended claims.

상술한 바와 같이 본 발명에 따른 타이머는 다수의 타이머 이벤트의 등록을 수용하면서도, 성능 저하는 전혀 일어나지 않으므로 타이머 이벤트 등록을 요청한 응용 프로세스로 신뢰성 있는 타이머 이벤트를 발생시킬 수 있는 효과가 있다. As described above, while the timer according to the present invention accommodates the registration of a plurality of timer events, the performance does not occur at all, thereby generating a reliable timer event to the application process requesting the registration of the timer event.

Claims (14)

응용 프로세스로부터 타이머 이벤트의 등록을 요청하는 메시지를 수신하는 타이머 이벤트 등록 메시지 수신부; A timer event registration message receiving unit which receives a message requesting registration of a timer event from an application process; 상기 타이머 이벤트를 할당하기 위하여, 미리 확보된 메모리 영역인 프리 풀(free pool); A free pool which is a reserved memory area for allocating the timer event; 상기 프리 풀로부터 할당되어 상기 타이머 이벤트가 저장되는 메모리 영역인 액티브 풀(active pool); An active pool allocated from the free pool and a memory area in which the timer event is stored; 상기 액티브 풀에 저장된 타이머 이벤트들의 만료 시각을 계산하는 타이머 이벤트 만료 시각 계산부; 및 A timer event expiration time calculator configured to calculate an expiration time of timer events stored in the active pool; And 상기 액티브 풀의 상기 타이머 이벤트의 만료 시각에 상기 응용 프로세스로 상기 타이머 이벤트를 통보하는 메시지를 송신하는 타이머 이벤트 통보 메시지 송신부를 포함하는 것을 특징으로 하는 타이머. And a timer event notification message transmitter configured to transmit a message for notifying the timer event to the application process at the expiration time of the timer event of the active pool. 제1항에 있어서, The method of claim 1, 상기 프리 풀에 메모리가 없는 경우, 상기 프리 풀로 새로운 메모리 영역이 할당되고, 상기 액티브 풀로부터 만료 시각이 경과되어 종료된 타이머 이벤트의 메모리가 상기 프리 풀로 회수되는 것을 특징으로 하는 타이머.And when there is no memory in the free pool, a new memory area is allocated to the free pool, and a memory of a timer event terminated after an expiration time has elapsed from the active pool is recovered to the free pool. 제1항에 있어서,The method of claim 1, 상기 액티브 풀의 각각의 타이머 이벤트들은 각각의 타이머 이벤트 만료 시각과 각각의 타이머 이벤트 바로 전에 발생될 타이머 이벤트의 만료 시각과의 차이인 소정의 시간을 포함하고, 만료 시각이 빠른 순으로 정렬되는 것을 특징으로 하는 타이머.Each timer event of the active pool includes a predetermined time that is a difference between each timer event expiration time and an expiration time of a timer event to be generated immediately before each timer event, and the expiration times are arranged in ascending order. Timer. 제3항에 있어서, 상기 타이머 이벤트 만료 시각 계산부는, The method of claim 3, wherein the timer event expiration time calculation unit, 상기 액티브 풀에 정렬되어 저장된 타이머 이벤트들 중, 첫 번째 타이머 이벤트의 만료 시각만을 상기 소정의 시간에 기초하여 계산하는 것을 특징으로 하는 타이머.And among the timer events aligned and stored in the active pool, calculating only the expiration time of the first timer event based on the predetermined time. 제3항에 있어서,The method of claim 3, 상기 액티브 풀은 적어도 두 개의 그룹으로 나뉘며,The active pool is divided into at least two groups, 상기 액티브 풀에 저장되는 타이머 이벤트들은 만료 시각에 따라, 상기 적어도 두 개의 그룹 중 어느 하나의 그룹에 정렬되어 저장되는 것을 특징으로 하는 타이머. The timer events stored in the active pool are arranged in one of the at least two groups and stored according to the expiration time. 응용 프로세스로부터 타이머 이벤트의 등록을 요청하는 메시지를 수신하는 타이머 이벤트 등록 메시지 수신부; A timer event registration message receiving unit which receives a message requesting registration of a timer event from an application process; 상기 타이머 이벤트를 다른 타이머 이벤트들과 비교하여, 만료 시각이 빠른 순으로 정렬되어 저장되는 메모리 영역인 액티브 풀(active pool); An active pool, which is a memory area in which the expiration time is sorted and stored in the order of expiration, comparing the timer event with other timer events; 상기 액티브 풀에 저장된 타이머 이벤트들의 만료 시각을 계산하는 타이머 이벤트 만료 시각 계산부; 및 A timer event expiration time calculator configured to calculate an expiration time of timer events stored in the active pool; And 상기 타이머 이벤트의 만료 시각에 상기 응용 프로세스로 상기 타이머 이벤트를 통보하는 메시지를 송신하는 타이머 이벤트 통보 메시지 송신부를 구비하는 것을 특징으로 하는 타이머. And a timer event notification message transmitter for transmitting a message for notifying the timer event to the application process at the expiration time of the timer event. 제6항에 있어서, The method of claim 6, 상기 액티브 풀의 타이머 이벤트들은 각각의 타이머 이벤트 만료 시각과 각각의 타이머 이벤트 바로 전에 발생 될 타이머 이벤트의 만료 시각과의 차이인 소정의 시간을 포함하는 것을 특징으로 하는 타이머. The timer events of the active pool may include a predetermined time that is a difference between an expiration time of each timer event expiration time and a timer event to be generated immediately before each timer event. 제7항에 있어서, 상기 타이머 이벤트 만료 시각 계산부는, The method of claim 7, wherein the timer event expiration time calculation unit, 상기 액티브 풀에 정렬되어 저장된 타이머 이벤트들 중, 첫 번째 타이머 이벤트의 만료 시각만을 상기 소정의 시간에 기초하여 계산하는 것을 특징으로 하는 타이머. And among the timer events aligned and stored in the active pool, calculating only the expiration time of the first timer event based on the predetermined time. 제6항에 있어서, The method of claim 6, 상기 타이머 이벤트를 할당하기 위하여, 미리 확보된 메모리 영역인 프리 풀(free pool)을 더 포함하는 것을 특징으로 하는 타이머. And a free pool, which is a reserved memory area, for allocating the timer event. (a) 응용 프로세스로부터 타이머 이벤트 등록을 요청하는 메시지가 수신되면, 미리 확보된 메모리 영역인 프리 풀로부터 상기 타이머 이벤트를 위한 메모리가 할당되는 단계; (a) when a message requesting to register a timer event is received from an application process, allocating a memory for the timer event from a free pool, which is a reserved memory area; (b) 상기 타이머 이벤트를 다른 타이머 이벤트들과 비교하여, 만료 시각이 빠른 순으로 정렬되도록 액티브 풀에 저장하는 단계; (b) comparing the timer event with other timer events and storing the timer event in the active pool so that the expiration time is sorted in ascending order; (c) 상기 액티브 풀에 정렬되어 저장된 타이머 이벤트들의 만료 시각을 계산하는 단계; 및 (c) calculating an expiration time of timer events arranged and stored in the active pool; And (d) 상기 (c) 단계에 기초하여, 상기 타이머 이벤트의 만료 시각이 경과되면 상기 응용 프로세스로 상기 타이머 이벤트를 통보하는 메시지를 송신하는 단계를 구비하는 것을 특징으로 하는 타이머 이벤트 처리 방법. and (d) sending a message for notifying the timer event to the application process when the expiration time of the timer event has elapsed, based on step (c). 제10항에 있어서, 상기 (b) 단계는The method of claim 10, wherein step (b) 상기 액티브 풀의 각각의 타이머 이벤트들은 각각의 타이머 이벤트 만료 시각과 각각의 타이머 이벤트 바로 전에 발생될 타이머 이벤트의 만료 시각과의 차이인 소정의 시간을 포함하여, 만료 시각이 빠른 순으로 정렬하는 단계를 포함하는 것을 특징으로 하는 타이머 이벤트 처리 방법. Sorting the timers in the active pool in ascending order of expiration time, including a predetermined time that is a difference between each timer event expiration time and an expiration time of a timer event to be generated immediately before each timer event. Timer event processing method comprising a. 제10항에 있어서, 상기 (c)단계는 The method of claim 10, wherein step (c) 상기 액티브 풀에 정렬되어 저장된 타이머 이벤트들 중, 첫 번째 타이머 이벤트의 만료 시각만을 상기 소정의 시간에 기초하여 계산하는 단계를 포함하는 것 을 특징으로 하는 타이머 이벤트 처리 방법. And calculating only an expiration time of a first timer event among the timer events aligned and stored in the active pool based on the predetermined time. 제10항에 있어서, 상기 (d)단계 후, 상기 액티브 풀로부터 상기 만료 시각이 경과되어 종료된 타이머 이벤트의 메모리가 상기 프리 풀로 회수되는 단계를 더 포함하는 것을 특징으로 하는 타이머 이벤트 처리 방법. The method of claim 10, further comprising, after step (d), recovering a memory of a timer event that expires after the expiration time has elapsed from the active pool to the free pool. 제10항 내지 제13항을 디지털 신호 처리 장치에 의해 판독되고 실행될 수 있는 프로그램을 기록한 기록매체.A recording medium having recorded thereon a program that can be read and executed by a digital signal processing apparatus.
KR1020060015433A 2006-02-17 2006-02-17 Timer and method of managing timer event KR20070082620A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020060015433A KR20070082620A (en) 2006-02-17 2006-02-17 Timer and method of managing timer event

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020060015433A KR20070082620A (en) 2006-02-17 2006-02-17 Timer and method of managing timer event

Publications (1)

Publication Number Publication Date
KR20070082620A true KR20070082620A (en) 2007-08-22

Family

ID=38612199

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020060015433A KR20070082620A (en) 2006-02-17 2006-02-17 Timer and method of managing timer event

Country Status (1)

Country Link
KR (1) KR20070082620A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9846546B2 (en) 2013-06-20 2017-12-19 Hanwha Techwin Co., Ltd. Method and apparatus for storing image

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9846546B2 (en) 2013-06-20 2017-12-19 Hanwha Techwin Co., Ltd. Method and apparatus for storing image

Similar Documents

Publication Publication Date Title
CN108376118B (en) Service distribution system, method, device and storage medium
CN106155780B (en) node election method and device based on time
JP5474177B2 (en) Distributed application monitoring
CN112118315A (en) Data processing system, method, device, electronic equipment and storage medium
CN109510878B (en) Long connection session keeping method and device
US5892818A (en) Method of controlling message overload on a program in a plural processor controlled switching system
US20060248042A1 (en) Method to reduce the latency caused by garbage collection in a java virtual machine
US20070265976A1 (en) License distribution in a packet data network
KR101028298B1 (en) Method and system for distributing data processing units in a communication network
CN113242149B (en) Long connection configuration method, apparatus, device, storage medium, and program product
CN111538572A (en) Task processing method, device, scheduling server and medium
CN108964822B (en) Method and system for acquiring network time in parallel by multiple schemes
CN111625344B (en) Resource scheduling system, method and device in application system
KR20070082620A (en) Timer and method of managing timer event
CN111831408A (en) Asynchronous task processing method and device, electronic equipment and medium
CN113271228B (en) Bandwidth resource scheduling method, device, equipment and computer readable storage medium
CN113055493B (en) Data packet processing method, device, system, scheduling device and storage medium
CN115658156A (en) Timed task implementation method and device based on linux system
CN112685157B (en) Task processing method, device, computer equipment and storage medium
CN110046040B (en) Distributed task processing method and system and storage medium
CN113835905A (en) Message queue load balancing method and device, electronic equipment and medium
CN112711587A (en) Data processing method and device, electronic equipment and storage medium
CN111367853A (en) Data transmission method, device, equipment and computer readable storage medium
US20150118952A1 (en) Managing Service Subscriptions Over A Unidirectional Transmission Channel
KR100871587B1 (en) Method and apparatus for controlling the inter-process variable length packet data flow using the shared memory paging techniques

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E902 Notification of reason for refusal
E601 Decision to refuse application