This disclosure relates to smoothing periodic data channel access.
Embedded systems can have reduced capabilities compared to non-embedded systems. For example, embedded systems can have less powerful processors or less memory. In addition, embedded systems can have real-time processing requirements. Having less powerful processors and less memory can make successfully handling the real-time processing requirements more challenging.
Embedded systems can also comprise numerous components. These components may produce data that is consumed by a program running on the embedded processor. Components may generate data on a schedule. Accessing data by the embedded processor can result in bottlenecks or peaks of usage in terms of process utilization, memory utilization or both. Avoiding these usage peaks can be beneficial for embedded systems, especially due to the limited available resources. Removing such peaks can be beneficial to any computing system that consumes data.
In one aspect, in general, a system comprises: a memory configured to store a plurality of data units; a plurality of data sources, where each data source is configured to provide a respective data unit; and a processor configured to: determine a plurality of periods where each period of the plurality of periods is associated with a respective event and each event is associated with a different respective data source of the plurality of data sources providing a data unit, determine a plurality of adjusted periods, where each period of the plurality of periods is associated with a respective adjusted period of the plurality of adjusted periods, determine a respective order for each adjusted period of the plurality of adjusted periods, determine a number of adjusted periods associated with each of the orders, determine a number of time slots for a lowest order of adjusted periods based on the number of adjusted periods within each of the orders, and determine a start time for each event based on the order of the event and the number of time slots for the lowest order of adjusted periods.
Aspects can include one or more of the following features.
To determine the plurality of adjusted periods the processor is further configured to: determine the minimum period of the plurality of periods as pmin, and for each period of the plurality of periods calculate the corresponding adjusted period as pmin*2(floor(log
To determine the respective order for each adjusted period of the plurality of adjusted periods the processor is further configured to: sort the plurality of adjusted periods, and assign a unique order for each adjusted period of a same value, such that the plurality of adjusted periods have a highest order.
To determine the number of time slots for the lowest order of adjusted periods the processor is further configured to calculate a summation
where i is equal to the order, and ni is equal to a number of events in the order.
To determine the number of time slots for the lowest order of adjusted periods the processor is further configured to: determine a number of time slots for the highest order of adjusted periods as the number of adjusted periods in the highest order, and for each remaining order, determine a number of time slots for a current order as the number of adjusted periods in the current order plus a ceiling of the number of time slots of an immediately previous order divided by two, wherein the number of time slots is equal to the number of time slots for the lowest order.
To determine the start time for each event based on the order of the event the processor is further configured to: calculate pmin/(the number of time slots) to create time slots of the lowest order, and assign each event associated with the lowest order of adjusted periods to one of the time slots of the lowest order as the start time.
To determine the start time for each event based on the order of the event the processor is further configured to: for each remaining time slots of the lowest order, add pmin*2(i-1) to create time slots of a next order, where i is the order, and assign each event associated with adjusted periods of the next order to one of the time slots of the next order as the start time.
To determine the start time for each event based on the order of the event, the processor is further configured to either add an adjustment factor to or subtract an adjustment factor from least one start time.
The adjustment factor is within the range of plus or minus: pmin/(the number of time slots for the lowest order of adjusted periods).
The adjustment factor is based at least in part on a completion time associated with an event.
The system further comprises: a first component associated with a data unit provided by a first data source of the plurality of data sources; and a second component configured to be controlled by the processor; wherein the processor is further configured to: access the data unit of the first component at the determined start time, and control the second component based on the accessed data unit of the first component.
To determine the number of time slots for the lowest order of adjusted periods the processor is further configured to calculate
where i is equal to the order, and ni is equal to a number of events in the order.
Each event is associated with the processor accessing a respective data unit.
The processor accesses the data unit at the start time associated with the event or at a time that is the sum of the start time and an integer multiple of the adjusted period associated with the event.
The system further comprises a first component configured to be controlled by the processor; wherein a first data source of the plurality of data sources is configured to provide a data unit for each event of a plurality of events and the processor is configured to control the first component based at least in part on each data unit.
A first event of the plurality of events is the determined start time and each subsequent event of the plurality of events is a sum of the determined start time and an integer multiple of an associated adjusted period.
In another aspect, in general, a method for scheduling event start times for a system comprising a plurality of data sources, where each data source of the plurality of data sources is configured to provide a respective data unit, comprises: determining a plurality of periods, where each period of the plurality of periods is associated with a respective event and each event is associated with a respective data unit of a data source; determining a plurality of adjusted periods, wherein each period of the plurality of periods is associated with a respective adjusted period of the plurality of adjusted periods; determining a respective order for each adjusted period of the plurality of adjusted periods; determining a respective number of adjusted periods associated with each order; determining a number of time slots for a lowest order of adjusted periods based at least in part on the respective number of adjusted periods within each order; and determining an event start time for each event based at least in part on (1) the order of the event and (2) the number of time slots for the lowest order of adjusted periods.
Aspects can have one or more of the following advantages.
In some implementations, a system can be associated with a set of one or more events. In some examples, a schedule associated with the set of one or more events can be created. In some examples, this schedule can be associated with optimizing process utilization or memory utilization of a processor of the system.
In some implementations, creating a schedule of events for a system can be associated with efficient use of resources such as memory.
Other features and advantages will become apparent from the following description, and from the figures and claims.
The disclosure is best understood from the following detailed description when read in conjunction with the accompanying drawing. It is emphasized that, according to common practice, the various features of the drawing are not to-scale. On the contrary, the dimensions of the various features are arbitrarily expanded or reduced for clarity.
The invention can be implemented in numerous ways, including as a process; an apparatus; a system; a composition of matter; a computer program product embodied on a computer readable storage medium; and/or a processor, such as a processor configured to execute instructions stored on and/or provided by a memory coupled to the processor. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. In general, the order of the steps of disclosed processes may be altered within the scope of the invention. Unless stated otherwise, a component such as a processor or a memory described as being configured to perform a task may be implemented as a general component that is temporarily configured to perform the task at a given time or a specific component that is manufactured to perform the task. As used herein, the term ‘processor’ refers to one or more devices, circuits, and/or processing cores configured to process data, such as computer program instructions.
A detailed description of one or more examples of the invention is provided below along with accompanying figures that illustrate various features of the invention. The invention is described in connection with such examples, but the invention is not limited to any example. The scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications and equivalents. Numerous specific details are set forth in the following description in order to provide a thorough understanding of the invention. These details are provided for the purpose of example and the invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the invention is not unnecessarily obscured.
Some systems can be associated with a plurality of events that can each have an associated period such that the system is associated with a plurality of periods p0, p1, p2, . . . , pn. In one specific example, a schedule for a system can be determined by taking the smallest period pmin=min(p0, p1, p2, . . . , pn) and creating x evenly spaced “time slots” between time 0 and pmin that can then occur every pmin duration. This spacing can allow for each event to occur within pmin/x of another event. The length of each time slot is xts=pmin/x.
It will thus be seen that the objects set forth above, among those made apparent from the preceding description, can be efficiently attained and, because certain changes may be made in carrying out the above method and in the construction(s) set forth without departing from the spirit and scope of the invention, it is intended that all matter contained in the above description and shown in the accompanying drawings shall be interpreted as illustrative and not in a limiting sense.
In an example, the periods for each event can be adjusted down to the nearest power of two times pmin. In some examples, the adjusted periods can be written using the notation p′. For example, p′=(p′0, p′1, p′2, . . . , p′n) where p′n=pmin*2└log
Events with adjusted periods that are multiples of pmin can share a time slot with other events. In some examples, collision between events can be avoided because each event sharing a time slot can use every 2nd, 4th, 8th, etc. slot. This sharing can be seen in
As a specific example, assume a system is associated with a set of events (e0, e1, e2, e3, e4, e5). The periods (p0, p1, p2, p3, p4, p5) of the events are (100, 100, 150,300, 375, 600), respectively. The time units for the periods can be any time unit, such as but not limited to, nanoseconds, milliseconds, centiseconds, seconds, minutes, etc. As the units do not impact the determination of the schedule, the units are dropped for simplicity.
For this specific example, pmin=100. To determine the order of each event, the adjusted time periods p′n can be calculated, as shown in table 1.
As pmin is divided into x number of time slots, the value of x can be determined. The value of x can depend on the number of events as well as the period of those events. In one example, the number of time slots can be determined by starting with the highest order and working down to the 0th order. In this example, each step can be viewed as computing the number of time slots that would be necessary if that the smallest order. For the largest order, the number of time slots xi is the number of events ni in that order. Then, for each subsequent ith order, the number of time slots xi can be calculated from xi=ni+┌xi+1/2┐, where ni is the number of events in the order.
Continuing the specific example from above, the number of time slots is 5. The specific calculations are shown in table 2
In another example, the number of time slots may be calculated as:
Using this example, the number of time slots for the current example can be calculated as 5. The specific calculations are shown in table 3. As the sum in this example equals 4.25, the ceiling of this value is 5.
Now that the number of time slots has been calculated, the start time for each event can be determined. To start, the time slots for the lowest order of events are calculated as 0, pmin/x0, 2*pmin/x0, . . . , (x0−1)*pmin/x0. Continuing the specific example from above that has pmin=100, the time slots for the lowest order of events would be 0, 20, 40, 60, 80.
Once the time slots have been determined, the events in order 0 may be assigned to a specific time slot starting at time 0. In the above example, events e0, e1, and e2 would be assigned to time slots 0, 20, 40, respectively.
The remaining time slots, 60 and 80, can be used to determine where events in the next order, e.g., 1, can start. Each of the remaining time slots can be used to create a new time slot. In this example, the number of time slots is doubled. In one example, the new time slots can be calculated by adding pmin*2i−1 to each time slot. With i=1 the time added is simply pmin. Accordingly for this example, the new time slots become 60, 80, 160, and 180.
Once the new time slots are determined, events in the current order can be assigned to time slots. For example, e3 and e4 can be assigned to time slots 60 and 80 respectively. In one example, the remaining 160 and 180 time slots are used to calculate additional time slots for order 2 events. The amount of time to add to each time slot's starting point is pmin*22−1=200. The available time slots for order 2 events, therefore, become 160, 180, 360, and 380. The only event e5 in order 2 may then be assigned to start at time 160.
In other examples, as the number of events to assign is less than the number of available time slots, the calculations of new time slots can be skipped. In still other examples, whenever the number of unassigned events is less than or equal to the number of free time slots, the calculations for determining additional time slots can be avoided. For example, continuing the example from above, the time slot 180 was calculated in association with the three time slots 60, 80, and 160. However, because the example system only had three unassigned events (2 events from order 1 and 1 event from order 2), the calculation determining 180 could be skipped to save computation.
As another example, a set of events (e0, e1, e2, e3, e4) may have respective periods of (100, 150, 200, 300, 700). In this example, the periods are in units of milliseconds. Calculating the adjusted period as described above results in adjusted periods of (100,100,200, 200, 400). Continuing as described above, the starting times for these events would be (0, 25, 50, 75, 150).
As illustrated in
While the above examples describe how to calculate starting times for various events, the starting times for one or more events may be altered. In one example, the starting time for any may be modified by adding or subtracting a factor of at most pmin/x0 to each event. In practical terms, the times that can be added or subtracted may be pmin/x0−eventmax where eventmax is the maximum amount of time associated with completing an event. Other examples may also include eventavg or eventmin. In some examples, the factor may range from 0 to pmin/x0. In some examples, this factor may be added to one event, two events, three events, etc. In some examples, this factor may be added to all of the events. In one example, the factor may be a random number selected to be in the appropriate range. In another example, the factor may be based on the amount of time an event needs to complete. For example, an event may involve reading a sensor that is very fast. Another event may involve accessing data that has a longer delay. The factor selected for each event may be determined based on the delay or lack of any delay. For example, a slow event can have their start time moved back by subtracting a factor from an associated start time. Fast events may have their start time unchanged or moved up. Moving a start time can allow the earlier event to have additional time to complete, thus smoothing out the processor utilization. In one example, events in each order can be sorted by how quickly they are expected to finish. The fastest events may be assigned time slots first. In this example, the slowest event from one order can precede the fastest event in the next order for at least some time slots. In another example, the slowest and fastest events in the lowest order may be sorted, such that the slowest event precedes the fastest event. As the events are in the same order, the slowest event may start up to pmin/x0 earlier and the fastest event may be delayed up to pmin/x0. In this way, the slowest event can be given the most amount of time to complete while still allowing all events to be scheduled.
In some examples, each of the plurality of data units 306A-306N can be associated with a respective event. In some implementations, a processor 308 can be configured to compute or calculate quantities associated with each event to determine a schedule of start times for the events.
In some implementations, the system 300 can further comprise a first component 310 that is associated with a first data source 304A and a second component 312 that is configured to be controlled by the processor 308. In some examples, a processor 308 can be configured to access a data unit 306A associated with the first data source 304A at a determined start time and control the second component 312 based at least in part on the accessed data unit 306A.
As a specific example of how scheduling may work, an embedded system may include one or more circuit boards. In some examples, an atomic clock can be considered an embedded system. Some atomic clocks can comprise various data channels. The various data channels may provide various data about components of the atomic clock. Data from one component may impact the use of another component. For example, each circuit board may have various components that produce data. As an example, a system can comprise a temperature sensor that provides the temperature of a component. As another example, a component itself may provide access to data that indicates its temperature. In some examples, an embedded system can comprise one or more components that are configured to be controlled by the embedded system based at least in part on data accessed from a component. Without intending to be limiting, some examples of controllable components include mirrors, rotators, electro-optical devices, or thermo-optical devices. Some controllable components can be tuned to optimize performance of an embedded system. As one specific example, a diode temperature of laser may be monitored on a schedule. The embedded system or a processor thereof may use the diode temperature to determine if the laser is thermalized and may then proceed with tuning of other components.
While the disclosure has been described in connection with certain embodiments, it is to be understood that the disclosure is not to be limited to the disclosed embodiments but, on the contrary, is intended to cover various modifications and equivalent arrangements included within the scope of the appended claims, which scope is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures as is permitted under the law.
This application claims priority to and the benefit of U.S. Provisional Application Ser. No. 63/599,895, entitled “SMOOTHING PERIODIC DATA CHANNEL ACCESS,” filed Nov. 16, 2023, the entire disclosure of which is hereby incorporated by reference.
Number | Date | Country | |
---|---|---|---|
63599895 | Nov 2023 | US |