What is the difference between interrupt and an event?
What is the difference between interrupt and an event?
What is the difference between interrupt and an event?
These two concepts both offer ways for the "system/program" to deal with various "conditions" which take place during the normal unrolling of some program, and which may require the "system/program" to do something else, before returning (or not...) to the original task. However, aside from this functional similarity, they are very distinct concepts used in distinct contexts, at distinct levels.
Interrupts provide a low-level device to interrupting the normal unrolling of whatever piece of program the CPU is working on a a given time, and to have the CPU start processing instructions at another address. Interrupts are useful to handle various situations which require the CPU s immediate processing (for example to deal with keystrokes, or the arrival of new data in a serial communication channel).
Many interruptions are produced by hardware (by some electronic device changing the polarity on one of the pins of the CPU), but there are also software interrupts which are cause by the program itself invoking a particular instruction. (or also by the CPU detecting something is astray with regard to itself or the program running).
A very famous interrupt is INT 0x21 which program invoke[d] to call services from MS-DOS.
Interrupts are typically dispatched by way of vector tables, whereby the CPU has a particular location in memory containing an array of addresses [where particular interrupt handlers reside]. By modifying the content of the interrupt table [if it is so allowed...], a program can redefine which particular handler will be called for a given interrupt number.
Events, on the other hand, are system/language-level "messages" which can be used to signify various hardware or software situations (I d use the word event), such as Mouse clicks, keyboard entries, but also application-level situations such as "New record inserted in database" or highly digested requests and messages, used in modular programs for communication/requests between various parts of the program.
Unlike interrupts with their [relatively simple] behavior which is fully defined by the CPU, there exist various event systems systems, at the level of the operating system as well as various frameworks (ex: MS Windows, JavaScript, .NET, GUI frameworks like QT etc..). All events systems, while different in their implementations, typically share common properties such as
Interrupts are implemented inside the hardware (CPU) to interrupt the usually linear flow of a program. This is important for external events like keyboard input but also for interrupting programs in multi-tasking operating systems.
Events are a means of software engineering and probably most often known from GUI toolkits. There, the toolkit/OS wraps happenings like keystrokes or mouse input into "events". Those are then dispatched to programs that went to register themselves for receiving such events. It s maybe a bit like a mailing system.
To compare both, from a userspace program view:
-Interrupts would force your program to halt in order to let some lower-level code execute (like OS code)
-Events usually are sent to you from lower-level code and trigger execution of your code
What is the difference between interrupt and an event?
Recently, I have been asked a question in an interview what s the difference between a process and a thread. Really, I did not know the answer. I thought for a minute and gave a very weird answer. ...
This relates to some software I ve been given to "fix". The easiest and quickest solution would make it open and read 10 random files out of hundreds and extract some very short strings for processing ...
I know DLL contains one or more exported functions that are compiled, linked, and stored separately.. My question is about not about how to create it.. but it is all about in what form it is stored.. ...
I am wondering if i new some object but forget to delete it, when the process exit, will the leaked memory be returned to the OS?
Does the threads of a single process run in parallel on a multi-core machine on windows XP? Is the behavior same on different windows versions (windows server editions) I have heard that only threads ...
What are some of the major pro/con of FreeBSD vs GNU Linux vs OpenSolaris? Which is the best operating system to program/develop against?
How can I check OS version in a batch file or through a vbs in an Windows 2k/2k3 environment ? You know ... Something like ... : "If winver Win2k then ... or if winver Win2k3 then ....