diff --git a/README.md b/README.md index 1d86c81acbee93a5f3c54130ab7704d96841f88a..1caadb2cc9e0971721cc5fdffda4e01aaffbb7d0 100644 --- a/README.md +++ b/README.md @@ -21,48 +21,53 @@ Provide an explanation on threads --- -## 2. Task 1 - Fiber Class design and implementation +## 2. Task 1 - Fiber Class design and implementation (Part 1) ### 2.1 Explanation -Task 1 involves the implementation of a context switching system for fibers in C++ and focuses on saving and storing the execution state of a program, which enables the switching between alternate execution paths. - -The process will involves the manipulations of stacks as well as CPU registers and instructions pointer which will be execcuted via assembly functions. The objective is to create an implementaton that will allow the user to switch manually in between functons (fibers), which will simulate cooperative multitasking on a single thread. +The first part of task 1 explores the basics and implementation of context switching, which focuses on saving and restoring the program's execution state. We implement a simple mechanicsm in order to pause and continue execution by using a context library. -### 2.2 Part 1 - Basic Context Switching +### 2.2.1 Implementation -The first part of task 1 explores the basics and implementation of context switching, which focuses on saving and restoring the program's execution state. We implement a simple mechanicsm in order to pause and continue execution by using a context library. -#### 2.2.1 Implementation +#### Variable declaration ``` cpp volatile int x = 0; +``` +#### Retrieve Context -int main() { - - x = 0; - +``` cpp Context c; - get_context(&c); + get_context(&c); +``` + +#### Ouput +``` cpp std::cout << "a message" << std::endl; +``` +#### Conditional Check and Context Switch +``` cpp if (x == 0) { x = x + 1; set_context(&c); } - - return 0; -} ``` -#### 2.2.2 Testing -screenshot here -### 2.3 Part 2 +## 2. Task 1 - Fiber Class design and implementation (Part 2) + + + + + + + + ---- ## 3. Task 2 - Implementing a Scheduler for Fiber Execution