Docsity

Event Scheduling in Computer Simulation: Structured Event Scheduling and Dynamic Hashing -, Study notes of Computer Science

Toggle sidebar
bg1
CAP 4800/5805 Computer Simulation Concepts
Lecture 10 and 11
Structured Event Scheduling
• In the event scheduling method, a global future event data structure controls the
simulation, while individual block elements submit events to occur to the data
structure.
• The “occurrence” of an event means to execute an event routine which handles the
semantics associated with that event.
• Basic cycle for an event scheduling
pf3
pf4

Partial preview of the text

Download Event Scheduling in Computer Simulation: Structured Event Scheduling and Dynamic Hashing - and more Study notes Computer Science in PDF only on Docsity!

CAP 4800/5805 Computer Simulation Concepts

Lecture 10 and 11

Structured Event Scheduling

  • In the event scheduling method, a global future event data structure controls the simulation, while individual block elements submit events to occur to the data structure.
  • The “occurrence” of an event means to execute an event routine which handles the semantics associated with that event.
  • Basic cycle for an event scheduling
  • The key operations to the data structure o Enqueue: insert a time-tagged event into the data structure so that the structure maintains its ordered sequence o Dequeue: delete the event in the data structure that has the minimum time o Cancel: cancel the event in the data structure with a specified time or event identification
  • Three major categories of data structure: list, tree and table
  • Linear list method: linked list and array
  • Tree method o Binary search tree

Algorithm for Dynamic Hashing Operation Procedure HashEnqueue(X) Hash to the appropriate bucket using a modulus and a hashing function applied to X Double the hash table size if the number of events is greater than 2 * number of buckets End HashEnqueue

Procedure HashDequeue Search all buckets for the event with the minimum time (make sure that time is within the current year) If no events are found for this year (a year of empty buckets), then take the minimum time event Remove the item from the table Halve the hash table size if the number of events is less than 0.5 * number of buckets End HashDequeue

Procedure HashCancel(X) Hash to appropriate bucket by applying the hashing function to X Locate X and remove it from the bucket list End HashCancel