Linux C PID Manager Program

Download Solution: Click to Download Solution
Solution File Name: SyncC.rar
Unzip Password: prestobear.com

Problem:
A solution to the pid manager problem


1.pid.h.
#include < sys/types.h >
#define PID_MIN  	300
#define PID_MAX 	350
#define NUM_THREADS 100
#define ITERATIONS	10
#define SLEEP		5

int S;
//int thread_counter = 0;

//extern pthread_mutex_t mutex;
pthread_mutex_t mutex;

int* pid_map;

int allocate_map(void);
int allocate_PID(int thread_id); 
void release_pid(int pid);

2.pid.c
#include " pid.h "
#include < pthread.h >
#include < stdio.h >
#include < unistd.h >
#include < time.h >

//pthread_mutex_t mutex;
//pthread_mutex_init(&q->mutex, NULL);

//Allocates the pid map 
int allocate_map(void) {
    
}

//Allocates a pid
int allocate_PID(int t_id) {

}

//Releases a pid
void release_pid(int pid) {

}

3.test.c
#include " pid.h "
#include < pthread.h >
#include < stdio.h >
#include < unistd.h >
#include < time.h >

//pthread_mutex_t mutex;
//pthread_mutex_init(&q->mutex, NULL);

int thread_counter = 0;

void *do_something(void *threadid) {

}
	
int main() {

}

Add Comment