1238327 玖、發明說明: 【發明所屬之技術領域】 本發明係關於一種短時間内大量發送訊息之訊息傳遞系 統,特別是指一種利用多工執行緒(Muh卜thread)方式以及任 務導向(Task Oriented)的方式設計而能同時執行大量獨立運 作之單一執行緒,並利用公用記憶體(SharedMem〇ry)存放各 獨立程式元件彼此間溝通之資料,以節省大量資料讀取之時 間。 【先前技術】 | 一般人於日常生活中有各種不同的需求,人們彼此之間 的需求以各式資訊相互溝通,人類的生活隨著科技不斷的快 速發展且日新月異的快速變化,於資訊上的溝通也有著各式 各樣不同的方式,以便利人們使用,其中,短訊的傳遞方式 也越來越被人們所利用。隨著生活視野和人際關係的更加開 闊,且人們針對各式各樣特定資訊之也有共通的需求,訊息 所需傳遞對象也不再侷限於一對一傳遞的短訊方式,以增力_ 傳遞資訊之時效性限制,現在越來越多有著須要於短時間内 發送極大數量之短訊之需求,如:氣象局發送及時氣象、地 震等資訊,如高工局或公路局發送及時之奎塞或是路況, 如:鐵路局及時發送列車取消或更改時間之短訊,證券公司 發迗及時行情給予所有客戶,又如:購物百貨中心發送歡 迎、廣告甚至折扣之訊息給消費者,再再都有著於短時間内 1238327 發送大量短訊的需要。解決如此的需求實在是㈣㈣。 根據研究指出,傳統利用電腦程式處理短訊傳遞的需 求’乃是利用電腦之處理能力依序針料—各別的訊息傳遞 對象傳遞訊息,相對於人工作業,雖能大幅降低人力成本' 有著操作上的便利以及可確保傳遞訊息操作之正確性及迅 速性,其效能毋庸至疑。但是針對越來越多需要於短時間内 發送大量短訊的需求,並無能為力。 由此可I Jl述驾用汛息傳遞系統仍有諸多缺失,實非 一良善之設計者,而亟待加以改良。 · 本案發明域於上述f用訊息傳遞系統所衍生的各項缺 點,乃亟思加以改良創新,並經多年苦心孤詣潛心研究後, 終於成功研發完成本件短時間内大量發送訊息之訊息傳遞 系統。 【發明内容】 本發明之目的即在於提供一種短時間内大量發送訊息之 訊息傳遞系統,係擴充傳統電腦作業程式依序處理傳遞命_ 之功能至短時間内發送大量之訊息傳遞系統,以應付龐大單 一之訊息傳遞數量,並提供一運用多工執行緒(Muhithread) 及任務導向(Task Oriented)方式並利用共用記憶體之系統程 式設計方法。 可達成上述發明目的之短時間内大量發送訊息之訊息傳 遞系統’係利用任務導向(Task Oriented)的系統程式設計,將不 1238327 门的糸、、充功犯刀開权計成獨立 下菓並運用共用記憶體 (Shared Memory)和公用資料姓糂 …構(C〇mm〇n 0她Structure)傳遞系統 運算資料,且可利用資料庫之弈 進式彳τ 列(Advanced Queueing;) 啟動排程時間到達之傳遞訊* 汛心私令,並利用多工執行緒 (—d)方式同時執行大量的執行緒,以達成短時間内大 量發送訊息之目的’並增加軟體靈活度。其方法為利用一共 用記憶體(共分三區:傳遞需灰F、留你&人 、而承區早一傳遞命令區及單一傳 遞結果區)來提供各功能元件存放和取用彼此間溝通之共用 資料。連結客戶端伺服器之當4 蠢 之㊉駐耘式接收客戶傳遞需求並# 相關資料存入共用記憶體之傳遞需求區。該資料庫系統(含先 進式仔列)係用來存放客戶之傳遞需求等相關資料,而先進式 仵列存放並監控排程之單一傳遞命令並向排程常駐程式發 达通知信號。而排程常駐程式於收到先進式仔列之信號通知 後,從該仔列取用排程啟動之單一傳遞命令,存人共用記憶 體。需求處理常駐程式,從共用記憶體取出客戶之傳遞需求 且寫入資料庫,並將之解析為各別單一傳遞命令,並判斷# 求若是立即需求則將寫入共用記憶體,若是排程需求則存入 前述之先進式佇列中(含啟動時間)。前端傳遞系統以s〇cket 連線方式接收單一執行緒所要求之傳遞命令並予以處理和 傳送傳遞處理之結果至一負責接收傳遞結果之連線程式。而 傳遞結果之連線程式接收前端傳遞系統之傳遞結果並存入 1238327 共Y §己憶體。f駐核心主程式(擔任主執行緒,Main-Thread)監控 系統之運作以及讀取共用記憶體之單—傳遞命令及結果來 生或Η醒單-執行緒並指派或更改單一傳遞命令,給予獨 :執仃。而單一執行緒負責完整之各別傳遞命令,依據執行 當時之傳遞狀態與前端傳遞系統連線,給予適#之不同傳遞 卩7之4進入睡眠等待被叫醒或其他狀態直至完整傳遞動 作結束或其他原因而結束自己。本發明之另—功能為核心主 程式(主執行緒)可依據實際需求的需要而機動調整可同時進 行之執行緒之數量,提高整體訊息傳遞系統的靈活度。鲁 【實施方式】 本發明係為擴充傳統電腦程式作業依序處理傳遞命令之 功能至短時間内發送大量訊息之訊息傳遞系統。在短時間内 發运大量訊息之訊息傳遞系統中,單一完整之訊息傳遞動作 為一必要之執行動作流程。傳統被使用之電腦程式作業執行 大量單一傳遞動作的方法,多為讀取整體之訊息傳遞需求 後,解析全部所需並寫入資料庫存放後,依序從資料庫取g 一傳遞命令之資料,執行完整之訊息傳遞動作,為縮短所花 費的時間與提高效能,需昂貴之硬體與經過複雜設計且擴充 或變更不易之軟體配合。本發明則提供一運用多工執行緒 (Multi-thread)及任務導向(Task Oriented)方式並利用共用記憶體j 之系統程式設計方法。 請參閱圖一所示,為本發明所提供之短時間内發送大量 I238327 訊息之訊息傳遞系統之架構,係將該需求接收常駐程式2從 客戶端伺服器3取得之訊息傳遞至需求整體相關資料後並 寫入共用S己憶體1之傳遞需求區in,而需求處理常駐程式4 將會不斷從共用記憶體i之傳遞需求區U1讀取傳遞需求資 料,並記錄至資料庫系統5,將之解析作為各別單一之傳遞 °p々,並判斷此傳遞需求是否為立即或排程,再將所有單一 傳遞命令寫入共用記憶體i之單一傳遞命令區113或先進式 佇列6’該先進式佇列6則會隨時檢查是否有傳遞命令之啟_ 動時間到達,若是,將會通知排程常駐程式7進行處理,# 程常駐程式7得到通知後,會從先進式佇列6取出單一傳遞 命令,在寫入共用記憶體1之單一傳遞命令區113,而核心主 程式(主執行緒)8會不斷從共用記憶體i之單一傳遞命令區 113讀取單一傳遞命令,呼叫產生一個單一執行緒81,將取 得之單一傳遞命令指派給該單一執行緒81負責處理,或是不 斷從共用記憶體1之單一傳遞結果區112讀取單一傳遞結果_ 並更新目前之傳遞流程狀態,更新資料庫系統5内之f料# 叫醒負責該單一傳遞命令之單一執行緒幻繼續處理,而單— 執行緒81被產生並指派任務後,依此傳遞命令之狀態決定欲 呼叫之傳遞命令與前端傳遞系統9連線,並交付命令給予執 订之後,再進入睡眠狀態等待被叫醒繼續執行,待前端傳遞 系統9處理完傳遞命令後,與傳遞結果連線程式1〇連線,並 9 1238327 父付傳遞結果,當傳遞結果連線程式ι〇收到傳遞結果後,將 之寫入共用記憶體〖之單一傳遞結果區112。而單一執行緒 81所被指派之單__傳遞訊息任務之狀態若已經為完成階段, 則結束單一執行緒81自己本身,如此則完成一完整之單一傳 遞命令,待核心主程式(主執行緒)8監控發現所有單一傳遞任 務都完成後,更新資料庫系統5後,即完整完成客戶之訊息 :遞需求。如此利用多數單—執行緒81同時處理各別之傳遞 、卩7之多工執行緒之設計方式,大幅縮短了完成整體訊息傳 遞所可能浪費之大量的處理器等待時間以及資料庫間不# 的輸出、輸入時間。 另外’核心主程式(主執行緒)8乃依據可同時執行之單一 執行緒81的數量上限,虫丨_ θ 欺里上限Ν斷疋否該呼叫產生單一執行緒8ΐ 或是暫停等㈣統的負荷下降,而心主程式(主執行緒)8 可依據客戶之訊息傳遞之對象總數而機動調整可產生並同1238327 发明 Description of the invention: [Technical field to which the invention belongs] The present invention relates to a message delivery system that sends a large number of messages in a short period of time, and particularly refers to a method using a multi-threading method and a task orientation. ) Method designed to execute a large number of independent single threads at the same time, and use shared memory (Shared Memory) to store the data of each independent program component to communicate with each other, in order to save a lot of time to read data. [Previous technology] | The average person has various needs in daily life. People's needs communicate with each other with various types of information. Human life is constantly developing rapidly with the rapid development of science and technology and rapidly changing with each passing day. Communication on information There are also a variety of different ways to facilitate people's use, and among them, the way of transmitting short messages is increasingly used by people. As life horizons and interpersonal relationships become more open, and people also have common needs for all kinds of specific information, the objects that need to be transmitted are no longer limited to one-to-one short-message delivery methods. Limited timeliness of information. Nowadays, there is an increasing need to send a large number of short messages within a short period of time, such as meteorological bureaus to send timely meteorological and earthquake information, such as the Ministry of Engineering or Highway Bureau to send timely Quesser. Or road conditions, such as: the railway bureau sends a short message about train cancellation or change in time, the securities company issues timely quotes to all customers, and the shopping department center sends welcome, advertising, and even discount messages to consumers, and then all There is a need to send a large number of short messages in 1238327 in a short time. Solving such a demand is really rampant. According to research, the traditional requirement of using computer programs to process short message transmission is to use the computer's processing power to sequentially order the material-each message passing object transmits the message. Compared with manual operations, it can significantly reduce the labor cost. The convenience and convenience of ensuring the correctness and speed of message transmission are beyond doubt. However, there is nothing that can be done to meet the increasing demand for sending a large number of short messages in a short period of time. Therefore, there are still many shortcomings in the driving flood transmission system. It is not a good designer and needs to be improved. · The invention in this case is based on the various shortcomings derived from the above-mentioned messaging system. It is anxious to improve and innovate. After years of painstaking research, it has finally successfully developed a messaging system that sends a large number of messages in a short period of time. [Summary of the invention] The object of the present invention is to provide a message transmission system for sending a large number of messages in a short time, which is to expand the function of a traditional computer operating program to sequentially process the transmission of _ to a system of sending a large number of messages in a short time to cope with A large number of single message transmissions, and provides a system programming method that uses Muhithread and Task Oriented methods and uses shared memory. The message delivery system that can send a large number of messages in a short period of time to achieve the above-mentioned object of the invention is a system program design using Task Oriented. The shared memory and shared data surname 构 ... structure (Common Structure) transfers the system operation data, and can use the database's advanced progression queue (Advanced Queueing;) to start the schedule time Arrival message * Xun Xin personally ordered and executed multiple threads at the same time using the multi-threading (-d) method to achieve the purpose of sending a large number of messages in a short period of time and increasing the flexibility of the software. The method is to use a shared memory (divided into three areas: the transfer needs gray F, leave you & person, and the receiving area earlier a transfer command area and a single transfer result area) to provide storage and access to each functional element between each other Shared information for communication. When connected to the client server, it is foolish to receive customer transmission requirements and store related information in the transmission request area of shared memory. The database system (including advanced queues) is used to store the customer's delivery requirements and other related information, while the advanced queues store and monitor a single delivery order for the schedule and send notification signals to the resident program. After receiving the signal notification from the advanced queue, the schedule resident program takes a single transfer command from the queue to start the schedule and stores it in the shared memory. Demand processing resident program, take out the customer's delivery request from the shared memory and write it into the database, and analyze it into individual single delivery commands, and judge # if it is an immediate request, it will be written to the shared memory, if it is a scheduled request It is stored in the advanced queue (including startup time). The front-end delivery system receives the delivery command required by a single thread through a socket connection, processes it, and sends the result of the delivery process to a connection program responsible for receiving the delivery result. And the connection program that transmits the result receives the transmission result from the front-end transmission system and stores it in 1238327 total Y § memory. fResidual core main program (Main-Thread) monitors the operation of the system and reads the orders of the shared memory—passing commands and results to generate or wake up the order—threads and assigning or changing a single passing command, giving Independence: Perseverance. And a single thread is responsible for complete individual delivery commands, and is connected to the front-end delivery system according to the delivery status at the time of execution, giving different transmissions suitable for # 7 of 4 into sleep waiting for being called or other states until the end of the complete delivery action or End yourself for other reasons. Another feature of the present invention is that the core main program (main thread) can be adjusted to the number of threads that can be performed at the same time according to the actual needs, thereby improving the flexibility of the overall message transmission system. [Embodiment] The present invention is a message delivery system for expanding the function of a traditional computer program to sequentially process a delivery command to send a large number of messages in a short time. In a messaging system that sends a large number of messages in a short time, a single complete messaging action is a necessary execution action flow. Traditionally used computer program operations perform a large number of single-pass actions. Most of them read the overall message delivery requirements, analyze all the requirements and write them into the database, and then sequentially take the data of the g-pass command from the database. , To perform a complete message transfer action. In order to reduce the time spent and improve performance, expensive hardware is required to cooperate with software that is complex in design and difficult to expand or change. The present invention provides a system programming method using a multi-thread and task oriented method and utilizing a shared memory j. Please refer to FIG. 1, which is a structure of a messaging system for sending a large number of I238327 messages in a short period of time provided by the present invention, which passes the information received by the demand receiving resident program 2 from the client server 3 to the overall requirements related information. After that, it writes the transfer demand area in of the shared memory 1 and the demand processing resident program 4 will continuously read the transfer demand data from the transfer demand area U1 of the shared memory i and record it to the database system 5. Analyze it as a separate single transfer ° p々, and determine whether this transfer request is immediate or scheduled, and then write all single transfer commands into the single transfer command area 113 or advanced queue 6 'of the shared memory i. Advanced queue 6 will check at any time whether the start time of the delivery command has arrived. If so, it will notify the schedule resident program 7 for processing. After the # Cheng resident program 7 is notified, it will be taken out from the advanced queue 6. The single transfer command is written in the single transfer command area 113 of the shared memory 1, and the core main program (main thread) 8 will continuously read the single transfer command from the single transfer command area 113 of the shared memory i Pass the command, call to generate a single thread 81, and assign the obtained single pass command to the single thread 81 for processing, or continuously read the single pass result from the single pass result area 112 of the shared memory 1 and update the current The status of the transfer process is updated in the database system 5 ## Wake up the single thread responsible for the single transfer command to continue processing, and after the single-thread 81 is generated and assigned a task, the status of the transfer command is determined The delivery command to be called is connected with the front-end delivery system 9 and the delivery order is given for subscription. Then it goes to sleep and waits to be woken up to continue execution. After the front-end delivery system 9 processes the delivery command, it connects with the delivery result program 1. 〇, and 9 1238327 the parent pays the transfer result. When the transfer result connection program ι〇 receives the transfer result, it writes it into the single transfer result area 112 of the shared memory. And if the status of the single __message task assigned by the single thread 81 is already completed, then the single thread 81 itself will be terminated. In this way, a complete single transmission command is completed, waiting for the core main program (main thread) ) 8 After the monitoring finds that all the single delivery tasks are completed, after updating the database system 5, the customer's message is completely completed: delivery requirements. In this way, the use of the majority-thread 81 is designed to handle separate transmissions at the same time, and the multi-threaded design method of 卩 7 greatly reduces the large amount of processor waiting time that may be wasted to complete the overall message transmission, and the gap between the databases. Output, input time. In addition, the 'core main program (main thread) 8 is based on the maximum number of single threads 81 that can be executed at the same time, and the upper limit N is broken. Does the call generate a single thread 8? The load decreases, and the heart main program (main thread) 8 can be adjusted according to the total number of objects passed by the customer's message.
:執行之單-執行緒81的數量上限,如此可尋求一最適當之 多數,於硬體成本及系統效能取得最佳化平衡。 本發明所提供之短時間内大詈, „ 内大里發适訊息之訊息傳遞系 4,與其他習用技術相互比較時, 文具有下列之優點: 1·本發明可大幅縮短客戶傳 傅遞δί1息需求從起始至結束之 〜時間,提供較佳的訊息發送效能。 2·本發明可避免處理器負荷程 又个岣4的狀況,並提高各 10 1238327 伺服器的處理器之使用效率’充分發揮硬體設備之最大能力 及容量,其經濟效益非常明顯。 上列詳細說明係針對本發明之一可行實施例之具體說 明’惟該實施例並非用以限制本發明之專利範圍,凡未脫離 本發明技藝精神所為之等效實施或變更,均應包含於本案之 專利範圍中。 练上所述,本案不但在空間型態上確屬創新,並能較習 用物un增進上述多項功效,應已充分符合新穎性及進步性之 法定發明專利要件,爱依法提出中請,㈣#局核准本_ 發明專利申請案,以勵發明,至感德便。 【圖式簡單說明】 "月參閱以下有關本發明一較佳實施例之詳細說明及其附 圖,將可進一步瞭解本發明之技術内容及其目的功效;有關 該實施例之附圖為:: Execution order-the upper limit of the number of threads 81. In this way, the most appropriate majority can be sought to achieve an optimal balance between hardware costs and system performance. In the short time period provided by the present invention, the message transmission system of "Inner Tarifa's suitable message", when compared with other conventional technologies, the text has the following advantages: 1. The present invention can greatly shorten the customer's transmission of δ1 Demand from the beginning to the end of the time, to provide better message sending performance. 2. The present invention can avoid the processor load process and a situation of 岣 4, and improve the use efficiency of the processor of each 10 1238327 server 'sufficient The economic benefits of using the maximum capacity and capacity of the hardware equipment are very obvious. The detailed description above is a specific description of one of the feasible embodiments of the present invention, but this embodiment is not intended to limit the scope of the patent of the present invention. Equivalent implementations or changes made by the technical spirit of the present invention should be included in the scope of patents in this case. As mentioned above, this case is not only an innovation in space type, but also can enhance the above-mentioned multiple effects over conventional objects. The statutory invention patent elements that have fully met the novelty and progressiveness, love to file a request in accordance with the law, ㈣ # 局 approved this _ invention patent application to encourage invention [Brief description of the drawings] "Refer to the following detailed description of a preferred embodiment of the present invention and its accompanying drawings for further understanding of the technical content of the present invention and its purpose and effect; related to this embodiment The drawings are:
圖一為本發明短時間内發送大量訊息之訊息傳遞系統之 架構圖。 I 【主要部分代表符號】 1共用記憶體 10傳遞結果連線程式 傳遞需求區 112單一傳遞結果區 113單一傳遞命令區 11 1238327 2需求接收常駐程式 3客戶端伺服器 4需求處理常駐程式 5資料庫系統 6先進式佇列 7排程常駐程式 8核心主程式(主執行緒) 81單一執行緒 9前端傳遞系統FIG. 1 is a structural diagram of a messaging system for sending a large amount of messages in a short time according to the present invention. I [Representative symbols of main parts] 1 shared memory 10 transfer result connection program transfer request area 112 single transfer result area 113 single transfer command area 11 1238327 2 demand receiving resident program 3 client server 4 demand processing resident program 5 database System 6 advanced queue 7 schedule resident program 8 core main program (main thread) 81 single thread 9 front-end delivery system
1212