In Chapter 10, The CPU Scheduler – Part 1, in the Threads – which scheduling policy and priority section, you learned how to query the scheduling policy and priority of any given thread via chrt(1) (we also demonstrated a simple bash script to do so). There, we mentioned the fact that chrt(1) internally invokes the sched_getattr(2) system call in order to query these attributes.
Very similarly, setting the scheduling policy and priority can be performed either by using the chrt(1) utility (making it simple to do so within a script, for example), or programmatically within a (user space) C application with the sched_setattr(2) system call. In addition, the kernel exposes other APIs: sched_{g,s}etscheduler(2) and its pthread library wrapper APIs, pthread_{g,s}etschedparam(3) (as these are all user space APIs, we leave it to you to browse through their man pages...