Search Results

Search found 3641 results on 146 pages for 'threads'.

Page 11/146 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Threading cost - minimum execution time when threads would add speed

    - by Lukas
    I am working on a C# application that works with an array. It walks through it (meaning that at one time only a narrow part of the array is used). I am considering adding threads in it to make it perform faster (it runs on a dualcore computer). The problem is that I do not know if it would actually help, because threads cost something and this cost could easily be more than the parallel gain... So how do I determine if threading would help?

    Read the article

  • STA threads with SQLXMLBULKLOAD

    - by Christopher
    If I have N STA .NET Threads each performing an independent bulk load operation on a different database using the SQLXMLBulkLoad dll (which requires calling threads to be STA), is it possible for all bulk loads to be happening at the same time, or are they implicitly serialized due to the STA COM configuration? Thanks!

    Read the article

  • Is System.nanoTime() consistent across threads?

    - by obvio171
    I want to count the time elapsed between two events in nanoseconds. To do that, I can use System.nanoTime() as mentioned here. The problem is that the two events are happening in different threads. Since nanoTime() doesn't return an absolute timestamp but instead can only be used to calculate time differences, I'd like to know if the values I get on the two different threads are consistent with the physical time elapsed between the two events.

    Read the article

  • Jetty: Stopping programatically causes "1 threads could not be stopped"

    - by Ondra Žižka
    Hi, I have an embedded Jetty 6.1.26 instance. I want to shut it down by HTTP GET sent to /shutdown. So I created a JettyShutdownServlet: @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setStatus(202, "Shutting down."); resp.setContentType("text/plain"); ServletOutputStream os = resp.getOutputStream(); os.println("Shutting down."); os.close(); resp.flushBuffer(); // Stop the server. try { log.info("Shutting down the server..."); server.stop(); } catch (Exception ex) { log.error("Error when stopping Jetty server: "+ex.getMessage(), ex); } However, when I send the request, Jetty does not stop - a thread keeps hanging in org.mortbay.thread.QueuedThreadPool on the line with this.wait(): // We are idle // wait for a dispatched job synchronized (this) { if (_job==null) this.wait(getMaxIdleTimeMs()); job=_job; _job=null; } ... 2011-01-10 20:14:20,375 INFO org.mortbay.log jetty-6.1.26 2011-01-10 20:14:34,756 INFO org.mortbay.log Started [email protected]:17283 2011-01-10 20:25:40,006 INFO org.jboss.qa.mavenhoe.MavenHoeApp Shutting down the server... 2011-01-10 20:25:40,006 INFO org.mortbay.log Graceful shutdown [email protected]:17283 2011-01-10 20:25:40,006 INFO org.mortbay.log Graceful shutdown org.mortbay.jetty.servlet.Context@1672bbb{/,null} 2011-01-10 20:25:40,006 INFO org.mortbay.log Graceful shutdown org.mortbay.jetty.webapp.WebAppContext@18d30fb{/jsp,file:/home/ondra/work/Mavenhoe/trunk/target/classes/org/jboss/qa/mavenhoe/web/jsp} 2011-01-10 20:25:43,007 INFO org.mortbay.log Stopped [email protected]:17283 2011-01-10 20:25:43,009 WARN org.mortbay.log 1 threads could not be stopped 2011-01-10 20:26:43,010 INFO org.mortbay.log Shutdown hook executing 2011-01-10 20:26:43,011 INFO org.mortbay.log Shutdown hook complete It blocks for exactly one minute, then shuts down. I've added the Graceful shutdown, which should allow me to shut the server down from a servlet; However, it does not work as you can see from the log. I've solved it this way: Server server = new Server( PORT ); server.setGracefulShutdown( 3000 ); server.setStopAtShutdown(true); ... server.start(); if( server.getThreadPool() instanceof QueuedThreadPool ){ ((QueuedThreadPool) server.getThreadPool()).setMaxIdleTimeMs( 2000 ); } setMaxIdleTimeMs() needs to be called after the start(), becase the threadPool is created in start(). However, the threads are already created and waiting, so it only applies after all threads are used at least once. I don't know what else to do except some awfulness like interrupting all threads or System.exit(). Any ideas? Is there a good way? Thanks, Ondra

    Read the article

  • openmp program elapsed time not scaling with increased threads

    - by Griff
    I've got this openmp fortran program doing an embarrassingly parallel problem - do loop over 512^3 elements. See output below. Why would there be such strange behavior in the elapsed time as a function of threads? I thought it would peak at a sweet spot then slowly degrade. This clearly isn't happening. Perhaps I misunderstand something about openmp. Threads, omp_get_wtime 1, 103.76298500015400 2, 65.346454000100493 4, 45.923643999965861 7, 38.074195000110194 8, 36.968765000114217 9, 39.45981499995105 10,40.753379000118002 12,39.577559999888763 14,37.909950000001118

    Read the article

  • When Should I Use Threads?

    - by cam
    As far as I'm concerned, the ideal amount of threads is 3: one for the UI, one for CPU resources, and one for IO resources. But I'm probably wrong. I'm just getting introduced to them, but I've always used one for the UI and one for everything else. When should I use threads and how? How do I know if I should be using them?

    Read the article

  • re: adding more threads to forkjoinpool

    - by paintcan
    Word up y'all I recently successfully experimented with Scala futures, got future { my shiznit } all over da place. I'm pleased as punch w/ the gains I'm seeing from the parallelism and whatnot, but I'm only seeing 4 worker threads. Wanna see some more. I've been looking all over for how I can crank up the number of threads to 11, but no luck. Help me out doods

    Read the article

  • two threads going to do func()

    - by nisnis84
    2 threads going to use the same func(). The 2 threads should be mutually exclusive. How do I get it to work properly? (output should be "abcdeabcde") char arr[] = "ABCDE"; int len = 5; void func(){ for(int i = 0; i <len;i++) printf("%c,arr[i]); }

    Read the article

  • Waiting for a subset of threads in a Java ThreadPool

    - by David Semeria
    Let's say I have a thread pool containing X items, and a given task employs Y of these items (where Y is much smaller than X). I want to wait for all of the threads of a given task (Y items) to finish, not the entire thread pool. If the thread pool's execute() method returned a reference to the employed thread I could simply join() to each of these Y threads, but it doesn't. Does anyone know of an elegant way to accomplish this? Thanks.

    Read the article

  • [java] run 2 threads simultaneously

    - by lamsaitat
    hi all, in the case of an IM client. i have made 2 separate threads to handle sending packets (by std io) and receiving packets. the question is how to make these 2 threads run simultaneously so that i can keep prompting for input while at the same time be ready to receive packets at any time? i have already tried setting a timer but the data is always lost receiving.

    Read the article

  • Running 2 threads simultaneously

    - by lamsaitat
    In the case of an IM client. I have made 2 separate threads to handle sending packets (by std io) and receiving packets. The question is how to make these 2 threads run simultaneously so that I can keep prompting for input while at the same time be ready to receive packets at any time? I have already tried setting a timer but the data is always lost receiving.

    Read the article

  • How do I get the java.concurrency.CyclicBarrier to work as expected

    - by Ritesh M Nayak
    I am writing code that will spawn two thread and then wait for them to sync up using the CyclicBarrier class. Problem is that the cyclic barrier isn't working as expected and the main thread doesnt wait for the individual threads to finish. Here's how my code looks: class mythread extends Thread{ CyclicBarrier barrier; public mythread(CyclicBarrier barrier) { this.barrier = barrier; } public void run(){ barrier.await(); } } class MainClass{ public void spawnAndWait(){ CyclicBarrier barrier = new CyclicBarrier(2); mythread thread1 = new mythread(barrier).start(); mythread thread2 = new mythread(barrier).start(); System.out.println("Should wait till both threads finish executing before printing this"); } } Any idea what I am doing wrong? Or is there a better way to write these barrier synchronization methods? Please help.

    Read the article

  • Controlling maximum Java standalone running in Linux

    - by Gnanam
    Hi, We've developed a Java standalone program. We've configured in our Linux (RedHat ES 4) cron schedule to execute this Java standalone every 10 minutes. Each standalone may sometime take more than 1 hour to complete, or sometime it may complete even within 5 minutes. My problem/solution I'm looking for is, the number of Java standalones executing at any time should not exceed, for example, 5 threads. So, for example, before even a Java standalone/thread starts, if there are already 5 threads running, then this thread should not be started; otherwise this would indirectly start creating OutOfMemoryError problems. How do I control this? I would also like to make this 5 thread as configurable. Other Information: I've also configured -Xms and -Xmx heap size settings. Is there any tool/mechanism by which we can control this? I also heard about Java Service Wrapper. What is this all about?

    Read the article

  • C# Threading vs single thread

    - by user177883
    Is it always guaranteed that a multi-threaded application would run faster than a single threaded application? I have two threads that populates data from a data source but different entities (eg: database, from two different tables), seems like single threaded version of the application is running faster than the version with two threads. Why would the reason be? when i look at the performance monitor, both cpu s are very spikey ? is this due to context switching? what are the best practices to jack the CPU and fully utilize it? I hope this is not ambiguous.

    Read the article

  • problem with closing sockets

    - by Samantha
    Hi, I'm trying to write a client/server program with threads. I close the socket once the connexion is finished. The servers gets plenty of new connexions, and the socket number (file descriptor) increases very quickly: after 5 minutes running I was already at around file descriptor number 800! Is this a normal thing? Do threads share file descriptors? When I do close(sockfd); is the number released immediatly or after a some time? PS: I used to do with fork(), and I didn't have this issue. Thanks

    Read the article

  • App only spawns one thread

    - by tipu
    I have what I thought was a thread-friendly app, and after doing some output I've concluded that of the 15 threads I am attempting to run, only one does. I have if __name__ == "__main__": fhf = FileHandlerFactory() tweet_manager = TweetManager("C:/Documents and Settings/Administrator/My Documents/My Dropbox/workspace/trie/Tweet Search Engine/data/partitioned_raw_tweets/raw_tweets.txt.001") start = time.time() for i in range(15): Indexer(tweet_manager, fhf).start() Then in my thread-entry point, I do def run(self): print(threading.current_thread()) self.index() That results in this: <Indexer(Thread-3, started 1168)> So of 15 threads that I thought were running, I'm only running one. Any idea as to why? Edit: code

    Read the article

  • How can I stop my application?

    - by Roman
    I have the main thread from which I start a window using invokeLater. I run my application from command line. So, when application is running I see the window and my command line is "blocked" by the application. I can stop the application either by closing the window (as a result the command line is unblocked) or by typing Ctrl-C in the command line (as a result the window disappear). I wanted to be able to stop the application by clicking on a button in the window of the application. I used setVisible(false) for that. But in this way I can achieve the goal only partially. My window really disappear but the command line is still blocked. So, the software is still running. Well, I assume it's because some other threads are still running. But how can I easily close all these threads (like I do by closing the window of the application manually).

    Read the article

  • Threading vs single thread

    - by user177883
    Is it always guaranteed that a multi-threaded application would run faster than a single threaded application? I have two threads that populates data from a data source but different entities (eg: database, from two different tables), seems like single threaded version of the application is running faster than the version with two threads. Why would the reason be? when i look at the performance monitor, both cpu s are very spikey ? is this due to context switching? what are the best practices to jack the CPU and fully utilize it? I hope this is not ambiguous.

    Read the article

  • What is the JVM Scheduling algorithm ?

    - by IHawk
    Hello ! I am really curious about how does the JVM work with threads ! In my searches in internet, I found some material about RTSJ, but I don't know if it's the right directions for my answers. I also found this topic in sun's forums, http://forums.sun.com/thread.jspa?forumID=513&threadID=472453, but that's not satisfatory. Can someone give me some directions, material, articles or suggestion about the JVM scheduling algorithm ? I am also looking for information about the default configurations of Java threads in the scheduler, like 'how long does it take for every thread' in case of time-slicing. And this stuff. I would appreciate any help ! Thank you !

    Read the article

  • How to tell which thread(s) are producing all the garbage?

    - by Brad Hein
    I have an app with about 15 threads. Most do mundane tasks and sleep most of their lives. Others collect information and cache it in hashmaps. The hashmaps grow to a moderate size and level out. The number of keys and size of value remains constant, but the contents of the values changes (at 33 keys per second average). When I start my app, I notice the garbage collection interval goes from minutes to once per second, and the amount of garbage is 700k+ each time. In fact as I was writing this, it caused my phone to reboot with an error "Referencetable Overflow". Here's my question: Are there any tricks to identifying which threads are producing the garbage, or even finding out more about what garbage they are producing?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >