Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable MMCSS in C# app?

I want to try Multimedia Class Scheduler Service http://msdn.microsoft.com/en-us/library/ms684247(v=VS.85).aspx

I hope it can reduce latency by scheduling my threads better.

How can it be done in C# ?

Note: my app is nothing to do with multimedia I just need features of MMCSS.

like image 334
Boppity Bop Avatar asked Oct 22 '25 09:10

Boppity Bop


1 Answers

Each thread that is performing work related to a particular task calls the AvSetMmMaxThreadCharacteristics or AvSetMmThreadCharacteristics function to inform MMCSS that it is working on that task.

It would seem all you need is to P/Invoke one or other of those API calls.

However, I suspect all that will be in vain when the garbage collector steps in and messes things up.

Have you done any profiling of the app to see what's going on under the covers? If you app is truly that latency sensitive then C# is probably the wrong choice of language to be honest.

like image 107
Paolo Avatar answered Oct 24 '25 01:10

Paolo