Go-RealTime: Knowledge and Control of Time in High Level Programming Language
Abstract:
General purpose operating systems (OS) are concurrent and multithread, and the primary goal of thread scheduler is to enforce fairness among all threads. This design is unsuitable for Real-Time (RT) systems, because tasks have soft or hard deadline of finishing time. Concurrency breaks timing of RT applications because users never know when their program is actually running. Explicitly allocation of processor resource to programs (threads) is thus necessary for timing-aware applications. The allocation can be done manually by users or in a Time-Division (TD) approach, but they are usually inefficient. Real-Time scheduler is the solution. It takes timing requirement of program as input and provides a feasible schedule which guarantees all deadlines automatically. The information of Quality of Time (QoT) is important for the scheduler to make correct and efficient scheduling. It also helps reduce system overhead because improving timing quality is not free.
In this work, we design Go-RealTime, a new RT and parallel programming framework based on Go language. It integrates key functionalities of programming timing-aware applications into language runtime: QoT, RT Scheduler and Parallel Programming. Users can program a parallel task as Directed Acyclic Graph (DAG) of sub-tasks. Sub-tasks are executed by subroutines, so the overhead of unnecessary con-currency is saved. It supports multiple scheduling algorithms working in parallel. Different types of tasks are scheduled by the suitable algorithm (EDF, LLF). The total processor resources are partitioned dynamically among all schedulers by the resource balancing mechanism. Go-RealTime handles timing-aware asynchronous events via ‘check_async’ method. It checks all asynchronous events (timeout, message, etc.) and responds to the events which should have occurred. Source code of Go-RealTime programs is instrumented with check_async calls by Go parser library. The locations of calls are adjusted ahead according to measured timing profile. The calls are dynamically enabled/disabled to satisfy QoT requirement at runtime. Implementation results show that our framework is lightweight, flexible and efficient to deploy real-time programs on platforms ranging from embedded devices to large-scale servers. This work provides the software/programming language level support for the RoseLine QoT Stack.