Professional Documents
Culture Documents
Project Os Lab
Project Os Lab
Scope:
• Develop a C++ implementation of the Cyclic Executive scheduler.
• Define a fixed sequence of tasks and frame periods.
• Assess the predictability, jitter, and CPU overhead of the Cyclic Executive scheduler.
• Implement a Time-Slice Round Robin scheduler for comparison.
• Conduct performance evaluations under various workload scenarios
C++ Implementation:
#include <iostream>
#include <vector>
#include <chrono>
#include <thread>
using namespace std;
// Task structure
struct Task {
int id;
int execution_time; // Time taken by task to execute
};
int main() {
// Define tasks with their execution times
vector<Task> tasks = {{1, 20}, {2, 15}, {3, 25}};
int frame_period = 50; // Frame period for Cyclic Executive scheduler
int time_slice = 10; // Time slice for Round Robin scheduler
Performance Assessment:
• Predictability: The Cyclic Executive scheduler offers high predictability as tasks are
executed in a fixed sequence within predefined time frames. In contrast, the Round
Robin scheduler may have lower predictability due to task preemption and dynamic
scheduling decisions.
• Jitter: The Cyclic Executive scheduler minimizes jitter as tasks execute within fixed time
frames. The Round Robin scheduler may introduce jitter due to task preemption and
varying execution times within time slices.
• CPU Overhead: The Cyclic Executive scheduler typically incurs lower CPU overhead since
it avoids frequent context switches compared to the Round Robin scheduler, which
involves task preemption and context switching.
Advantages:
• Fairness: Time-Slice Round Robin ensures fairness among tasks by providing each task
with a fair share of CPU time.
• Multitasking Support: This scheduler allows concurrent execution of multiple tasks,
making it suitable for multitasking environments where tasks have varying priorities and
execution requirements.
Disadvantages:
• Higher Jitter: Task preemption and context switches introduce jitter, as the execution
times of tasks may vary due to scheduling decisions.
• Lower Predictability: The dynamic nature of task scheduling in Time-Slice Round Robin
can lead to less predictable behavior compared to a Cyclic Executive scheduler.
• Increased CPU Overhead: Context switching incurs overhead due to saving and restoring
task contexts, leading to higher CPU utilization compared to a Cyclic Executive scheduler