Stateful Real-Time Communication Rishi Bhat, Chris Walstad Advisors: Sebastian Fischmeister, Insup Lee

Abstract : Specifications : Example : • Generate a stateful from an input language. • Specifies periodic processes, nodes, communications among them, • Consider the following input to our scheduler, which has 4 tasks • Enforce deadlines in hard real-time systems via a scheduling and guards. running on 2 nodes. There are also 4 communications specified, and 2 that makes on-the-fly choices between communications to • Guards are defined to be functions executed by the scheduler that guards which make on-the-fly decisions between the communications. schedule on a network. makes on-the-fly choices between communications at run-time. • Generate network code to execute schedules on real-time systems // Task section (RTLinux). Scheduler : // Task ID, , Period, WCET, Transmission Time • Generates schedules for the communication medium as well as CPU 1, 1, 10, 3, 1 Background : schedules for each node. 2, 1, 20, 2, 1 • Time Division Multiple Access (TDMA) is a common media access • Schedules represented as a graph. 3, 2, 10, 5, 1 protocol to implement real-time communication. • Processes scheduled up to the least common multiple of their periods. 4, 2, 5, 1, 1 • TDMA provides guaranteed message delivery by assigning each • Network scheduler uses reverse earliest deadline first alrogithm; CPU // Communication section process a timeslot during which it may communicate. scheduler uses an earliest deadline first algorithm. // Sending Task.Port -> Receiving Task.Port • If dependencies between communications are known, state 1.1 -> 3.1 information can be used to optimize the schedule. Network Scheduling Algorithm : 1.2 -> 4.1 • Initialize the current time to lcm (T1, T2, …, Tn). 2.1 -> 3.2 Applications : • While current time > 0: 2.2 -> 4.2 • Distributed hard real-time embedded systems found in the • Pick the active communication, C, whose sending task // Guard section automotive, avionics, factory automation, and medical device domain. has the smallest slack. // Guard ID, Function, Input Task, True Branch, False Branch • Particularly useful for fault-tolerant applications, because the • If C is guarded 1, fun1, {2}, 1, 2 dependency between the primary and the backups is known. • Schedule C as well as all of its alternate 2, fun2, {1}, 3, 4 choices (specified by the guards) for the Technical Approach : current timeslot • The output from our scheduler is represented as a graph, which is • Else C is not guarded then input to our tool. • Schedule C for the current timeslot • Decrement current time by one. HW/SW Specifications • Update active tasks based on what was scheduled.

Network Code : • Assembly language-like instruction set consisting of the following: Scheduler Visualization Tool create (msgid, loc), destroy (msgid), future (dl, jmp), halt(), if (g, jmp), jmp (loc), receive (ch, loc), send (ch, msgid, relTime) • This network code along with associated stubs and shared variable • Note that the visualization tool also labels which communications space layout runs on a network code machine, which executes on are guarded. Network Code Generator RTLinux. • Possible choices for each timeslot are stacked vertically. It is and Optimizer possible to chain guards together to allow the scheduler to choose Network Code Example : between as many communications as desired, for a given timeslot. • Consider the following schedule, where a single communication (c1) is scheduled to transmit at time 9 from node 1 to node 2. Conclusions : • Created network scheduling algorithm which allows for on-the-fly Network Code Stubs, SVS layout choices. • Developed a network code . • Implemented a visualization tool for graphic representation of Program for Node 1 Program for Node 2 schedules. Network Code Machine /*0*/ future( 9, 2 ), /*0*/ future( 10, 2 ), /*1*/ halt(), /*1*/ halt(), /*2*/ nop(), /*2*/ nop(), /*3*/ create( 0, 1 ), /*3*/ receive( 1, 1 ), /*4*/ send( 1, 0, 1 ), /*4*/ jmp( 0 ), /*5*/ destroy( 0 ), /*6*/ jmp( 0 ), Senior Project Poster Day 2005, CIS Dept. University of Pennsylvania