Implement spinlock/ticketlock with possible use of yield/sleep along with benchmarks for your algorithm.
To bring your code in compliance with my benchmarking 'framework', you should create pull request that:
- Creates subdirectory under 'implementations/' directory and puts
lock.{c,cpp,asm} file there. This file shall contain implementations
of functions that I will be able to call using prototypes stored in
benchmark/lock.h
. Also it should contain definition of struct lock also mentioned inbenchmark/lock.h
. - Adds line to list_of_implementations.txt (optional)
- Adds name of your implementation to
IMPLS
variable in Makefile.
lock.c
file put in newly created directory under implementations/
directory will be automatically compiled to implementations/%/lock.o
.
Most probably some of you would want to use C++, in this case for the code to be linked successfully declarations of your functions shall look like this:
extern "C"
{
void* lock_alloc(long unsigned n_threads);
int lock_acquire(void* arg);
int lock_release(void* arg);
int lock_free(void* arg);
}
Alternatively you may just include "lock.h" file and declare your functions in conformance with it.
TODO