Threads and Scheduling
C 74.3%
C++ 14.3%
Nix 4.8%
Makefile 3.7%
Shell 2.9%
21 1 0

Clone this repository

https://tangled.org/stau.space/tsched
git@tangled.org:stau.space/tsched

For self-hosted knots, clone URLs may differ based on your setup.

README.md

tsched#

This project is the second assignment for CCOM-4017. Check out the instructions.

I am using a sockets library I developed mysel. For more information on how the sockets library was developed, feel free to visit the repo:

This sockets library relies on having GNU's version of the POSIX utilities that should be available on a POSIX compliant system. Additionally, I am using GNU's implementation of semaphores, although they are not POSIX, they should be available on most systems.

For threads, I am using a builtin library called threads.h. This library is documented on cppreference.com as:

From this library I used the functionality provided to create the threads and the mutex that they define.

Running#

If you would like to change the range of time that each program is sleeping, there is a macro called SLEEP_TIME defined in line 10 of ./src/edevice.c. Changing this to some other number n will change the range of times to be 0 to n - 1.

Cluster#

./build.sh cluster.py

This will simply run the cluster on the server's loopback 127.0.0.1 and on port 42069. If youu want to supply your own server and port, use:

./build.sh cluster.py server_address server_port

where server_address is the IPv4 address of the cluster, and server_port is the port number of the cluster.

Embedded device#

This is the same as the cluster. The default server and port are the loopback and 42069 respectively, and supplying the parameters for ADDRESS and PORT will let make know on which server and port you want to run it.

./build.sh edevice.py server_address server_port

where server_address is the IPv4 address of the cluster, and server_port is the port number of the cluster.

Building#

If you just want to build the files, run:

make .build/edevice

To build the embedded device and run:

make .build/cluster

To build the cluster. From these two executables, you can then run the programs like,

./.build/cluster server_address server_port
./.build/edevice server_address server_port

Contributions#

I would like to thank Gabriel Romero, Pablo Torres, Sergio Rodriguez and Anasofia Colon while developing this project. Without them, this project would have been impossible.