0

I want to modify the android scheduler "CFS" by myself.

I want to to assign a real-time priority to the user interactive task distinguished by heuristic or what so ever.

So, I just want to modify android kernel, build my modified kernel and research the performance.

How can I do this?

Peanut
  • 3,753
  • 3
  • 31
  • 45
YoungIn Lee
  • 45
  • 1
  • 8
  • still quite unsure of your intention; if u want to increase the priority of the procss, just use the userspace syscall "nice" to change will do? – Peter Teoh Jul 26 '15 at 14:35
  • Actually I know about that there is some kind of heuristic to distinguish which one is user interactive task/Time sensitive task. So, depending that result, kernel automatically allocate proper priority. ( nice value 0 to user interactive task), What I want to do is modify that part. Not allocate nice value 0 ( Default priority ), but allocate real time priority to user interactive tasks automatically. – YoungIn Lee Jul 27 '15 at 08:29

1 Answers1

2

To modify the Android's kernel scheduling policy is unlikely to be allowed from a security point of view. But based various features of "realtime" you can always make your program meets these requirements:

a. Responsiveness: by ensure the input loop is as efficient as possible and always responding as fast to input as possible. In the Linux kernel this is done through "voluntary preemption".

b. Low latency: by piecing every jobs into as small a piece as possible so that control can be passed back to respond to input, or in the case of audio, control can be issued at a precise start of the clock (SCHED_DEADLINE scheduling). Android does have some API for this:

http://source.android.com/devices/audio/latency_design.html

In general changing priority is not ideal to solve the realtime requirement (eg, giving higher priority to one process may end up having another process suffering in performance). What is actually done (eg, LynxOS, a realtime OS used in Missile system, and is not Linux, but some of its component like TCP/IP is from FreeBSD) is to tune the system so that it perform at the level with lots of spare hardware capacity. So in LynxOS a lot of the system threshold limits are very low, so the hardware is always free enough to respond quickly to input events.

https://github.com/keesj/gomo/wiki/AndroidScheduling

Android Low latency Audio using SoundPool

Low-latency audio playback on Android

Community
  • 1
  • 1
Peter Teoh
  • 6,337
  • 4
  • 42
  • 58