RTSJ thread priorities, Lower priority thread running

Hi,
I'm experimenting with a thread pool that I've written containing javax.realtime.RealtimeThreads. I'm trying to use this to replace a java.util.concurrent.Exectutor type thread pool in an existing application. My design involves a Queue where the RealtimeThreads wait on until a Task is submitted for execution. All the threads in the pool start at the lowest priority and upon the submission of a task, I have written some logic to increase the priorities of the threads that I want run.
At a given time, there could be many threads with tasks assigned to them and some without tasks. My algorithm to decide which thread is to be given the CPU, runs every time a task is submitted to the system as well as at the end of the current thread execution. I assumed that If I set a thread's priority higher than the others it would automatically be given the CPU and all I have to do is to set the Priority using rtThreadObject.setPriority() method. I obtain the highest priority in the system through PriorityScheduler.instance().getMaxPriority() method and do similarity to obtain the Normal and Lowest priorities in the system.
Recently I added some code to change the priority of a thread from another, and noticed that the target thread's priority is higher than the one that is currently running. I'm not sure how a lower priority thread can run, when a higher priority thread is already in the system. I'm wondering whether it's to do with the current thread of execution getting woken up by a task submission (I do a QueueObject.notify() ) and continue to run at the lower priority, I have my doubts on it. Can anyone give some ideas as to how such an instance could exist?
I'm developing on a Linux-RT kernel with RTSJ 2.1
Thanks,
Vidura

Sorry for the delayed response.
Thanks a lot for the answer. This certainly might be the case in my scenario as well. However, is there a way that I could query the active priority from a Thread and confirm? I also have a few questions just to confirm my thoughts on such a scenario.There is no way to query the active priority of a thread.
1) Can Priority inheritance take place if a high priority thread is blocked on some IO operation say even a simple System.out.println ?Priority inheritance occurs when a thread holding a monitor causes a higher-priority thread to block trying to acquire that monitor. At that point the thread holding the monitor is given the priority of the thread it is blocking. So this can happen anytime a lock is held, regardless of what the thread is doing at the time.
2) In the simple scenario of a couple of threads with different being active at the same time with Java or RTSJ in particular, as long as the threads are not blocked or competing for a shared resource, is it possible to assume that the highest priority thread will get the CPU 100% of the time?The simple answer is "yes" but reality is more complex. Shared resources occur at the application, VM/runtime-library, and OS levels. You would have to avoid them at all levels to ensure the highest base priority thread is also the highest active priority.
3) If we as programmers takes great care in preventing IO operations (or controlling any IO operations, i.e. where to place them in the code) even simple as a System.out, priority inversions or inheritance would not take place?Priority inheritance is not directly related to I/O operations - the issue is whether methods are synchronized or not.
4) In such a scenario highlighted in 3, what practices could be used to debug the code if needed?On Solaris we use DTrace and the Thread Scheduling Visualizer for debugging timing/scheduling relationships. I'm afraid we don't have anything equivalent on Linux at this this time.
As for exactly what I'm trying to do, it's a bit convoluted as I'm trying to achieve predictability in an existing product using RTSJ, that wouldn't be used in the trivial real-time sense, like an embedded environment, rather as a normal application. I will follow up with more details of it if needed.Don't worry, we have numerous users applying real-time Java to "normal" applications. :)
David Holmes

Similar Messages

  • Thread run() resets value of variables! WHY!

    Hello.. i am having a VERY frustrating problem here. I have used a thread to create a stopwatch. I want to be able to play, pause and stop. I can get the play to start counitng, the stop to stop it...but..wheni pause...it pauses, yet when i resume the stopwatch, it starts again from 00:00:00:0
    II have four int variables.
    private int fractionOfSeconds;
    private int seconds;
    private int minutes;
    private int hours;
    in the constructor of the thread I am setting them to value 0;
    Stopwatch()
    fractionOfSeconds = 0;
    seconds = 0;
    minutes = 0;
    hours = 0;
    In the run() function I have it increment the values of those variables and pass the result to a label.
    public void run()
    isPlaying = true;
    isPaused = false;
    isStopped = false;
    try
    while(!isStopped && !isPaused)
    sleep(100);
    fractionOfSeconds++;
    if(fractionOfSeconds % 10 == 0 && fractionOfSeconds != 0)
    fractionOfSeconds -= 10;
    seconds++;
    if(seconds % 60 == 0 && seconds != 0)
    seconds -= 60;
    minutes++;
    if(minutes % 60 == 0 && minutes != 0)
    minutes -= 1;
    hours++;
    secondsString = "" + seconds;
    if(seconds < 10)
    secondsString = "0" + seconds;
    minutesString = "" + minutes;
    if(minutes < 10)
    minutesString = "0" + minutes;
    hoursString = "" + hours;
    if(hours < 10)
    hoursString = "0" + hours;
    transportControl.setTimerLabel(hoursString + ":" + minutesString + ":" + secondsString + ":" + fractionOfSeconds);
    catch(Exception e)
    LOGICALLY speaking..unless I am missing somehing really big, the stopwatch variables should be set to ZERO when the stopwatch class is contrsucted..and after that everytime i run the thread using the run() /start() function the variables should keep increasing..and every time i runit again it should keep counting from where it left off before.
    but it doenst. it resets the variables to zero EVERYTIME!!!
    Plese.anybody?what am i missing here??
    thanx in advance

    You can build a stop watch using one of the Timer classes.
    - Set the timer to tick every 55 milliseconds (18.2 Hertz) if your on an Intel based machine this is the best resolution you'll get.
    - When you start the stopwatch, record the currentMillis
    - when the timer ticks use that value and the currentMillis to determing the elapsed time.
    - when you pause the stopwatch shut the timer down and record the elapsed time so far
    - when you unpause the stopwatch restart the timer
    You probably don't even need a separate thread since the timer provide one for you. Note that times set in timers and sleep are not going to be the same as the time actually elapsed since these things run at very low priority.

  • The background thread running lazy writer encountered an I/O error

    Hi I have a test server which has thrown the following error
    File system error: A system error occurred while attempting to read or write to a file store. The system might be under memory pressure or low on disk space. Physical file: \\?\F:\MSAS11.DEPLOYAS\OLAP\Data\Prod_KCube.0.db\DIM Flags And Types.0.dim\3.Flag
    Types Key.khstore. Logical file: . GetLastError code: 8. File system error: The background thread running lazy writer encountered an I/O error. Physical file: \\?\F:\MSAS11.DEPLOYAS\OLAP\Data\Prod_KCube.0.db\DIM Flags And Types.0.dim\3.Flag Types Key.khstore.
    Logical file: . Errors in the OLAP storage engine: An error occurred while processing the 'Facts' partition of the 'Main Facts' measure group for the 'Prod_Cube' cube from the Prod_KCube database.
    The cube sits on a not very well maintained server which is used by various users (it is a test server) with the following specs
    Intel(R) Xenon(R) CPU x5690 @3.47GHz
    24GB Ram
    64 Bit operating system.
    The Cube data and logs are on separate drives and have plenty data but the C drive (where SQL Server is installed) only has3.5Gb of space left.
    It's a fairly big cube and I've managed to get it running by processing dimensions and facts bit by bit but errors when processed all together.
    What could be causing the errors above?

    Hi aivoryuk,
    According to your description, you get the lazy writing error when processing partitions. Right?
    In this scenario, the issue may cause by low memory for SSAS and lack of disk space. Please consider configure
    Server Properties (Memory Page) and increase
    memory setting for SSAS. If the .cub file is located in C drive, please reserve more disk space.
    Please refer to a similar thread below:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/21bf84c5-f89a-464a-a5f1-2649fae5eb1e/while-processing-large-cubes-various-file-system-errors-the-background-thread-running-lazy-writer?forum=sqlanalysisservices
    Best Regards,
    Simon Hou
    TechNet Community Support

  • Thread running in jvm or os

    pls tell me thread running in jvm or operating system

    pls tell me thread running in jvm or operating systemIIRC, unless you are using a very old JVM (e.g. pre 1.2) or are explicitly specifying green threads (which I believe was still possible even in 1.2?) then all threading using native threads. As mentioned above, the mapping between Java thread objects and the native threads is is highly dependent on the OS (especially when it comes to thread priority).
    This document goes into much more detail: http://java.sun.com/docs/hotspot/threads/threads.html
    - N

  • Java Thread run some day then death ,use jstack check it,it  run again, is

    hi all;
    I write a java program run as linux daemon,
    command line is >nohup java myclass &>/dev/null
    it run some day ,then death, ,look like death lock ,but thread not exit
    if i use jstack checke it ,it run again!
    my env is
    Linux version 2.4.20 ,redhat linux
    jstack 14616
    Attaching to process ID 14616, please wait...
    Debugger attached successfully.
    Client compiler detected.
    JVM version is 1.5.0_02-b09
    my program like
    commandline nohuo java StartUp >/dev/null &
    public Class StartUp{
    public static void main(String[] argv){
       Connection con = getDBConnection
         Thread t1 = new Thread(new MyRun(con));
      t1.start();
         Thread t2 = new Thread(new MyRun(con));
      t2.start();
      for(;;){
      Thread.sleep(100);
    public class MyRun implements Runnable{
    Connection con;
    public MyRun(Connection c){con = c;}
    public void run(){
         for(;;){
         object = readData(con);
         process(object);
         log.info("watch info ....");
         Thread.sleep(500);
    }

    Today i found my program hang, i use kill -SIGQUIT to print thead trace
    but i can't find the bug,after send singal ,the thread run again!
    another question
    how to detect a thread is hang?and use another thread restart it?
    thread dump
    Full thread dump Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode, sharing):
    "pool-1-thread-2" prio=1 tid=0x08447858 nid=0x5aa6 waiting on condition [0x4680f000..0x4681021c]
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1772)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:470)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:674)
    at java.lang.Thread.run(Thread.java:595)
    "pool-1-thread-1" prio=1 tid=0x08392740 nid=0x5aa5 waiting on condition [0x4678f000..0x4678ff1c]
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1772)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
    at com.ejet.mms.MmsSend.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    "Low Memory Detector" daemon prio=1 tid=0x080a18b0 nid=0x5a9f runnable [0x00000000..0x00000000]
    "CompilerThread0" daemon prio=1 tid=0x080a0360 nid=0x5a9e waiting on condition [0x00000000..0x417e2c04]
    "Signal Dispatcher" daemon prio=1 tid=0x0809f478 nid=0x5a9d waiting on condition [0x00000000..0x00000000]
    "Finalizer" daemon prio=1 tid=0x080989e8 nid=0x5a9c in Object.wait() [0x413e4000..0x413e441c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x66c18420> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
    - locked <0x66c18420> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=1 tid=0x08097cf8 nid=0x5a9b in Object.wait() [0x41364000..0x4136451c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x66c184a0> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:474)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
    - locked <0x66c184a0> (a java.lang.ref.Reference$Lock)
    "main" prio=1 tid=0x0805ae68 nid=0x5a98 waiting on condition [0xbfffc000..0xbfffc4f8]
    at java.lang.Thread.sleep(Native Method)
    at com.ejet.mms.MmsStartup.main(Unknown Source)
    "VM Thread" prio=1 tid=0x08095218 nid=0x5a9a runnable
    "VM Periodic Task Thread" prio=1 tid=0x080a2d40 nid=0x5aa0 waiting on condition

  • Why do threads run one at a time?

    [Newbie] Couldn't get help in another forum, so here goes. Tried this in Netbeans 3.5 then at home later in BlueJ, same thing. Thanks in advance!
    I have written a small application to play with threads. I create 3 instances of a class and shoot each one off in a thread, but they all seem to run one at a time, not at the same time. I have posted the code below. The output I expect is something like this:
    0T1
    0T2
    0T3
    1T1
    1T2
    1T3
    2T1
    2T2
    2T3
    498T1
    498T2
    498T3
    499T1
    499T2
    499T3
    500T1
    500T2
    500T3
    The T1 means threadstart1 wrote that line, the T3, means threadstart3 wrote the line, etc. I would expect to see these slightly out of order, too, knowing that the threads will process what they can, when they can. Instead, I see this:
    0T1
    1T1
    2T1
    500T1
    0T2
    1T2
    2T2
    500T2
    0T3
    1T3
    2T3
    500T3
    It's in perfect numeric order, each completing before the next starts. What am I doing wrong?
    //-------------dostuff.java
    package delme2;
    public class dostuff implements Runnable {
    private String mtext;
    public dostuff(String atext) {
    mtext = atext;
    public void run() {
    int j;
    String s;
    //display 500 numbers
    for (j=0; j<500; j++) {
    //build the string
    s = String.valueOf(j) + mtext;
    //show the string
    System.out.println(s);
    //wait a bit before doing this again.
    try {
    Thread.sleep(10);
    } catch (InterruptedException e) {
    //--------------- delme2.java
    package delme2;
    public class delme2 {
    public delme2() {
    System.out.println("Thread demo:");
    Runnable threadstart1 = new dostuff("T1");
    Runnable threadstart2 = new dostuff("T2");
    Runnable threadstart3 = new dostuff("T3");
    Thread t1 = new Thread( threadstart1 );
    Thread t2 = new Thread( threadstart2 );
    Thread t3 = new Thread( threadstart3 );
    t1.run();
    t2.run();
    t3.run();
    public static void main(String[] args) {
    delme2 mydelme2 = new delme2();
    }

    Okay, I'll play along. Having written a task scheduler in C (under tutorial, I admit), I think I qualify. A task scheduler has three jobs at all times.
    1) Execute the code at hand.
    2) Figure out when to stop executing the code at hand.
    3) When stopped, figure out what code to execute next.
    When executing a piece of code, there are different paradigms for determining when to stop and move on. Ideally, a cooperative multitasking system would have threads that relinquish timeslices or have some other method sprinkled throughout their code that indicates to the task scheduler that it's okay to move on to another piece of code. In my experience, that indicator is a Thread.Sleep() or equiavalent. when the thread.sleep() is encountered. The task scheduler has nothing to do for a whopping 10 MS. It could even take 15 or 20 ms if the next process in line takes that long. So what is it doing for 10 ms? It's not executing those other threads, which should be queued for their turn on step #3 as soon as I fire them off with a .run().
    Now, I hope you can see that I've given this some thought and read about it, but I'm missing something. I can get a very similar project to work as I expect it to in .NET and in Delphi. The Java environment has something different about it that I haven't figured out. Here's the c# code that does EXACTLY what I want it to. All threads run at a same time, and I get 0,0,0,1,1,1,2,2,2,3,3,3,4,4,4, etc.. See the similarities?
              private void button1_Click(object sender, System.EventArgs e)
                   lst.Items.Clear();
                   ThreadStart start1 = new ThreadStart(runner);
                   ThreadStart start2 = new ThreadStart(runner);
                   ThreadStart start3 = new ThreadStart(runner);
                   Thread t1 = new Thread(start1);
                   Thread t2 = new Thread(start2);
                   Thread t3 = new Thread(start3);
                   t1.Start();
                   t2.Start();
                   t3.Start();
              private void runner()
                   string s;
                   for (int j=0; j<500; j++)
                        s = j.ToString();
                        lst.Items.Add(s);
                        Thread.Sleep(10);
              }

  • How to throw Exception in Thread.run() method

    I want to throw exception in Thread.run() method. How can I do that ?
    If I try to compile the Code given below, it does not allow me to compile :
    public class ThreadTest {
         public static void main(String[] args) {
         ThreadTest.DyingThread t = new DyingThread();
         t.start();
         static class DyingThread extends Thread {
         public void run() {
         try {
                   //some code that may throw some exception here
              } catch (Exception e) {
              throw e;//Want to throw(pass) exception to caller
    }

    (a) in JDK 1.4+, wrap your exception in RuntimeException:
    catch (Exception e)
    throw new RuntimeException(e);
    [this exception will be caught by ThreadGroup.uncaughtException() of this thread's parent thread group]
    In earlier JDKs, use your own wrapping unchecked exception class.
    (b) if you know what you are doing, you can make any Java method throw any exception using Thread.stop(Throwable) regardless of what it declares in its "throws" declaration.

  • How to pass the caught exception in Thread.run back to the main program?

    I have following three Java files (simplified from a real world application I am developing, see files at the end of this posting):
    1. ThreadTest.java: The main program that invokes the Manager.run()
    2. Manager.java: The manager that creates a thread to execute the Agent.run() for each agent
    3. Agnet.java: The run() method can throw Exception
    My goal is twofold:
    1. To execute the run() method of an Agent in a thread (the reason for this is there are many Agents all managed by a Manager)
    2. To catch the exception thrown by Agent.run() in the main program, ThreadTest.main() -- so the main program can alert the exceptions
    My problem:
    Bottomline: I cannot pass the exception thrown by Agent.run() in the Thread.run() back to the main program.
    Explanation:
    The signature of Thread.run() (or Runnable.run()) is
    public void run();
    Since it does not have a throws clause, so I have to try/catch the Agent.run(), and rethrow a RuntimeException or Error. However, this RuntimeException or Error will not be caught by the main program.
    One work-around:
    Subclass the ThreadGroup, override the ThreaGroup.uncaughtException() methods, and spawn the threads of this group. However, I have to duplicate the logging and exception alerts in the uncaughtException() in addition to those already in the main program. This makes the design a bit ugly.
    Any suggestions? Am I doing this right?
    Thanks,
    Xiao-Li "Lee" Yang
    Three Java Files:
    // Agent.java
    public class Agent {
    public void run() throws Exception {
    throw new Exception("Test Exception"); // Agent can throw execptions
    // Manager.java
    public class Manager {
    public void run() throws Exception {
    try {         // <===  This try/catch is virtually useless: it does not catch the RuntimeException
    int numberOfAgents = 1;
    for (int i = 0; i < numberOfAgents; i++) {
    Thread t = new
    Thread("" + i) {
    public void run() {
    try {
    new Agent().run();
    } catch (Exception e) {
    throw new RuntimeException(e); // <=== has to be RuntimeException or Error
    t.start();
    } catch (Exception e) {
    throw new Exception(e); // <== never got here
    // ThreadTest.java
    public class ThreadTest {
    public static void main(String[] args) {   
    try {
    Manager manager = new Manager();
    manager.run();
    } catch (Throwable t) {
    System.out.println("Caught!"); // <== never got here
    t.printStackTrace();

    The problem is, where could you catch it anyway?
    try {
    thread.start();
    catch(SomeException e) {
    A thread runs in a separate, er, thread, that the catch(SomeException) isn't running within. Get it?
    Actually the Thread class (or maybe ThreadGroup or whatever) is the one responsible for invoking the thread's run() method, within a new thread. It is the one that would have to catch and deal with the exception - but how would it? You can't tell it what to do with it, it (Thread/ThreadGroup) is not your code.

  • Will subsequent calls to an object running in a thread run in the thread?

    Hi,
    If I start a thread with an empty run method and then make a call to the object that I started in the thread, will the method call run in the other thread? For example:
    class ThreadClass implements Runnable {
        public void someMethod() {
        public void run() {
    class ThreadCaller {
        private ThreadClass threadClass;
        public ThreadCaller() {
            threadClass = new ThreadClass();
            Thread thread = new Thread(threadClass);
            thread.start();
        public blah() {
            threadClass.someMethod();
    }Will the method call in blah() run in the same thread as ThreadCaller, or will it run in the thread that was started in ThreadCaller's constructor?
    Thanks,
    Dan

    Djaunl wrote:
    vanilla_lorax wrote:
    Djaunl wrote:
    Is there a way to keep the thread alive until the object that started the thread is terminated,Objects don't get terminated. What do you mean?I want the thread to stay alive indefinitely until I arbitrarily terminate it makes more sense. The thread will stay alive until its run method completes. The canonical approaches are
    public void run() {
      while (!Thread.interrupted()) { // NOT isInterrupted()
        // do stuff
        // if you need to catch InterruptedException, do this:
        try {
        catch (InterruptedException exc) {
          Thread.currentThread().interrupt();
    }And then from another thread, call theAboveThread.interrupt() when it's time to stop. Read the docs in interrupt(), interrupted(), the interrupt flag, etc.
    OR
    while (!done()) {
      // do stuff
    }and then another thread calls setDone(true) or somesuch when it's time to stop. Note that all access to done--both get and set--must be synchronized, or done must be declared volatile. Also note that you may still have to handle interrupts, so you may have some repeated code with this approach--testing both done() and interrupted().
    Let me give the end-goal of this.
    Currently, I have a "main" thread which the user can input commands into, and another thread which occasionally runs in the background. When I want something to run in the background, I just create a new thread. However, I figured it'd be more efficient to have one thread running in the background to do something as opposed to spawning hundreds of new threads to do the same task over and over. If the task happens VERY frequently and what it does is VERY small and quick, then the overhead of thread creation may make this a valid approach. Otherwise, don't overcomplicate it. Since you're new to threads, first get it working where you spawn one thread for each background task. Then move on to thread pooling. Look into ThreadPoolExecutor and related classes.
    http://java.sun.com/javase/6/docs/api/java/util/concurrent/ThreadPoolExecutor.html

  • Avoid timeout in Thread.run

    I have a Thread running task by task from a taskpool.
    while(running) {
    task = tasks.elementAt(0);
    process(task);
    Sometime, processing might take too long (timeout)
    so I need to force the thread to skip to the next task.
    1) How can I accomplish this without having access to
    process (my thread is abstract) ?
    2) Do application servers provide such a feature
    (timeout controll) at task level ?

    why not just time it using System.currentTimeMillis
    and then if it was too long (how long is too long ??)
    then remove the next task from your tasks vector ??Timing is no problem as I have a monitor doing this.
    The problem is that this is an abstract class, and I have
    no contorl over process() method. This could event
    run forever. As I said, stopping is controled by a monitor
    object but the problem is that my thread is running in
    process and I can't make it out (like throwing an exception).

  • How to calculate number of threads  running  on Windows 2000 terminal?

    How to calculate number of threads running on Windows 2000 terminal for the oracle process?
    I have installed Oracle 9i DataBase with 6 patch(9.2.0.6.0) on Windows 2000 Terminal.
    But,after database is started up, when i check up the sessions in v$session view.
    It is showing like for SYSTEM osuser alone, 10 ORACLE.EXE sessions running on this server machine in active state.
    Why it is creating 10 ORACLE.EXE sessions for a single Oracle Server.
    This is the output of v$session view.
    SQL> select terminal,osuser,status,sid,serial#,program from v$session;
    TERMINAL OSUSER STATUS SID SERIAL# PROGRAM
    IMGDBSVR SYSTEM ACTIVE 1 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 2 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 3 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 4 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 5 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 6 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 7 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 8 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 9 1 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 10 1 ORACLE.EXE
    SUGANTHI_DBA suganthi ACTIVE 11 91 sqlplusw.exe
    11 rows selected.
    SQL>

    This is how i have related these two views:
    SQL> select s.terminal,s.osuser,s.status,s.paddr s_paddr,b.paddr p_paddr,s.program
    2 from v$session s,gv$bgprocess b
    3 where s.paddr=b.paddr;
    TERMINAL OSUSER STATUS S_PADDR P_PADDR PROGRAM
    IMGDBSVR SYSTEM ACTIVE 33AF2270 33AF2270 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF2654 33AF2654 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF2A38 33AF2A38 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF2E1C 33AF2E1C ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF3200 33AF3200 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF35E4 33AF35E4 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF39C8 33AF39C8 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF3DAC 33AF3DAC ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF4958 33AF4958 ORACLE.EXE
    IMGDBSVR SYSTEM ACTIVE 33AF4D3C 33AF4D3C ORACLE.EXE
    10 rows selected.
    SQL>
    Here, It shows 10 sessions are running.
    Whether this means 10 threads are running on the particular server or not?

  • J2ME - Thread running independent of Midlet

    Hi Folks,
    I am very new to J2ME, but I have been reading the midp2.0 api and forums. From what I've read, you cannot have a MIDlet running in the background acting as a server (on the actual phone). My question is, is it possible to have a thread that is initially spawned when the MIDlet is instantiated and then runs independently of the MIDlet (if the MIDlet is destroyed, the thread is still running in the background)? Which would in theory act as a server who wakes up the MIDlet and tells it to perform some predefined tasks.
    So I saw the PushRegistry and the Storage classes in midp2.0, using these classes is this possible?

    Hi,
    The PushRegistry invokes your midlet when some condition defined by you is meet. ex: arrival of a sms, connection to aport on the mobile phone, arrival of a datagram, etc..
    You don't need to have a thread running for that.

  • Thread.run() method..

    I was wondering how the "Thread.run()" method get called. I started with "Thread.start()" and found it calls the "Thread.start0()" which is a native method.
    I downloaded the JDK 5 source code and went to "j2se\src\share\native\java\lang\Thread.c". In "Thread.c" I found a mapping of "start0()" with "JVM_StartThread".
    After that I opened the "hotspot\src\share\vm\prims\jvm.cpp". From line no 2257 to 2316 I saw the implementation of "JVM_StartThread".
    In side "JVM_StartThread", I saw there is a call to "Thread::start(native_thread)" and opened the "hotspot\src\share\vm\runtime\Thread.cpp". In "Thread.start()" method there is a call to "os::start_thread(thread);".
    In "hotspot\src\share\vm\runtime\os.cpp" the "os::start_thread()" calls the "pd_start_thread(thread);" method. But I did not get the "pd_start_thread(thread);" method in os.cpp.
    Note: I am java programmer and hardly understand the C/C++ languages. But had a doubt how the run() method get called and how the Thread.start() method works. But I got stuck here.
    Kindly help me to know how the flow goes, when we call the Thread.start() and how the run() method is linked to it.

    But I did not see anything in the os.cpp. In fact i did not find the "pd_start_thread(thread);" .
    void os::start_thread(Thread* thread) {
      // guard suspend/resume
      MutexLockerEx ml(thread->SR_lock(), Mutex::_no_safepoint_check_flag);
      assert(thread->is_baby_thread(), "thread has started");
      thread->clear_is_baby_thread();
      OSThread* osthread = thread->osthread();
      // A thread may be suspended in the presence of the profiler.
      // Only start thread when it's not suspended.
      osthread->set_state(RUNNABLE);
      if (!thread->is_vm_suspended()) {
        pd_start_thread(thread);
    }

  • RMI Registry leaves thread running

    I've searched the postings about this topic and none of them have been helpful. I create an RMI registry at port 1099 in my app, use it, and then try to shut it down, but it leaves a thread running.
    The following sample code shows what my code does (in a condensed form):
    Registry registry = LocateRegistry.createRegistry(1099);
    Communicator c = new CommunicatorImpl();
    registry.rebind("//localhost/remoteserver", c );
    Naming.rebind("rmi://localhost:1099/TriggerService", c);
    registry.unbind("//localhost/remoteserver");
    Naming.unbind("rmi://localhost:1099/TriggerService");
    boolean b = UnicastRemoteObject.unexportObject(registry, true);
    System.err.println( "unexported: "+b );When I run this code in Eclipse and the code exits, I still have a process running that was spawned by "LocateRegistry.createRegistry(1099)", but I can't figure out how to get a handle for it within my program, so that I can kill it. I've read that it will end when the JVM ends, but the RMI portion of my app is only a small part and I need the rest of it to keep running. Is there a way to stop this thread?
    Thanks,
    Tony

    Well I only see 'createRegistry' and 'getRegistry' I don't see any 'destroyRegistry' methods. So I don't know.
    What I used to do back in the day was to use Runtime to start an external process for processes that I needed to kill later on. So perhaps you can use the runtime to start the registry from the command line so to speak. Then hold a reference to the returned process. Then you can kill that process when you want the registry to die. In this case you will for sure be creating a new 'jvm' for the registry to run within. (if the registry is a java program)
    Otherwise I have no idea why you would be seeing an extra java process. If you run the eclipse debugger, the debugger should not exit until the whole process is done. Even when the program is done, the debugger will still be 'live' and you can push the stop button to stop the whole launched process.

  • 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

Maybe you are looking for

  • Adding link on SAP Gui logon page

    Hi All, I have the problem that I need to add a link on the SAP Gui logon page. Within the transaction SE61 I have added the general text ZLOGIN_SCREEN_INFO. When I click on the Insert Command I have the possibility to create a link but the char. for

  • Adobe Premier Elements DVACORE.DLL Crash

    Premier Elements 12 keep crashing on startup or shortly after startup with the same error message.  Here's the problem details: Problem signature:   Problem Event Name:    APPCRASH   Application Name:    Adobe Premiere Elements.exe   Application Vers

  • Mouse suggestions for FCP Studio2

    Hello, What is the best mouse to use with FCP Studio2 that is compatible with Leopard? Thanks for any and all help.

  • How can i stop recovery. my phone is stuck in the middle

    how can i stop recovery in my iphone 4s?  i haven't backit up yet but due to wifi interruption it didn't go through.  can i undo it?

  • Javascript error on jspx page

    Hello all, I am using ADF BC and ADF faces with JDEV version 11.2. I have issue where I have a popup on a page to create a row. Lately, I keep getting error in javascript as x269.getPeer().setBusy(x269,true); I used firebug to get this information an