Computer Programs are processed by the CPU to give results. A Computer Program that is being processed may be suspended. The suspension of the Computer Program is controlled by the Computer.
The suspension of processing activity related to a Computer Program is reasonable. Yes, the Computer was busy with processing activity. But something more important has to be attended. This activity that is more important may originate from Computer Software or Computer Hardware.
Let us talk in a more focused way. Yes, a Computer Program is being processed. The CPU of the Computer is busy with the said processing of the Computer Program. At the same time an attempt may be made to attract the attention of the CPU.
We say that an Event has occurred while processing of a Computer Program is going on. This Event tries to catch the attention of the CPU.
An Event is an activity that has special importance. As told earlier the Event may come from a Hardware Unit, or a piece of Software. The Event that has occurred requires processing. Yes, processing of the Event by the CPU is the treatment for the occurred Event.
The processing of an Event by the CPU is called Event Handling. Event Handling is performed by Event Handler.
_________________________
Real Life Event Handler
_________________________
Let us suppose that one is watching a YouTube video. While one is in the middle of viewing, suddenly somebody rings the doorbell. This ringing of the doorbell can be treated as an Event.
As we said, an Event has to be handled immediately after occurrence. Yes, the doorbell requires immediate response ( handling ).
Now, the YouTube video is paused. The viewer attends the doorbell.
Attending the doorbell may require us to perform a set of activities. Finally, the doorbell issue is settled. We can say, the doorbell call is attended.
The set of activities that were performed are notable. These notable activities related to serving the purpose of the doorbell ring form the 'Doorbell Ring Handler'. 'Doorbell Ring Handler' can be likened to an Event Handler.
A return is required to the YouTube video. It was our parent activity that related to viewing the video content. The viewing activity was suspended to attend the doorbell call. The suspension does not stand.
We happily focus to view the YouTube video from the point where we had left. The viewing activity continues. Let us suppose there is no interruption onwards. So, we are able to watch the full video presentation.
This resumption of viewing can be likened to resumption of the Computer Program. The Computer Program was suspended at the occurrence of the Event.
The Computer Program is started from a point which lies next to the program instruction that the Computer was processing. During this processing activity the occurrence of the Event was observed. The instruction that was being executed at the time of the occurrence of the Event is finalized.
The processing activity of the rest of the Computer Program continues
Comments
Post a Comment