Skip to content
Snippets Groups Projects
Commit 84ae081e authored by j2-seechurn's avatar j2-seechurn
Browse files

Update file README.md

parent e8069d62
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@
6. [Task 2 - Part 3](#3-task-2---implementing-a-scheduler-for-fiber-execution)
7. [Task 3 ](#4-task-3---fiber-yielding-and-cooperative-multitasking)
8. [Task Extra ](#4-task-3---fiber-yielding-and-cooperative-multitasking)
9. [Unit Testing ](#4-task-3---fiber-yielding-and-cooperative-multitasking)
## 1. Introduction
......@@ -28,22 +29,6 @@
In this assignment, we are given the task of the implementing a simple runtime that will support cooperative tasks running within a single thread in c++.
### 1.2 What is a Fiber ?
Provide an explanation on fibers
### 1.2 What is a Thread ?
Provide an explanation on threads
---
## 2. Task 1 - Fiber Class design and implementation (Part 1)
......@@ -790,9 +775,9 @@ As shown in the screen shot the system was able to work successfully.
In order to achieve beyond 72 marks, additional features will need to be added that has not been covered in the spcification. Here are the extra features that have been added to further extend the fiber system:
#### 7.1.1 Fiber Priority System
#### 7.1.1 Fiber Priority System
The priority system is a feature that will allow the fiber to be scheduled based on their priority level rather than a FIFO queue. Instead, the Fiber the higest priority will be executed by the others that have a lower priority.
The priority system is a feature that will allow the fiber to be scheduled based on their priority level rather than a FIFO queue. Instead, the Fiber with the highest priority will be executed before others with a lower priority.
#### 7.1.2 Fiber State Monitor
......@@ -808,6 +793,10 @@ The Fiber state monitor will keep track and update the Fibers status of each fib
#### 7.2.1 Fiber Priority System
This code snippet shows the priroity system implemented into the Fiber Class,
adding the the methods to both get and set priorites to the Fibers. This will
allow the fibers created to have different priority levels.
``` cpp
class Fiber {
private:
......@@ -825,6 +814,10 @@ public:
#### 7.2.2 Priority Based Scheduling
This code snippet shows the priority based scheduling by replacing the FIFO queue with
a priority queue. The comparator makes sure that the Fiber with the highest priority
is executed first.
``` cpp
struct FiberComparator {
bool operator()(Fiber *f1, Fiber *f2) {
......@@ -858,6 +851,9 @@ public:
#### 7.2.3 Fiber State Monitor
This code snippets shows the different states the Fibers will enter during its execution
cycle.
``` cpp
enum class FiberState {
CREATED,
......@@ -873,6 +869,8 @@ enum class FiberState {
#### 7.2.4 State Tracking in Fiber Class
``` cpp
class Fiber {
private:
......@@ -934,10 +932,34 @@ As shown in the screen shot the system was able to work successfully.
![Task 4 Output](Screenshots/task4.png)
### 7.4 Unit Testing
## 8. Unit Testing
### 8.1 Explanation
| Test No. | Test | Purpose | Pass |
|:--------:|:---------------------|:--------------------------------------------|:------------:|
| 1 | Basic Tests | Verify basic fiber initialization | ✔ |
| 2 | State Tests | Test state transition functionality | ✔ |
| 3 | Priority Tests |Test priority assignment and modification | ✔ |
| 4 | Memory Tests |Verify memory allocation for fiber | ✔ |
| 5 | Data Tests |Test data management | ✔ |
| 6 | Multiple Fiber Tests |Test priority relationships | ✔ |
| 7 | State Logging |Verify state transition logging | ✔ |
### 7.3 Testing & Results
In order to run:
- Move to the Novelty Feature directory using the follwing commands:
- `cd Novelty_Feature`
- `cd src`
- `cd Fibers`
- Once in the Directory, we run the next command:
``` ./test_fiber```
#### 7.4 Screenshot (Unit Test Output)
![Task 4 Output](Screenshots/unit_test.png)
## 8. Conclusion
## 9. Conclusion
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment