Can someone help me to create a priority level code using c programming for schudling.

Recommended Answers

All 3 Replies

That is Os dependant - what OS?

That is Os dependant - what OS?

Linux

#include <unistd.h>
#include <errno.h>

int change_priority(int value)
{
     int retval=0;
     errno=0;
     retval=nice(value);
     if(errno && retval=(-1) )
     {
          perror("Error setting priority");
          return 1;
     }
     return 0;
}

read the man 2 nice page - nice values work backwards - negative numbers increase priority, for example, and require privilege.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.