Windows interrupt Programming

Source: Internet
Author: User
Tags message queue

First, the preface

Windows provides powerful functionality as well as a friendly graphical user interface (GUI), making it not only widely used as a support platform for managing transactional jobs, but also a concern for engineers in the industrial field.

But WINDOWS3. 1 is not based on priority to scheduling tasks, can not immediately respond to external event interruption, also can not meet the industrial application environment real-time event processing and real-time control applications. Therefore, how to deal with the external real-time events in the Windows environment has always been a concern of technicians, especially the real time field engineers. At present, most of the methods used in the real-time multitasking kernel, such as Windows real-time control software package FLX, and IRMX real-time operating system WINDOWS3. 1 as one of its tasks to run. For large projects, developers can buy real-time software and then integrate them. For small and medium projects, it is not very economical to consider investment. How to find a concise way to deal with external real-time events is still necessary.

This paper firstly expounds the message mechanism and interrupt mechanism of windows, and then unifies the DPMI interface, gives a design method of interrupt program in protection mode to deal with the external real-time events. The actual operation results show that the method is simple, practical and reliable, and can also run in Win95.

Second, the message mechanism of Windows

Windows is a message-driven system. Windows messages provide segments that communicate between applications and applications, and between an application and a Windows system. The functionality to be implemented by the application is triggered by the message and is accomplished by the response and processing of the message.

There are two kinds of message queues in a Windows system, one is system Message Queuing and the other is application Message Queuing. All input devices for the computer are monitored by Windows, and when an event occurs, Windows places the entered message into the system message queue and then copies the messages entered into the appropriate application queue. The message loop in the application retrieves each message from its message queue and sends it to the appropriate window function. The occurrence of an event that arrives at the window function that handles it must undergo the above process. It is noteworthy that the message is not preemptive, that is, regardless of the urgency and delay of the event, always by the arrival of the queue (some system messages excepted), which makes some external real-time events may not be timely processing.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.