From c2ffd25c72b2b5c526f7dc0cb67aa080318fcdd0 Mon Sep 17 00:00:00 2001
From: j2-tulloch <james2.tulloch@live.uwe.ac.uk>
Date: Sat, 6 Jan 2024 10:20:36 +0000
Subject: [PATCH] Update file readme.md

---
 Assignment/Task 3/readme.md | 77 +++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/Assignment/Task 3/readme.md b/Assignment/Task 3/readme.md
index 8b13789..a6897f9 100644
--- a/Assignment/Task 3/readme.md	
+++ b/Assignment/Task 3/readme.md	
@@ -1 +1,78 @@
+James Tulloch - Student No: 21032766
 
+README
+
+Task 1
+
+Implement a basic fiber system.
+
+Output:
+
+a message 
+a message
+
+foo 
+goo
+
+
+[!To run this file:]
+1. g++ -o contextswitch basiccontextswitch.cpp -m64
+./contextswitch
+
+2. g++ -o foogoo FiberFooGoo.cpp context.s -m64
+./foogoo
+
+Description:
+A fiber class for the two fibers, foo and goo is implemented. Foo and Goo can be called and context can be switched between the two fibers
+
+Task 2
+
+Implement the scheduler class. 
+
+Output:
+
+fiber 1: 10
+fiber 2: 11
+
+[!To run this file:]
+g++ -o program main.cpp fiber.cpp scheduler.cpp context.s -std=c++11 -m64
+./program
+
+Description:
+The foo and goo implementations are extended and now called fiber 1 and fiber 2. A scheduler object and two fiber objects are created. The spawn method is used to add the fibers to the scheduler. The do_it method is called to start executing the fibers.
+
+Task 3
+
+Implementing yeilding and testing.
+
+Output:
+
+Entering
+Switching fiber
+fiber 1 before
+Switching fiber
+fiber 2
+Exiting
+
+[!To run this file:]
+g++ -o program main.cpp fiber.cpp scheduler.cpp context.s -std=c++11 -m64
+./program
+Test file: 
+g++ -o program2 test1.cpp fiber.cpp scheduler.cpp context.s -std=c++11 -m64
+./program2
+
+Description:
+
+Extended the fibers to support a yielding function, allowing them to pause execution and give back control to the scheduler. It creates two fibers, f1 and f2, using lambda functions.The fibers are then spawned using the spawn function of the scheduler object s. The do_it function of the scheduler is called to start executing the fibers.
+
+Test Cases:
+
+- I ran out of time for tests, unfortunately a segmentation fault is produced by the testing file.
+
+* Main Function: Check the main function returns 0.
+* Spawn two fibers: Check the spawning system works as expected. 
+* Null Pointer to spawn function: Check an exception is thrown
+* Null Pointer to Fiber constructor: Check an exception is thrown. 
+* NUll Pointer to do_it(): Check an exception is thrown. 
+
+( Why i've got a segfault instead of correct tests is likely the null pointers.)
\ No newline at end of file
-- 
GitLab