1 / 9

Chapter 11: Distributed Processing Variations of subprogram control

Chapter 11: Distributed Processing Variations of subprogram control. Explicit call statements Exception handlers Subprograms must execute completely Co-routines Control must be transferred immediately Scheduled subprograms Single execution sequence Parallel programming.

zinna
Download Presentation

Chapter 11: Distributed Processing Variations of subprogram control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 11: Distributed ProcessingVariations of subprogram control • Explicit call statements • Exception handlers • Subprograms must execute completely • Co-routines • Control must be transferred immediately • Scheduled subprograms • Single execution sequence • Parallel programming

  2. Exceptions and exception handlers • Exception Handlers are subprograms that are not invoked by explicit calls • Special situations, called exceptions: • Error conditions • Unpredictable conditions • Tracing and monitoring

  3. Exceptions and exception handlers • Exception handlers typically contain only: • A set of declarations of local variables • A sequence of executable statements • Exception Handlers can be • predefined in the language • programmer defined

  4. Raising and catching an exception • Languages provide methods for raising (throwing) and testing for exceptions. • try{ • statement1; • statement2; • … • ifbadCondition throw ExceptionName; • } • catch ExceptionName • { ……….// do something for exception…….}

  5. Implementation • .Operating system exceptions - raised directly by hardware interrupts. • .Programmer defined - • the translator inserts code to handle the exceptions.

  6. Coroutine A Coroutine B Resume A Resume B Resume A Resume B Resume B Co-routines Subprograms that can return control to the caller before completion of execution.

  7. Implementation of co-routines Similar to the simple call-return structure, the difference is in handling the CIP. Each co-routine has IP location in its activation record, used to provide the value for CIP on resuming the execution.

  8. Scheduled subprograms • Subprograms scheduling techniques: • Execution after other subprograms – call B after A • Execution when a Boolean expression is true – call B when X=5 • Execution on the basis of a simulated time scale - call B when time=25 • Execution based on priority – call B with priority 7

  9. Implementation of scheduling techniques Scheduling is a run-time activity. The process is controlled (usually) by a system-defined scheduler program that maintains a list of currently scheduled subprogram activations.

More Related