I want to build a new OpenBSD kernel image that has support of more than 100 kernel threads to test system performance with this support, against OpenBSD kernel than has support of few kernel threads. So, I want to know how can I tune kernel thread parameter or flag (using either sysctl or ulimit or something else) to add maximum kernel thread support?

Oh, before you invest a great deal of time and effort in threading technologies, you may want to review some of the more enlightening and interesting responses to the initial post in the misc@ thread that begins here:

Just one more clarification. Rthreads in OpenBSD is entirely experimental. It requires a custom kernel, and a replacement of the libpthread library, several unique patches, and AFAIK, has not been touched since 2008.

Actually I already have some idea about that that threads are handles by userland libraries like pthread(POSIX), but my requirement is such that is some what similar to linux kernel threads which can be tuned thru proc as max-threads. So I need some solution on the similar line.

But Rthreads as you said, I can explore more and find apply some kernel patches so that those will be useful somwhow.

I'm afraid you are using the wrong OS if multithreading performance is your numero unno concern. It's just one of those technologies that hell will freeze over before OpenBSD makes a huge dive towards it. Look towards multiple processes where possible in unix systems.

Multi processes can be changes dynamically in openbsd and i have tested with that change already, but didn't get much performance gain, so looking into some multithreading sort of solution that would be useful. I have some idea that there is one kernel variable for threading in openbsd which can be set thru but it was long time back when i did that,so won't that actually that's why exploring forums to get to know about that..[Hoping to remember that soon...][/Hoping to remember that soon...]