Compare commits
2 Commits
f93eba6eb9
...
552f95fe99
Author | SHA1 | Date | |
---|---|---|---|
552f95fe99 | |||
e0a1232987 |
@ -4,4 +4,5 @@
|
||||
4. The print thread will wait on the sim sem for each CPU thread, and this should leave the sem at 0 again.
|
||||
5. At the end of the print function, before the simulation is allowed to print again, the print thread will increase the time, and then post to the sim sem for each CPU thread, so the simulation can start again.
|
||||
6. Repeat steps 3-5 until the simulation is done.
|
||||
7.
|
||||
|
||||
This is the general process, at least at the time I wrote this down lmao
|
23
Assignment5/README.md
Normal file
23
Assignment5/README.md
Normal file
@ -0,0 +1,23 @@
|
||||
# How to run
|
||||
|
||||
To compile please run:
|
||||
```shell
|
||||
gcc -Ilib lib/process.c lib/queue.c hard_affinity.c
|
||||
```
|
||||
|
||||
And to run please run:
|
||||
```shell
|
||||
./a.out < example.txt
|
||||
```
|
||||
|
||||
# In case of error
|
||||
|
||||
If that command to compile does not work, please place all C and C header files in the same directory and run:
|
||||
```shell
|
||||
gcc process.c queue.c hard_affinity.c
|
||||
```
|
||||
|
||||
In case you need to move the files, for easy copying:
|
||||
```shell
|
||||
mv lib/process.c . & mv lib/queue.c . & mv lib/queue.h . & mv lib/process.h .
|
||||
```
|
@ -4,6 +4,22 @@
|
||||
#include <stdlib.h>
|
||||
#include "lib/queue.h"
|
||||
|
||||
/*
|
||||
* Marker, please read:
|
||||
*
|
||||
* There is a bug that I cannot track down/may be unsolvable with my current implementation.
|
||||
* It's where *sometimes* the print function, after a thread finishes, it will print an extra time on one job (I think)
|
||||
*
|
||||
* This could probably be solved by running the "done threads" until all threads are complete, but I didn't have time to bugfix that
|
||||
* implementation. I tried it, but it didn't work as is, so I reverted it.
|
||||
*
|
||||
* With that implementation it may have been beneficial to have an array of semaphores, one for each "CPU", that the print thread
|
||||
* can for loop wait on each to complete. I think that would have worked, but I straight up didn't have time to implement it or try at all
|
||||
*
|
||||
* The comments may also not be the most helpful, didn't have time to go and clean them up
|
||||
*/
|
||||
|
||||
|
||||
#define MAX_USERNAME_LENGTH 100
|
||||
int *QUANTUM;
|
||||
int CPUS;
|
||||
|
BIN
Assignment5/submissions/Assignment5.zip
Normal file
BIN
Assignment5/submissions/Assignment5.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user