Process and Thread

I am new to the servlet and JSP technology.It is said that "Servlets and CGI differ mainly in Process and Thread.CGI used processes and Servlet technology uses Threads".I would like to know what exacly is the meaning of a process and a thread.How do we say that a process uses higher resources and hence a higher resource and memory overhead.
What do we exactly mean by thread and how r they using less resources?When we say Thread t=new Thread(); what exactly is happening inside?

A thread runs with in the context of the JVM process.
http://java.sun.com/docs/books/tutorial/essential/threads/definition.html
A process is the running of an executable. A cgi can be a C .exe file or a perl script run under perl.exe.
The thread is faster because the jvm process has been loaded into memory and initialized. For each cgi call the operating system has to load the code into memeory and intialize all the variables and resources.
http://c2.com/cgi/wiki?CgiVsServlet
http://www.disc.com/jdbcserv.html

Similar Messages

  • Understanding asynchronous BPEL processes and threading

    Hi everybody,
    I have a question regarding asynchronous BPEL processes and threading.
    I have an asynchronous BPEL process which delivers a message (picked up from a JMS topic) to a repository (via for instance an ICAN server). This transaction must be time-sensitive, i.e. first-in is first-out.
    If I have several threads running concurrently I have no guarantee that the messages are delivered in the same order that they where generated. It seems that the suggested way around this problem is to use single-threading.
    So here's the part that I do not understand:
    An asynchronous request does not wait for a response. If I use single-threading then what happens to that single-thread if for some reason (for instance the ICAN server is not responding) the BPEL instance is dehydrated? Is the thread still allocated for waiting for the first response or does it go back and pick up the next thing on the topic? If the next thing on the topic is picked up then how can I be sure that the messages are delivered in the correct order? If the thread is still allocated to the single instance then does that not kindda go against the whole concept of an asynchronous process?
    I hope some one can explain this to me.
    Thank you in advance.
    Kind regards,
    Mathias
    PS. This question is an attempt of a different angle on another forum thread: Asynchronuos BPEL - how to get the order of messages right?

    Hi again,
    A quick follow up question:
    Is there any way to have several BPEL processes running on the same server with different settings for how many threads to use?
    It seems that the only way to set number of threads used by BPEL is to use the configuration in the BPEL console? This is an domain setting - which means that all processes deployed to the server is effected the same way?
    I am asking because I am facing a scenario where I need one BPEL process to read from a AQ queue (well actually a topic) with a single thread and another BPEL process - deployed to the same BPEL server - to read from the same AQ queue with multiple threads.
    Does anyone have any idea of how to do this? Can it be done?
    Any suggestions, hints or reference to any documentation would be very much appreciated.
    Thank you in advance,
    Aagaard

  • Process and threads

    Dear community
    Very kindly pleasant about information that is fiber in thread process and threads it interface between user and application ?
    is this answer on user ask in application run ?
    About any advises who concerns this matter , please .

    Hello RB_1.
    You can find more informations about fibers
    here and
    here on the MSDN Library.
    Bye.
    Luigi Bruno
    MCP, MCTS, MOS, MTA

  • OracleIAS and Information about Process and Threads

    Hi all,
    I need to know information about the running process and threads inside a Conteiner or an Enterprise Application, is it possible?
    Thanks in advance.

    Hi,
    Probably all of mentioned in some extent - depends, which data system needs.
    regards,
    wojciech

  • JDK 1.6 on Solaris. Multiple java processes and thread freezes

    Hi, we've come across a really weird behavior on the Solaris JVM, reported by a customer of ours.
    Our server application consists of multiple threads. Normally we see them all running within a single Java process, and all is fine.
    At some point in time, and only on Solaris 10, it seems that the main Java process starts a second Java process. This is not our code trying to execute some other application/command. It's the JVM itself forking a new copy of itself. I assumed this was because of some JVM behaviour on Solaris that uses multiple processes if the number of threads is > 128. However at the time of spawn there are less than 90 threads running.
    In any case, once this second process starts, some of the threads of the application (incidentally, they're the first threads created by the application at startup, in the first threadgroup) stop working. Our application dumps a list of all threads in the system every ten minutes, and even when they're not working, the threads are still there. Our logs also show that when the second process starts, these threads were not in the running state. They had just completed their operations and were sleeping in their thread pool, in a wait() call. Once the second process starts, jobs for these threads just queue up, and the wait() does not return, even after another thread has done a notify() to inform them of the new jobs.
    Even more interesting, when the customer manually kills -9 the second process, without doing anything in our application, all threads that were 'frozen' start working again, immediately. This (and the fact that this never happens on other OSes) makes us think that this is some sort of problem (or misconfiguration) specific to the Solaris JVM, and not our application.
    The customer initially reported this with JDK 1.5.0_12 , we told them to upgrade to the latest JDK 1.6 update 6, but the problem remains. There are no special JVM switches (apart from -Xms32m -Xmx256m) used. We're really at a dead end here in diagnosing this problem, as it clearly seems to be outside our app. Any suggestion?

    Actually, we've discovered that that's not really what was going on. I still believe there's a bug in the JVM, but the fork was happening because our Java code tries to exec a command line tool once a minute. After hours of this, we get a rogue child process with this stack (which is where we are forking this command line tool once a minute):
    JVM version is 1.5.0_08-b03
    Thread t@38: (state = IN_NATIVE)
    - java.lang.UNIXProcess.forkAndExec(byte[], byte[], int, byte[], int, byte[], boolean, java.io.FileDescriptor, java.io.FileDescriptor, java.io.FileDescriptor) @bci=168980456 (Interpreted frame)
    - java.lang.UNIXProcess.forkAndExec(byte[], byte[], int, byte[], int, byte[], boolean, java.io.FileDescriptor, java.io.FileDescriptor, java.io.FileDescriptor) @bci=0 (Interpreted frame)
    - java.lang.UNIXProcess.<init>(byte[], byte[], int, byte[], int, byte[], boolean) @bci=62, line=53 (Interpreted frame)
    - java.lang.ProcessImpl.start(java.lang.String[], java.util.Map, java.lang.String, boolean) @bci=182, line=65 (Interpreted frame)
    - java.lang.ProcessBuilder.start() @bci=112, line=451 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String[], java.lang.String[], java.io.File) @bci=16, line=591 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String, java.lang.String[], java.io.File) @bci=69, line=429 (Interpreted frame)
    - java.lang.Runtime.exec(java.lang.String) @bci=4, line=326 (Interpreted frame)
    - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)There are also several dozen other threads all with the same stack:
    Thread t@32: (state = BLOCKED)
    Error occurred during stack walking:
    sun.jvm.hotspot.debugger.DebuggerException: can't map thread id to thread handle!
         at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.getThreadIntegerRegisterSet0(Native Method)
         at sun.jvm.hotspot.debugger.proc.ProcDebuggerLocal.getThreadIntegerRegisterSet(ProcDebuggerLocal.java:364)
         at sun.jvm.hotspot.debugger.proc.sparc.ProcSPARCThread.getContext(ProcSPARCThread.java:35)
         at sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess.getCurrentFrameGuess(SolarisSPARCJavaThreadPDAccess.java:108)
         at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
         at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
         at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:50)
         at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
         at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
         at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)I'm pretty sure this is because the fork part of the UnixProcess.forkAndExec is using the Solaris fork1 system call, and thus all the Java context thinks all those threads exist, whereas the actual threads don't exist in that process.
    It seems to me that something is broken in UnixProcess.forkAndExec in native code; it did the fork, but not the exec, and this exec thread just sits there forever. And of course, it's still holding all the file descriptors of the original process, which means that if we decide to restart our process, we can't reopen our sockets for listening or whatever else we want to do.
    There is another possibility, which I can't completely rule out: this child process just happened to be the one that was fork'd when the parent process called Runtime.halt(), which is how the Java process exits. We decided to exit halfway through a Runtime.exec(), and got this child process stuck. But I don't think that's what happens... from what I understand that we collected, we see this same child process created at some point in time, and it doesn't go away.
    Yes, I realize that my JVM is very old, but I cannot find any bug fixes in the release notes that claim to fix something like this. And since this only happens once every day or two, I'm reluctant to just throw a new JVM at this--although I'm sure I will shortly.
    Has anyone else seen anything like this?

  • Process and thread CPU%

    Hello,
    Is there a utility to allow me to view CPU usage of my process and its inidividual threads (i.e. not "top").
    Thanks,
    Neil

    tray
    sar n
    where n is the time period
    Ahmed fathy

  • What is the difference between Process and Threads

    What is the difference between Process and Threads

    http://forum.java.sun.com/thread.jsp?forum=45&thread=525518&start=0&range=15#2519429

  • Process and thread execution time

    HI all
    I am doing a project to develop a high level simulation framework. In the project I need to calculate the number of cycles of a snippet of code in a thread. Like
    void func()
    event1():
    int x;
    x = x * x;
    for();
    while();
    exec(numberofcyles)
    event2();
    Here I want to calculate the number of cycles between event1 and event2 and pass these number of cycles to the exec(numberofcycles) which will later on be simulated. I investigated a number of tools like gprof, Dtrace, linux process statistics, rdstc, getrusage(). None of these seems to be very relevent.
    I tried linux process statistics i.e. /proc/<pid>/task/<tid>/stat. I can access the execution time of threads, but all the time I get 0 execution time. What I think that it reads the execution time of threads when it was started. Is there any way to get the updated execution time of thread?
    Any help will be highly appreciated.
    Irfan

    I suggest reposting in the Unix forum here:
    http://discussions.apple.com/forum.jspa?forumID=735

  • GUI ..Process and threads

    Hi..Folks
    Is it possible to read the output of a class by starting it as a separate thread in a GUI application?
    Currently we follow this approach. We start the class as a separate process (passing in what ever parameters needed) in the GUI(using RunTime.exec()). Read the output.
    But we need a reference to the class that is being started.
    Is it possible to get a reference to the class?
    Thanks in advance.

    Thanks for your replies.
    Oki this time i will be more specific..I want to start and read the output of a thread..So while the thread is executing I can hook in to the output stream and read the output simultaneously...Actually I came across this link [Convert a Java OutputStream to an InputStream|http://ostermiller.org/convert_java_outputstream_inputstream.html] ... which suggests some idea to it...But the code gives compilation error (the bold line) ..."Cannot refer to a non-final variable in inside an inner class defined in a different method"..I have attached the code..Any ideas?
    Readin.java creates the thread and sends in the PipedInputStream to tt.java's putDataOnOutputStream() which writes to the stream back...
    Readin.java
    byte[] b = null;
               PipedInputStream in = new PipedInputStream();
               PipedOutputStream out ;
              try {
                   out = new PipedOutputStream(in);
              } catch (IOException e) {
                   e.printStackTrace();
                new Thread(
                  new Runnable(){
                    public void run(){
                      try {
                        *     new tt().putDataOnOutputStream(new PipedOutputStream(in));*
                        } catch (IOException e) {
                             // TODO Auto-generated catch block
                             e.printStackTrace();
                ).start();
               try {
                   in.read(b);
              } catch (IOException e) {
                   e.printStackTrace();
               String str = new String(b);
               System.out.println(str);
    ...          And the code for the other class is
    ... tt.java.....
    public  void putDataOnOutputStream(ByteArrayOutputStream out){
              String str="test";
              try {
                   out.write(str.getBytes());
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         }

  • Difference between viewoption.process and sourceoption.process.

    hi,
    In the Technical deplyment document, it tell me that calling a workflow by using sourceoption.process.But i know that we call a worflow by viewoption.process.
    this was code in the document
    <Form>
    <Field name='sourceOptions.Process'>
    <Expansion>
    <s>My workflow process name</s>
    </Expansion>
    </Field>
    </Form>
    can any one tell me what is difference in both ?
    Thank you

    The common usage of process and thread is as mjacobsca says. A process is a program that is currently excecuting. Each process has at least one thread running within it. Threads are sometimes called leightweight processes, so I would say process is the more general word. To complicate matters there are different thread depending on who owns them, the OS (native thread or the JVM (green thread).
    http://developer.java.sun.com/developer/qow/archive/97/index.html

  • Image Processing and machine vision don't appear in Function Palette

    Hi,
    I have problem and I can't solve it
    Image Processing and machine vision don't appear in Function Palette, Although I set up NI imaq and NI Vision Acquisition Why??
    Anyone can help me?
    Solved!
    Go to Solution.

    If the image is already a Grayscale U8 image you would just have to save it to a bitmap file using the IMAQ WriteFile VI. If not, use the IMAQ Cast Image VI to convert it to a Grayscale U8 and then save it.
    Also, it would probably be better to create a new thread for questions like these.
    Cameron T
    Applications Engineer
    National Instruments

  • Spawned Processes and Memory

    Hi Guys,
    Does the JVM limit the amount of memory that a process uses when spawning using Runtime.exec()
    Basically we are trying to run the microsoft linker from Java (via Maven) and it keeps erroring with 'out of memory' this seems to happen when the process uses around 275MB of RAM.
    Are processes spawned by Java limited to the amount of memory allocated to the JVM via -Xmx ?
    Any insight on this matter would be appreciated.

    Check the source code of the function
    Java_java_lang_Win32Process_create
    in j2se\src\windows\native\java\lang\Win32Process_md.c (you can get such
    source code downloading the SCSL Source code.
    The relevant information is posted below.
        si.dwFlags = STARTF_USESTDHANDLES;
        processFlag = CREATE_NO_WINDOW;
        ret = CreateProcess(0,                /* executable name */
                            cmd,              /* command line */
                            0,                /* process security attribute */
                            0,                /* thread security attribute */
                            TRUE,             /* inherits system handles */
                            processFlag,      /* selected based on exe type */
                            envcmd,           /* environment block */
                            cwd,              /* change to the new current directory */
                            &si,              /* (in)  startup information */
                            &pi);             /* (out) process information */It simply does not adjust memory size, or do something mysterious. It simply creates the process, and redirects the input , output and error streams.
    You really must get more memory (or adjust the size of your Windows swap file)...
    You can try lowering (not raising) the -Xmx limit of your Java program to make more room for the "link" process.

  • List of issues and fixes for procure to pay process and order to cash process for a trading company

    Dear All Gurus
    Kindly tell me where I can find the list of all issues arising in procure to pay process
    and order to cash process and there fixes for a trading company in support project
    Thanking You
    Abdul Baseer

    Hi Abdul,
    There are no standard list to provide, you should identify the issue through regression testing and raise an SR or create a thread accordingly we can help you.
    Note:- Issues are vary to instance to instance, version to version, installation to upgrade etc..

  • Workflow could not start in HCM process and Forms

    Hi All
    It would be really helpful if you can suggest possible solution regarding case management case in HCM forms and process.
    I have set up a simple custom HCM process and Form regarding Infotype 2 updation. I have checked the process and form consistency and it seems fine. Now when I run the process from HRASR_DT it generates a process number but it also gives an error workflow could not start.I get following error (SWIA log - Step history)
    Executing flow work item - Transaction brackets of the workflow has been damaged
    Exception occurred - Error when starting work item 000000007031
    PROCESS_NODE - Error when processing node '0000000014' (ParForEach index 000000)
    CREATE - Error when creating a component of type 'Step'
    CREATE_WIM_HANDLE - Error when creating a work item
    CREATE_VIA_WFM - Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event CREATED and (target) status
    EVENT_RAISED - Error updating the process object
    Executing flow work item - Exit CL_HRASR00_POBJ_WF_EXIT triggered exeception for event STATE_CHG and (target) status READY->ERROR
    EVENT_RAISED - Error updating the process object
    Executing flow work item - Transaction brackets of the workflow has been damaged
    Executing flow work item - Work item 000000007031: Object FLOWITEM method EXECUTE cannot be executed
    Executing flow work item - Error when processing node '0000000014' (ParForEach index 000000)
    I have searched few SAP notes such as 1384961 which talks about same error but it is implemented in our system (EA-HR 604 , Patch 27, )
    Appreciate any help.
    Thanks
    Umang

    Hi Swati
    One of the similar (not exact) issues were resolved by correcting the event linkage....please refer thread:
    http://scn.sap.com/message/14848795#14848795
    Not sure of the details of the the resolution, maybe Ragavendran Kanagaraj can throw more light.
    Just some high level checks (if not done already):
    Check event linkage errors in SWEQADM if anything is related to your WF
    Check in SWEL if it's showing any more details (not sure if it will)
    Any warnings in syntax check of WF template (PFTC) or WF definition (SWDD)
    Any error sin binding
    regards,
    Modak

  • Question about ASE 15.7 kernel mode – process vs threaded

    Hi there,
    This question is related to upgrading Sybase ASE Server
    from version 15.5 to version 15.7 on Sun Solaris SPARC Operating System
    (Solaris 10). For the upgrade, I need to choose between threaded kernel and
    process kernel mode.
    1> Is the process kernel mode in ASE 15.7 identical to
    process kernel in ASE 15.5? Are there any changes to process kernel mode
    between version 15.5 and 15.7? With all the other configurations on the Solaris
    host being same (Number of CPUs, RAM, Storage, Sybase ASE Configuration
    parameter values like total memory, engines), will the performance on ASE 15.7
    in process kernel mode be same as on ASE 15.5?
    If there are differences in performance, what are they? What should I be monitoring on ASE 15.7 to see
    if there is performance issue on the ASE Server?
    2> For the threaded kernel mode, are there any performance
    overheads like more CPU usage? We are not planning to change the hardware
    configuration of the Solaris host during the upgrade.  What values should I be monitoring at the OS
    level OR Sybase ASE level to make sure that there are no performance issues? Is
    there any particular parameter that needs to be monitored closely when we
    change to threaded kernel mode?
    Are there any Sybase Configuration parameters that I need
    to tune for the New threaded kernel mode? If so, do you have any performance
    tuning tips (white papers, technical documents) for threaded kernel mode?
    3> What is SAP Sybase recommendation on which Kernel mode I
    should be using? I researched the SAP Knowledge Base articles for
    recommendations on which Kernel mode to use and I could not find a definitive answer.
    Thanks,
    Raj

    Actually with Solaris on SPARC, there is a very key consideration - you should be on ASE 15.7 sp50 or sp100 or higher AND have applied the kernel jumbo patch (Oracle BugID 16054425) from Solaris that fixes the issue in which they prohibited OS threads from issuing KAIO calls.   Then in ASE, you need to configure the 'solaris async i/o mode' parameter.
    The changes between threaded and process mode kernels should be transparent to your application.  Generally speaking, SAP recommends 'threaded' kernel mode - and specifically for SAP applications only certifies 'threaded' kernel mode.    For custom applications, you *could* use either - although, depending on how many engines you run and what chipset you are on, you might see better performance with one vs. the other - typically threaded kernel mode is better, although there are exceptions.
    Generally, the main difference is that in process kernel mode, each engine did disk and network IO polling.   Due to OS security restrictions, this often meant that a engine had to process the disk IO in which it submitted...or for networking, your SPID had to run on your network engine for any network IO.  In threaded mode, there is a single parent process with engine tasks (threads) and IO tasks (threads).   Consequently, for customers used to running in the 10's of engines, we suggest a starting point of reducing the number of engines by 2 to give the IO tasks CPU time.
    One reason why threaded mode is often better is due to OS scheduling.   With hardware threaded cores, most OS dispatch schedulers do a better job of spreading the threads across the cores before utilizing the threads when a process is multi-threaded with POSIX threads - then a multi-process/kernel threaded implementation.   At one customer, we proved that we consistently got the best performance with threaded kernel and the only way we could match it with process kernel was to use OS cpu affinity to bind the ASE engine processes to individual cores.
    However, one consideration is that older SPARC Niagara chips (T1-T4) were notoriously bad at network handling for some reason.   As a result, one of the recommendations for ASE on SPARC Niagara chips is to run the same number of network engines as the number of cores ASE is using.   One solution to that is in Solaris 11 (I think) where Solaris finally started being able to handle network interrupts better - I also think the T5/T6 are much better chips - but I have no customer experience data to go on there.

Maybe you are looking for

  • Looking for a Splash screen for desktop login

    Thats it, I have been looking for a splash screen application that can make a splash appear since my login begins with SLIM and that disappears once all startup applications have been loaded. I tried plymouth, but I think it cannot be used for this p

  • Leap Year, Month, determination program

    Hi - it's the learning student again :) Our new assignment is to create a program to determine leap year, month and day information. So basically you enter a year and the program says if it is a leap year. Then you enter a month and the program deter

  • Large regular payments into infotype 0015

    Hi, Payroll want to streamline their processes. They have asked me if it is possible to do mass input for payments into addition payment info type 0015. It will be regular upload once a month, but different amounts. We are aware of Fast data entry, b

  • How to requce query.

    I want to increment time +1 , I have create one function it's working but is there any other way to reduce below code with same output. if possible i want only single query to increment time plush 1 without use to_date dunction. DECLARE V_TIME VARCHA

  • How can I solve this problem? logical vlan interface shutdown

    our backbone system is 5509, 6509 , 5509 and 6509 os is cat os. we make a 2 static routes to specific destination. I make a vlan 209, 211 and put a port 3/13, 3/14 I assign ip address in vlan 209, 211 in msfc mode and config 2 static route like this