I3ISU_Opgave9

Exercise 1 Completing the Linux skeleton of the OO OS Api
An OSApi is used to seperate a program from the OS it is written on. This means a program written in Linux can be easily ported to for example windows. Without changing anything in the program.



When making an OSApi, you have the ability to pack the system specific functions into other names and classes. Then you can use these new names and classes in your application, to make it easier, when porteing the program to a different platform. Eg. mutex.cpp as showen below code format="cpp"
 * 1) include 

namespace osapi { Mutex::Mutex {   pthread_mutex_init(&mutex_, NULL); }

void Mutex::lock {   pthread_mutex_lock(&mutex_); }

void Mutex::unlock {   pthread_mutex_unlock(&mutex_); }

pthread_mutex_t& Mutex::nativeHandle {   return mutex_; }

Mutex::~Mutex {   pthread_mutex_destroy(&mutex_); } } code The entire OS API can be found here //**Questions to answer:**// A multiprocessor system can run with many more threads than a single core. Thereby it can do more operations parralel than a single core which can only run sequentially.
 * // Why does the ThreadTest.cpp program behave differently depending on whether you are running it on a single processor or multi processor system and how is this experienced?//

CLOCK MONOTONIC is a time representation that shows the time elapsed since a fixed point. This means it is not affected by the system time. Therefore it is good for finding the elapsed time between events in a single system. Another clock setup example is CLOCK REALTIME, this is affected by the systems time and therefore is not good for representating time between two events. NTP does not have any influence on CLOCK MONOTONIC. This means NTP cannot ruin CLOCK MONOTONIC's time calculation.
 * // The file linux/Conditional.cpp//
 * In completing this file you will encounter the term CLOCK MONOTONIC. What does this mean and how does it distinguish itself from the other clock setup options that are possible?
 * Why could this possibly be important? Hint: NTP and setting time.

The smart thing about the structure is that we can define which OS to use in the header files and include them. This means the compiler can select the appropriate header file for that system, without us having to do anything.
 * //Inspecting the OSApi library, describe the chosen setup and how it works. Hint: Directory structure, define usage, handling platforms etc.//

Exercise 2 On target
//Comming Soon//

//**Questions to answer**//:
 * // Did you do need to change code for this to work, if so what?//

Exercise 3 PCLS now the OS Api
//Comming Soon//