Disabling Thread Preemption on Solaris 9

Hi,Is there any way to turn off thread preemption on Solaris 9?I want to prevent my application thread from being swapped out.-Richard
[162 byte] By [s98felixa] at [2007-11-26 20:39:01]
# 1

I'm not sure exactly what you're asking, but I think no.

The operating system must always be able to preempt any user-level thread to be able to execute kernel-level code. This is true even on a multi-processor machine.

Of course thread preemption and swapping out a process aren't entirely the same thing. There are some additional techniques to lock memory into place.

Are you seeing a situation where resources are available but your application is being swapped or paged out?

--

Darren

Darren_Dunhama at 2007-7-10 1:56:16 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 2

I think I misleadingly used the term "swap out." Let's focus on the thread preemption only.

I'm experimenting with a computer architecture simulator, but it can't handle thread preemption correctly. So whenever a user-level thread gets preempted, the simulation crashes.

I tried to workaround this by running 15 user threads on a 16-CPU machine, leaving one dedicated CPU for the kernel. I bound each of those 15 threads to a separate, dedicated CPU. But this doesn't seem to help.

I need something like kpreempt_disable() in /usr/include/sys/disp.h to prevent my user-level threads from being preempted. However, that macro seems to be enabled in kernel code conly.

-Richard

s98felixa at 2007-7-10 1:56:17 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 3

you can't disable preemption completely from userland but you can get quite close by

1) create a processor set using 15 of your 16 cpus, use -f option to disable interrupts

on those 15 cpus

2) run your program in that processor set

3) bind a thread to each of the 15 cpus

4) run each thread in a realtime scheduling class

that will ensure your threads get 100% of the cpus. But interested minds do wonder

why your simulator has problems with thread preemption?

thanks

tim

tim.uglowa at 2007-7-10 1:56:17 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...
# 4

> 1) create a processor set using 15 of your 16 cpus,

> use -f option to disable interrupts

> on those 15 cpus

> 2) run your program in that processor set

> 3) bind a thread to each of the 15 cpus

> 4) run each thread in a realtime scheduling class

Right, I forgot about RT. I assume you would also want to give the processes an infinite quantum. I don't know if you'd do that with priocntl or not.

--

Darren

Darren_Dunhama at 2007-7-10 1:56:17 > top of Java-index,Solaris Operating System,Solaris Essentials - General Technical Questions...