Driven by Events
Event-driven systems are programs that handle events (input and output, timer expiration, clock-initiated tasks, exceptional situations detected by computer hardware or the program, or other conditions internal or external to the program) as they occur. In non-event-driven programs, these situations must be tested for at frequent points in the program. Operating systems, process control systems, simulation programs, and multi-threaded programs can be event driven.
In an event-driven system, all tasks are called by and return to a module known as the dispatcher. The dispatcher keeps track of all tasks, their state (ready, blocked, or terminated), and their priority. In process control systems and simulation systems, the dispatcher may also keep track of the time that a task is to start. When the dispatcher receives control, it selects the highest priority ready task, saves the context of the previously running task, restores the context of the selected task, and resumes the selected task. If there are no tasks ready, the dispatcher calls an "idle task", waits for an event to occur (in systems dedicated to a single application), or (if it is an application program) relinquishes control to the operating system. The dispatcher can be part of the operating system, the programming language run-time support, or the application program. A running task can voluntarily return control to the dispatcher to allow other tasks to be executed before the running task continues.
Most external events and some internal events cause an interrupt of the current task. Internal events can include memory page faults, arithmetic exceptions such as overflow or divide by zero, locks on shared resources, and hardware errors.
0 Comments:
Post a Comment
Please enter your comment here. Comments wil be reviewed before being published.
Subscribe to Post Comments [Atom]
<< Home