LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   Cost of user-kernel mode switch (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/cost-of-user-kernel-mode-switch-858209/)

dbadhani 01-23-2011 07:27 PM

Cost of user-kernel mode switch
 
Hi,

I am working on a high performance proxy service and in the process was trying to find out the cost incurred in "user -> kernel" mode or "kernel -> user" mode transitions. If the cost is not significant, I could the existing kernel stack else will have to work on a user mode driver.

Would appreciate if anyone has some insights, benchmarks for the same or can sugget a good way to benchmark this.

Thanks,
Dev

Oliv' 01-25-2011 12:04 AM

Hello,

Well I am not an expert in this but it seems that any literature you will find on this topic will state that user/kernel mode switch is costly. But it seems difficult to find benchmarks.
Anyway I answer you just to share with you this link: http://web.yl.is.s.u-tokyo.ac.jp/~tosh/kml/
I hope you'll find it useful.

Regards,

Oliv'

dbadhani 01-26-2011 11:40 PM

Thanks Oliv. There is some latency associated with mode switch, though the consensus is that its not as expensive as it used to be.
I was trying to get an estimate on what the cost is, relative to actual processing.
I did some tests myself with a 2Ghz processor, a single mode switch seems to be taking 150 cycles, so looks like not that bad.

Oliv' 01-27-2011 01:21 AM

Hello,

yes that's not so much time... also it will depend on how many times your application will do some context switch ;)
By the way, as I am curious, I have continued my search on the subject and found this page: http://blog.tsunanet.net/2010/11/how...e-context.html where you will find interesting benchmarks about context switch.

Regards,

Oliv'


All times are GMT -5. The time now is 01:45 AM.