Select Page

Inverse Pendulum

Priority-based scheduler for multithreaded system

1.1Scheduler
In ARM (Advanced RISC Machines) processors, a scheduler is a component of the operating system (OS) that
manages the allocation of CPU (Central Processing Unit) time to various tasks or threads. The scheduler
determines which task or thread should be executed next based on criteria such as priority, time slice, and I/O
wait time. The ARM scheduler is typically implemented as part of the operating system’s kernel. The scheduler
must balance the needs of multiple tasks or threads running simultaneously on the CPU while also ensuring
that each task gets the necessary resources to execute efficiently. This requires sophisticated algorithms that
take into account the relative priorities of tasks, their I/O and memory requirements, and their time-slice needs.
Several scheduling algorithms can be used in ARM-based systems, including:
1. Round-Robin Scheduling: This algorithm assigns a fixed time slice to each task in turn, and when the
time slice expires, the next task in the queue is selected to run.
2. Priority-Based Scheduling: This algorithm assigns priorities to each task, and the task with the
highest priority is selected to run first. The priorities can be static or dynamic, depending on the system’s
requirements.
3. Fair Share Scheduling: This algorithm allocates CPU time based on the relative resource requirements
of each task, ensuring that each task gets a fair share of the CPU time.
Overall, the scheduler plays a critical role in ensuring that the ARM processor runs efficiently and optimally,
allowing multiple tasks to run concurrently while maintaining overall system performance.
1.2Priority-based Scheduling
Priority-Based Scheduling is a scheduling algorithm used in operating systems to determine which task or thread
to execute next based on their priority level. Each task or thread is assigned a priority value, typically numeri-
cal, indicating its importance or urgency. The higher the priority value, the more important or urgent the task
is considered.
A priority-based scheduler selects the task or thread with the highest priority to run first. If there are
multiple tasks or threads with the same highest priority, the scheduler selects the one that has been waiting
for the longest. This ensures that the most important or urgent tasks are executed first and helps reduce the
waiting time for lower-priority tasks.
The priority values assigned to tasks or threads can be static or dynamic. In static priority scheduling, the
priority value is fixed and does not change during the task’s lifetime. In dynamic priority scheduling, the priority
value can change during the task’s lifetime based on various factors, such as behavior, resource requirements,
and external events.
Priority-based scheduling is commonly used in real-time operating systems where certain tasks require im-
mediate attention and have higher priority levels than others. However, it can also result in lower-priority tasks
being starved of CPU time if higher-priority tasks are continuously added to the system. To prevent this, some
scheduling algorithms use aging techniques, where the priority of a task gradually increases over time if it is not
being executed to ensure that lower-priority tasks are eventually given a chance to execute.
Note: Please find the respective code and demo video in the file.

2Oscilloscope using Tiva Board
2.1Introduction and other details
OSCILLOSCOPE USING TIVA BOARD
Tiva LaunchPad boards are microcontroller development boards that use ARM Cortex-M4F processors. These
boards can be used to create a basic oscilloscope using the built-in ADC (Analog-to-Digital Converter) and
DAC (Digital-to-Analog Converter) peripherals.
To create an oscilloscope using a Tiva board, you will need the following components:
1. Tiva LaunchPad board
2. Breadboard
3. Jumper wires
4. Resistors
5. Capacitors
6. Potentiometer
7. USB cable
2.2Flow Chart

 

 

 

 

 

 

 

2.3Limitations
Frequency range: 20 Hz to 2 kHz; smooth sine/square and triangular waves are coming for this range only.
Requirement of Offset voltage: As ADC of ARM microcontroller doesn’t support a negative value, we need
extra offset voltage to level shift all the negative values, and that can be adjusted while printing on the computer
screen.

Code:Inverse pendulumcode

Demo:

video Oscilloscope using tivaBoard

video Implement priority based scheduler for multithreaded system