IS a thread scheduler part of JVM or OS ?

Hi Folks,
Just curious if the thread scheduler is a part of the JVM or OS, or either or both ?
I tried few thread pages in JLS,but couldnot locate the exact sentence describing this.
However some other resources have given me contradicting information.
For example, [Reference1|http://www.deitel.com/articles/java_tutorials/20051126/JavaMultithreading_Tutorial_Part3.html] states that it is a part of the OS,whereas [Reference2|http://book.javanb.com/java-threads-3rd/jthreads3-CHP-9-SECT-1.html] states that it is a part of both.(I am not sure about the authority of these links.)
So assuming, thread scheduling is done by JVM it is a part of the JVM only or it uses the underlying OS for support.
Thank you for the consideration.

This statement:
The JVM ... operates like a mini OS and schedules its own threads regardless the underlying operating system.flatly contradicts this statement:
In some JVMs, the java threads are actually mapped to native OS threads.They cannot both be true.
Therefore we can say that Threads are part of JVM and OS bothRubbish. There's no 'therefore' about it. You can't draw valid logical inferences from contradictions.
Guesswork and invalid inferences aside, the fact of the matter is that the semantics of Java threads are specified in the JLS but the execution mechanism is not. 'Any execution strategy that generates only allowed behaviors is an acceptable execution strategy.'
I am not sure about the authority of these linksNil. They are extracts from books by third parties. Use at own risk. The JLS is where the authority is.
Reference 2 is particularly poor, as it contradicts itself numerous times.
For the record, Reference 2 also makes the following claims which as far as I can see are entirely baseless, for the reasons given:
A Java virtual machine is required to implement a preemptive, priority-based schedulerThe word 'pre-emptive' does not appear in the JLS.
The Java virtual machine never changes the priority of a thread, even if the thread has been running for a certain period of timeCan't find that anywhere either.
the contract between the Java virtual machine and the underlying operating system is that the operating system must generally choose to run the Java thread with the highest priorityThe 'contract' is between the Java code and the JVM, not the JVM and the O/S.
That's what we mean when we say that Java implements a priority-based schedulerJava isn't required to 'implement' a scheduler at all.
This scheduler is implemented in a preemptive fashion, meaning that when a higher-priority thread comes along, that thread interrupts (preempts) whatever lower-priority thread is running at the time.This appears nowhere in the JLS.
The contract with the operating system, however, is not absolute, which means that the operating system can sometimes choose to run a lower-priority thread.In other words it's not pre-emptive. Make up your mind.
Java's requirement for a priority-based, preemptive scheduling mechanism ...Which is nowhere to be found.
A Java thread can have one of 11 prioritiesMIN_PRIORITY is 1, MAX_PRIORITY is 10: that makes 10, not 11.
In fact, preemption means only that a higher-priority thread runs instead of a lower-priority oneNo it doesn't. It means that when a higher-priority thread becomes ready it pre-empts the execution of any lower-priority threads that are currently executing regardless of time-slice etc. This is a feature of real-time systems that Java is not required to implement.
Summing up, the words 'pre-emptive' does not appear in the JLS, and the word 'scheduler' only appears in reference to sleep() and yield(), without any implication that the JVM has to implement one itself.

Similar Messages

  • Thread scheduling

    Hi, I have some questions bout threads.
    1) When it comes to thread scheduling, Java has no say in it, since thread scheduling is solely in a domain of operating system?
    2)In preemptive environment, when thread with higher priority becomes runnable, runtime will cause lower priority thread to halt and higher priority thread to start executing. This chosen thread will run until one of the following conditions is true:
    - a higher priority thread becomes "Runnable"
    - it yields, or its run() method exits
    - on systems that support time-slicing, its time has expired
    a) Time slicing doesn't mean that every thread will get the same amount of time to run?
    b)Will higher priority threads get more time and lower less!
    c) Does Windows OS support time slicing?
    3)What kind of environment is non-preemptive environment? The kind where threads with higher priority cant preempt lower priority threads? As I understand it, in those kind of environments there is a greater chance that some threads will never run. Why?
    4)Why is under non-preemptive environment greater chance of having situation where one of the two threads with same priority will not get a chance to run?
    bye

    beginprog wrote:
    1) When it comes to thread scheduling, Java has no say in it, since thread scheduling is solely in a domain of operating system?This is not strictly true. You can control when a thread is eligible to run, but you can't force a partiular thread to run. The JVM has some control over thread scheduling, but yes, it also interacts with the OS.
    2)In preemptive environment, when thread with higher priority becomes runnable, runtime will cause lower priority thread to halt and higher priority thread to start executing. This chosen thread will run until one of the following conditions is true:
    - a higher priority thread becomes "Runnable"
    - it yields, or its run() method exits
    - on systems that support time-slicing, its time has expired I don't think Java makes any such promises about its threads' priorities. You may be describing a general model, but in terms of the JVM scheduling its threads, higher priority threads will be preferred over lower priority ones, but the exact algorithm is left up to the implementation.
    a) Time slicing doesn't mean that every thread will get the same amount of time to run? There are many ways to implement time slicing. It depends on the VM implementation and the OS.
    b)Will higher priority threads get more time and lower less!Depends on the implementation.

  • Thread scheduling problem in WLS5.1

    We use a Timer Servlet to schedule some back end tasks, however we found
              that from time to time the thread scheduling often get delayed or ahead in a
              outragous magtitude.
              We run the servlet inside WLS, and right after start up, the timer works
              perfect, but after long enough time (more than one day), the timer started
              to behave weird. It could get delayed for as much as hours, and then
              suddenly fired up all delayed tasks in a very short period of time. We then
              try to run a very simple Timer doing only wake up every 10 minutes and print
              one line, that failed too. We are running WLS5.1+sp3 on
              Solaris2.6(Generic_105181-19 sun4u sparc SUNW,Ultra-5_10) with jdk1.2.1_04.
              BTW, we found that it ran well on NT, at least for three days without
              problem.
              Any feedback will be appreciated!
              Qingxiang Ke
              below is the source for the simple timer, and deploy properties for it
              inside weblogic.properties file.
              SimpleTimerServlet.java
              package com.cysive.test;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              public class SimpleTimerServlet extends HttpServlet
              class Sleepy implements Runnable
              public void run()
              while(true)
              try
              long wakeUpTime = 600 * 1000;
              Thread.currentThread().sleep(wakeUpTime);
              System.out.println(new Date().toString() + " SimpleTimer Yawn
              ............ Yawn ............");
              catch(InterruptedException ie){}
              private static boolean timerIsRunning = false;
              public void init()
              if(! timerIsRunning)
              Thread sleepy = new Thread(new Sleepy());
              sleepy.start();
              timerIsRunning = true;
              public void doGet(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              doPost(request, response);
              public void doPost(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              OutputStream os = response.getOutputStream();
              os.write("look at your std out!!!".getBytes());
              os.flush();
              os.close();
              deploy properties in weblogic.properties
              weblogic.httpd.register.simpletimer=com.cysive.test.SimpleTimerServlet
              weblogic.system.startupClass.servletSimpleTimer=weblogic.servlet.utils.Servl
              etStartup
              weblogic.system.startupArgs.servletSimpleTimer=servlet=simpletimer
              

    We use a Timer Servlet to schedule some back end tasks, however we found
              that from time to time the thread scheduling often get delayed or ahead in a
              outragous magtitude.
              We run the servlet inside WLS, and right after start up, the timer works
              perfect, but after long enough time (more than one day), the timer started
              to behave weird. It could get delayed for as much as hours, and then
              suddenly fired up all delayed tasks in a very short period of time. We then
              try to run a very simple Timer doing only wake up every 10 minutes and print
              one line, that failed too. We are running WLS5.1+sp3 on
              Solaris2.6(Generic_105181-19 sun4u sparc SUNW,Ultra-5_10) with jdk1.2.1_04.
              BTW, we found that it ran well on NT, at least for three days without
              problem.
              Any feedback will be appreciated!
              Qingxiang Ke
              below is the source for the simple timer, and deploy properties for it
              inside weblogic.properties file.
              SimpleTimerServlet.java
              package com.cysive.test;
              import java.io.*;
              import java.util.*;
              import javax.servlet.*;
              import javax.servlet.http.*;
              public class SimpleTimerServlet extends HttpServlet
              class Sleepy implements Runnable
              public void run()
              while(true)
              try
              long wakeUpTime = 600 * 1000;
              Thread.currentThread().sleep(wakeUpTime);
              System.out.println(new Date().toString() + " SimpleTimer Yawn
              ............ Yawn ............");
              catch(InterruptedException ie){}
              private static boolean timerIsRunning = false;
              public void init()
              if(! timerIsRunning)
              Thread sleepy = new Thread(new Sleepy());
              sleepy.start();
              timerIsRunning = true;
              public void doGet(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              doPost(request, response);
              public void doPost(HttpServletRequest request,
              HttpServletResponse response)
              throws IOException, ServletException
              OutputStream os = response.getOutputStream();
              os.write("look at your std out!!!".getBytes());
              os.flush();
              os.close();
              deploy properties in weblogic.properties
              weblogic.httpd.register.simpletimer=com.cysive.test.SimpleTimerServlet
              weblogic.system.startupClass.servletSimpleTimer=weblogic.servlet.utils.Servl
              etStartup
              weblogic.system.startupArgs.servletSimpleTimer=servlet=simpletimer
              

  • Thread scheduling mechanism in SUN's VM

    I've the problem, that n threads share a resource
    (sharedObject).
    The synchronization is done in an synchronized
    Block:
    synchronized( sharedObject )
    // do something with sharedIbject
    I would like to know in which order the thread scheduler
    of SUN Solaris VM of the JDK 1.3 or in general,
    gives the lock of the sharedObject to one of the thread, which
    are waiting for the lock of the sharedObject.
    Is there something like FIFO, so that it's safe, that all waiting
    threads will get the sharedObject in the right order,
    or do i have to implement a queueing mechanism with wait and
    notify.
    thanks

    If you're writing a Java program that uses threads, the thing to do is to follow the rules that Java provides, not the rules of a particular thread scheduler.
    There is no guarantee about which order the threads will get access to the sharedObject without writing explicit code for it.

  • Sol 9 thread scheduling

    I posted this yesterday in the kernel forum because thread scheduling seemed more like a kernel issue than the generally admin type things usually discussed here, but I've not had any takers in kernel, so I'm trying here. Basically, while porting an application from solaris 8 to solaris 9, I seem to have run into a starvation issue with the new 1x1 thread model.
    Here is a link to the post in the kernel forum:
    http://forum.sun.com/thread.jsp?forum=10&thread=18592&tstart=0&trange=100
    Any help would be appreciated.

    I wonder why results were same. I replaced sleep(10) with an arbitrary number of busy loops, 100000
    I do see that all threads get a chance to run. I am running a 2 CPU ultrasparc each running at 1002 MHz. I do not have an understanding of your application though, but as others mentioned feel that mutexes should be used to protect critical sections (which would be small) or as a mechanism to wakeup in an async manner along with condition variables.
    pthread_starvation: press ^C to interrupt.
    Thread 6 waited 0 milliseconds.
    Thread 11 waited 5 milliseconds.
    Thread 10 waited 5 milliseconds.
    Thread 9 waited 6 milliseconds.
    Thread 8 waited 6 milliseconds.
    Thread 7 waited 7 milliseconds.
    Thread 2 waited 7 milliseconds.
    Thread 3 waited 7 milliseconds.
    Thread 4 waited 8 milliseconds.
    Thread 5 waited 8 milliseconds.
    Thread 6 waited 0 milliseconds.
    Thread 11 waited 0 milliseconds.
    Thread 10 waited 0 milliseconds.
    Thread 9 waited 0 milliseconds.
    Thread 8 waited 0 milliseconds.
    Thread 7 waited 0 milliseconds.
    Thread 2 waited 0 milliseconds.
    Thread 3 waited 0 milliseconds.
    -madhusudan

  • Getting all the threads running in one JVM from another JVM ...

    I want to get all the threads running in one JVM from another JVM.
    Is it possible ?
    namanc

    I am going to write a java application that prints all the java application running at the background. And this application has a control over all the threads. means killing the threads, restart the thread etc
    namanc

  • Is there any way to limit the number of Threads running in Application(JVM)

    Hello all,
    is there any way to limit the number of Threads running in Application(JVM)?
    how to ensure that only 100 Threads are running in an Application?
    Thanks
    Mohamed Javeed

    You should definitely use a thread pool for this. You can specify maximum number of threads that can be run. Be note that the thread pool will only limit the number of threads that are submitted to it. So donot call "Thread"s start() method to start thread on your own. Submit it to the pool. To know more, study about executor service and thread pool creation. Actually it will not be more than 20 line code for a class and you might need maximum of 2 such classes, one for threadPool and other one for rejection handler (if you want).
    Just choose the queue used carefully, you just have to pass it as a parameter to the pool.
    You should use "Bounded" queue for limiting threads, but also be careful in using queues like SynchronizedQueue as the queue will execute immediately the threads submitted to it if maximum number of threads have not been running. Otherwise it will reject it and you should use rejection handler. So if your pool has a synchronized queue of size 100, if you submit 101th thread, it will be rejected and is not executed.
    If you want some kind of waiting mechanism, use something like LinkedBlockingQueue. What this will do is even if you want 100 threads, you can specify the queue's size to be 1000, so that you can submit 1000 threads, only 100 will run at a time and the remaining will wait in the queue. They will be executed when each thread already executing will complete. Rejection occurs only when the queue oveflows.

  • Thread Scheduling Query

    Hi,
    If i have 3 messages A, B and C which are in a queue and are to pass through a synchronized method Y . A particular thread X picks 1 message each from the queue and spawns a thread for each of 3.
    A is executing Y and B and C are in BLOCKING State and waiting for A to finish so that they can enter Y.
    Is it possible that C executes first before B.
    Pls advice.
    Thnx in Adv
    Amandeep

    Setting a thread's priority is not the preferred solution namely because it is dangerously inconsistent. The only time to use thread priority is when you have tasks that do not have scheduling conflicts like this and you really don't care when a particular thread runs. As an example the garbage collection thread in a VM is normally a lower priority thread until such time that garbage collection is needed.
    The preferred solution for thread scheduling and order of executing issues is to revisit the design.
    In the example given by the OP I would first question the use of multiple threads at all. It seems that the OP wished tasks to be executed from a queue in the same order as they were added to the queue and that tasks later in the queue should not finish execution before ones earlier.
    This does not seem a good use for multiple threads because this requirement seems to call for anything but parallel execution.
    But perhaps I am reading too much into that statement. I would suggest a revist of the design though to look at doing the following.
    Launcher thread
    1) Gets next thing from queue
    2) Calls synchonized Y method (that no longer needs to be synchronized probably) using thing from queue
    3) Starts new thread with results from Y
    4) Go back to 1
    This design garauantees at least that the launcher threads will be started (and past the synchronized method) in the same order as they were received.
    Does that mean they will complete execution in the same order? No. Does it mean they will actually start processing in the same order? No. But it does mean they will call Y in the same order and since I would guess that is the real issue here it solves the problem.
    If the threads really must finish in the same order than one must consider either; not running seperate threads as I mentioned earlier or adding a semaphore at the end of the spawned "worker" threads so that they wait for previous threads to finish before exiting.

  • Thread Scheduling Visualizer - take a look

    Hi,
    I want to share this link with all the sun forum members.
    It is about "The Sun Java Real-Time System Thread Scheduling Visualizer"
    [http://java.sun.com/javase/technologies/realtime/reference/TSV/JavaRTS-TSV.html]
    Sun you are simply too great ;)
    thanks,
    swapnaja
    Edited by: swapnaja on Mar 16, 2009 6:43 AM
    Edited by: swapnaja on Mar 16, 2009 6:48 AM

    Hi,
    Glad it worked for you too. I'm so grateful to 'turboontheovens' for posting this solution, it was driving me crazy!
    Claire x

  • How does Thread scheduling Work

    Hi to all out there. I have been deweloping a program that is supposed to create a Sceduling Thread that would have the higest priorety and manage three more threads. The sceduler creates a CircularList class to call and run each of the other three threads.
    Unfortunatly there are two errors that I can't trace down. If there is any one out there familiar with OS progming I would apreciate a few comments on the following code:
    import java.lang.*;
    public class TestScheduler
         public static void main (String args[])
              Thread.currentThread().setPriority(Thread.MAX_PRIORITY); //Sets Sceduler Priorety
              Scheduler CPUScheduler = new Scheduler();
              CPUScheduler.start();
    /*creates The three other threads to be managed*/
              Thread t1 = new TestThread();
              t1.start();
              //CPUScheduler.addThread(t1);
              Thread t2 = new TestThread();
              t2.start();
              Thread t3 = new TestThread();
              t3.start();
    class Scheduler extends Thread
         public Scheduler(){
              timeSlice = DEFAULT_TIME_SLICE;
    //creates the queues for threads
              queue = new CircularLi();
         public Scheduler(int quantum){
                   timeSlice = quantum;
                   queue = new CircularList();
         public void addThread(Thread t){
                   t.setPriority(2);
    //Error 1 here. Can't recognize the .addItem() method?
                   queue.addItem(t);
         private void schedulerSleep(){
                   try{
                        Thread.sleep(timeSlice);
                   }catch(InterruptedException e){};
         public void run(){
              Thread current;
              this.setPriority(6);
              while (true){
    //Error 2 is here. It sais it can't find a method .getNext()?
                   current = (Thread)queue.getNext();
                   if ((current != null) && (current.isAlive())){
                        current.setPriority(4);
                        schedulerSleep();
                        current.setPriority(2);
         private CircularList queue;
         private int DEFAULT_TIME_SLICE = 100;
         private int timeSlice;
    class TestThread extends Thread
         public void run()
              Total = 0;
              Total++;
              System.out.println("This ran for: " Total " times.");
         public int Total;
    class CircularList extends Scheduler
         public void run ()
              Thread.currentThread().setPriority(5);
              while(true)
                   if(Total < 5)
                        new TestThread().start();
                        Total++;
                   else
                        Thread.currentThread().setPriority(2);
                        Total = 0;
         private int Total = 0;
    Is there another library class I do not know about or do I have to write this methods myself?

    Where have you got the CircularList from?
    it is not part of the java API ... so who ever wrote it should be able to answer your question.
    If it sticks to the conventions of the collection API
    the method addItem is probably simply named add
    and instead of queque.next() you use an iterator instead like this:
    Iterator iter = queque.iterator();
    while (iter.hasNext()){
    Object o = iter.next();
    // do something with o
    HTH
    Spieler

  • Question about synchronize() statement and thread scheduling?

    I have threads accessing a shared LinkedList in the main thread. I made use of the Collections.synchronizedList() to avoid concurrent modifications. one of the threads is a timer thread and it has a priority of 5 and the other threads are message reception threads and i made them of a lower priority just to allow the timer thread to be executed on time. According to the javaAPI, all iterations on the synchronized list should be done using synchronized(synchronizedListRef){} and this is what i do,
    The problem is even after setting the priority of the reception threads lower than the timer thread, the reception threads are sometimes executed more than once and the timer thread is delayed. Lets assume the situation where the timer reaches the point where it has to acquire the lock (the synchronized statement) and it discovers that the lock is already taken and it cant access the list because the other thread (of a lower priority) is iterating over it. shouldnt the higherpriority thread be executed after that the reception thread (that is blocking the timer thread) finishes its execution and release the lock (even if there are other reception thread waiting)??
    does the priority play a role when a thread is blocked?

    Asady wrote:
    I have threads accessing a shared LinkedList in the main thread. I made use of the Collections.synchronizedList() to avoid concurrent modifications. Make sure you explicitly sync around all iterations. Just using Collections.sync is not enough.
    The problem is even after setting the priority of the reception threads lower than the timer thread, the reception threads are sometimes executed more than once and the timer thread is delayed.There's no guarantee as to how priority will be interpreted. The scheduler implementation is free to do pretty much anything.
    As for how to solve your problem, you might want to look at java.util.concurrent.*, e.g. PriorityQueue. If the classes there don't give you just what you need, you may be able to build on them, or at least get ideas from them. Bottom line is that if you want a specific scheduling algorithm, you'll have to implement it yourself, since Threads' priority semantics are only very loosely specified by the JLS.

  • Thread local variable causes JVM crash through JNI

    Hi All,
    My team developed a JDBC driver which uses some native C codes. (Compiler: cl.exe, O/S: Windows XP)
    I found that JVM crashes at specific point. So I used debugger(Visual Studio 2005) to find the position.
    ==================File1.c=====================
    JNIEXPORT jbyteArray JNICALL
    Java_com_lone_wolf_MyClass_myFunc(
    JNIEnv *env, jclass cls,
    jint msgtype, jbyteArray recvarr)
    jbyteArray outarr;
    int x = 3;
    outarr = my_initializer (int &x);
    return outarr;
    ==================File2.c=====================
    __declspec(thread) int thread_id;
    static jbyteArray my_initializer (int *a)
    thread_id = *a; // HERE JVM CRASHES
    When my_initializer() tries to put *a into thread_id, JVM crashed with the following error message.
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x4931c6bf, pid=3560, tid=848
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode)
    # Problematic frame:
    # C [hello.dll+0xc6bf]
    --------------- T H R E A D ---------------
    Current thread (0x00037168): JavaThread "main" [_thread_in_native, id=848]
    Stack: [0x00040000,0x00080000), sp=0x0007f494, free space=253k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    C [hello.dll+0xc6bf]
    C [hello.dll+0xbebb]
    C [hello.dll+0x3c30]
    C [hello.dll+0x18e6]
    C [hello.dll+0x11b8]
    j com.lone.wolf.MyClass.myFunc(I[B)[B+0
    v ~StubRoutines::call_stub
    V [jvm.dll+0x8176e]
    V [jvm.dll+0xd481d]
    V [jvm.dll+0x8163f]
    V [jvm.dll+0x885cd]
    C [java.exe+0x14c0]
    C [java.exe+0x64cd]
    C [kernel32.dll+0x16ff7]
    VM Arguments:
    jvm_args: -Xms128m -Xmx1024m
    java_command: sampler.Sampler
    --------------- S Y S T E M ---------------
    OS: Windows XP Build 2600 Service Pack 2
    CPU:total 4 family 6, cmov, cx8, fxsr, mmx, sse, sse2, ht
    Memory: 4k page, physical 2062180k(1378880k free), swap 4003992k(3252828k free)
    vm_info: Java HotSpot(TM) Client VM (1.5.0_01-b08) for windows-x86, built on Dec 6 2004 19:51:00 by "java_re" with MS VC++ 6.0
    Any idea how to solve this issue will be greatly appreciated.
    Thank you.

    This deffinition ( __declspec(thread) ) of the thread local veriable does not works in some cases (see articles in MSDN how to define thread local variables in C++ code). JVM loads your native module (DLL) with LoadLibrary function. This is one of the cases when __declspec(thread) is wrong in C++ code.

  • Some kind of thread scheduling lag in 6.1sp2

    I've got a 2000sp4 box with Web Server 6.1sp2 installed. I'm running ColdFusion MX as well. The machine is a dual-P4 3.2Ghz. with 4gb of RAM.
    What I'm seeing is at random times, a user will request a page, and then be stuck waiting for a long time (think 10-30 seconds on average). Then, the next page request will load immediately.
    The connection queue is peaking at like 6 connections. It's not a connection queue issue. Iny my performance monitor, when these 'lag spikes' hit, as they come down, I see our ColdFusion process take on a spike in requests, as if during this 'lag spike' all the connections get stuck somewhere and, once cleared, they all go through at once.
    Both the ColdFusion and Sun One performance monitors show average request/response time at about 100ms.
    I've tested this on a dev machine and seen that the Sun One performance monitor does include CF processing time in the "Total Response Time" that gets reported.
    So since I'm only seeing about 150ms max for the "Total Response Time", that would seem to indicate my 'lag spike' is something that occurs at the point connections are accepted.
    The 'lag spikes' are not limited to requests for CF pages. Images, static files, and even the performance monitor are susceptible to these 'lag spikes'.
    One symptom that might be worth pointing out is that if I hit a 'lag spike' and simply stop my request, then re-request it (hit the reload button) the page will come up immediately.
    There are 8 virtual servers on the box, each has only 1 acceptor thread. I see these lag spikes on virtual servers that have nobody else but myself connecting to them, so I don't think it's an acceptor thread issue.
    KernelThreads is set to ON as setting it to OFF seems to make the web server virtually unresponsive.
    NativePool:
    Idle/Peak/Limit 1/1/64
    Work Queue Length/Peak/Limit 0/0/256
    I have never see the idle/peak values go above 1 for my NativePool. Is this "normal"? I do not have CF running in a separate thread pool.
    Does anyone have any ideas or suggestions?
    Thanks

    A couple of things.
    First, thanks for the tips. I was starting to suspect the network might be an issue (bad nic, bad router, something).
    But netstat -s was showing an average of about .15% packet loss. For a web server that seems to be a pretty good value so I'm not sure.
    I did, however, ask someone else to look at the server because I'd spent the whole week on just server performance and was going out of my mind. This second pair of eyes really helped as he found that the pagefile for the server was set at 2mb!? Still trying to figure out how that happened. But we increased the pagefile to a much better value. There wasn't an immediate change in performance, but over time the server appears to have begun to respond better.
    Occasionally I still get these 'lag spikes' but nowhere near what they were and the delay is much smaller as well, which is probably being caused by something else entirely (like bad programming on my part, hah).

  • Solaris 9 vs 10 wrt process/thread scheduling, from perspective of 'top'

    On a dual-processor UltraSpract Fire V240, running Solaris 9, the 'top' command shows:
    rodan%top
    load averages:  2.43,  2.23,  2.23                                 00:41:10
    39 processes:  35 sleeping, 2 running, 2 on cpu
    CPU states:     % idle,     % user,     % kernel,     % iowait,     % swap
    Memory: 2048M real, 1707M free, 160M swap in use, 2500M swap free
      PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
    1551 ssgolsha   1   0    0   62M   61M run   324:17 46.89% vpr
    1866 ssgolsha   1   0    0   22M   20M run    41:57 45.19% vpr
    1922 mingl      4   0    0   42M   39M cpu0    1:28  6.27% messengers
    1928 mingl      1  39    0 1640K 1208K cpu1    0:00  0.12% top-sun4u-5.7
      185 root       3  59    0 4920K 3352K sleep   0:14  0.02% automountd
    1583 mingl      1  49    0 3584K 3136K sleep   0:00  0.02% tcshrodan%top
    load averages:  2.77,  2.51,  2.35                                 00:41:45
    39 processes:  35 sleeping, 2 running, 2 on cpu
    CPU states:  0.0% idle, 99.8% user,  0.2% kernel,  0.0% iowait,  0.0% swap
    Memory: 2048M real, 1707M free, 160M swap in use, 2500M swap free
      PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
    1866 ssgolsha   1   0    0   22M   20M run    42:23 38.18% vpr
    1551 ssgolsha   1   0    0   62M   61M run   324:38 33.02% vpr
    1922 mingl      4   0    0   42M   39M cpu1    1:51 28.34% messengers
    1928 mingl      1  59    0 1640K 1280K cpu0    0:00  0.02% top-sun4u-5.7
      185 root       2  59    0 4920K 3352K sleep   0:15  0.00% automountd
      219 root      19  59    0 4760K 3552K sleep   0:03  0.00% nscd
    1583 mingl      1  59    0 3584K 3136K sleep   0:00  0.00% tcshSunOS 5.9's man page for 'top' says STATE is the current state (one of "sleep", "WAIT", "run", "idl", "zomb", or "stop")
    On a dual-processor dual-core AMD Opteron 270, running Solaris 10, the 'top' command shows:
    homer% top
    load averages:  0.11,  0.16,  0.12;                    up 7+08:19:46    17:11:47
    93 processes: 91 sleeping, 2 on cpu
    CPU states: 72.3% idle, 25.1% user,  2.5% kernel,  0.0% iowait,  0.0% swap
    Memory: 2048M phys mem, 1606M free mem, 8001M swap, 7873M free swap
       PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
    14685 mingl      4  30    0  112M  109M cpu      2:09   105% messengers
       258 root       1  59    0   13M 5260K sleep   74:52  0.70% Xorg
      9522 coby       1  59    0   47M 8116K sleep   22:44  0.33% mixer_applet2
      9520 coby       1  59    0   49M 8592K sleep    6:35  0.12% gnome-netstatus
       270 gdm        1  59    0   50M 6076K sleep    4:44  0.08% gdmgreeter
    14658 mingl      1  59    0 2068K 1488K cpu      0:00  0.08% top
    SunOS 5.10's man page for 'top' says
    STATE
    Current state (typically one of "sleep", "run", "idl", "zomb", or "stop").
    As seen in both cases, the 'messengers' program has 4 threads.
    On Solaris 9, its state is either cpu0 or cpu1, depending on the time I call 'top'. Does that mean it is actually running on either cpu0 or cpu1? What is the difference between the 'cpu0' state and the 'run'
    state? And does it mean all 4 threads are running/assigned to cpu0 (or cpu1)?
    On Solaris 10, the state shows 'cpu'. Does it mean it is running? And does it mean that each thread may run on a different CPU therefore the state does not show any particular CPU number? Is it correct that Solaris 9 assign the CPU on a per-process basis and Solaris 10 on a per-thread basis?

    On Solaris 9, its state is either cpu0 or cpu1,
    depending on the time I call 'top'. Does that mean
    it is actually running on either cpu0 or cpu1?Should be.
    What
    is the difference between the 'cpu0' state and the
    'run' state?A thread can be sleeping (it doesn't have anything to do), or runnable. Although it's runnable, it doesn't mean that it's running right at that instant.
    Note that it's difficult to get a good view of the situation with 'top' (or almost any other program). Because whenever 'top' looks, 'top' will always be running, even though it's only running a fraction of the time.
    And does it mean all 4 threads are
    running/assigned to cpu0 (or cpu1)? No. Each thread is independently executed. But since you only have 2 processors, and since 'top' has to be running when it runs, you'll only ever see your process on at most one other cpu.
    You might want to use 'prstat' and 'prstat -L'. The first shows one line per process, the second one line per thread.
    On Solaris 10, the state shows 'cpu'. Does it mean
    it is running? And does it mean that each thread may
    run on a different CPU therefore the state does not
    show any particular CPU number? Is it correct that
    Solaris 9 assign the CPU on a per-process basis and
    Solaris 10 on a per-thread basis?I don't know exactly what top does or doesn't do. You might try 'prstat' instead.
    There is no difference at this level between Solaris 9 and 10. All will schedule on a per-thread basis.
    Darren

  • Is Java Compiler a part of JVM or JRE but not JVM? ?

    hi friends... i need clarification....I am completely confused about how things go about from d time v compile to execution...Please can anybody give me a complete description

    Ok fine.....thanks....But suppose now i take a
    compiled program from 1 m/c to another....Now JIT
    comes into picture....So JIT must understand
    bytecodes....So does JIT belong to JRE ....Correct me
    if i am wrongJIT belongs to the JVM.
    Could you please have the courtesy of not typing like a seven-year-old girlie?

Maybe you are looking for