This site gives you access tothe course materials :
- L1 : Introduction (L1-SE205)
- L2 : Shared-memory model (L2-SE205)
- L3: Concurrency programming : C/POSIX
- Lab3 : TP – Concurrency programming : C/POSIX
- L4 : Concurrency programming : Java
- Lab4 : TP – Concurrency programming : Java
- L5 : Concurrency programming : patterns
- Lab5 : TP – Concurrency programming : patterns
- L6 : Network programming : sockets
- L7: The actor model (L7-SE205)
- L8: Transactional Memory (CM8-SE205)
Advice from ChatGPT for Lab 5 :
To implement a library similar to Java Executor Service in C, you will need to use C’s multithreading features such as POSIX threads and mutexes. Here is an example of what the implementation of such a library could look like in C:
- Create a data structure to store the tasks to be executed. This can be a linked list or a queue.
- Create a function to add tasks to the data structure. This function should take in a function to be executed and its arguments, and add it to the data structure.
- Create a function to start the tasks. This function should create a number of threads (for example, using the pthread_create function) and attach them to a function that will retrieve tasks from the data structure and execute them.
- Use mutexes and conditions to synchronize access to the data structure. This will ensure that one thread cannot read or write to the data structure at the same time as another thread.
It’s important to note that this is just a basic example and there could be improvements or additional features to implement depending on the needs of your application. It’s also important to note that the implementation of this library requires a good understanding of multithreading and data synchronization concepts, which can be complex and difficult to master. It’s therefore highly recommended to consult specialized resources to ensure the quality and security of your code.