enow.com Web Search

Search results

  1. Results from the WOW.Com Content Network
  2. Multithreading is a mechanism of programing that you can implement in order to gain a remarkable time. so a Multithreading application is an application that uses more than two threads for two processor or more and it doesn't make sense to have more threads than processor it should be the same. answered Mar 26, 2018 at 11:30.

  3. Multithreading is used when we can divide our job into several independent parts. For example, suppose you have to execute a complex database query for fetching data and if you can divide that query into sereval independent queries, then it will be better if you assign a thread to each query and run all in parallel.

  4. 0. The easiest way of using threading/multiprocessing is to use more high level libraries like autothread. import autothread from time import sleep as heavyworkload @autothread.multithreaded () # <-- This is all you need to add def example (x: int, y: int): heavyworkload (1) return x*y.

  5. Here its the function i create that countdown the specific time the user apply: i need to make a thread with that function. Function (Countdown): int secs = 1; time_t unix; struct tm * timeinfo; time(&unix); timeinfo = localtime(&unix); int t1 = timeinfo->tm_sec;

  6. 1. If an iteration in loop is independent of the ones before it, then there's a very simple approach: try multi-processing, rather than multi-threading. Say you have 2 cores and ntimes is 100, then 100/2=50, so create 2 versions of the program where the first iterates from 0 to 49, the other from 50 to 99.

  7. multithreading - Threads in Java - Stack Overflow

    stackoverflow.com/questions/2865315

    Multithreading is a Java feature that allows concurrent execution of two or more parts of a program for maximum utilisation of CPU. Each part of such program is called a thread. So, Threads are light-weight processes within a process. Threads can be created by using two mechanisms : Extending the Thread class.

  8. How exactly does multithreading work? - Stack Overflow

    stackoverflow.com/questions/10951124

    Multithreading lets run more than one thread at once. On a multicore machine, this means two threads can really run in parallel, doing twice the work they'd do running one at a time. Ideally, on a 4 core machine, with 4 threads you'll get almost 4 times as much work done as with a single thread. For this to work, you need a problem that can be ...

  9. 2. A deadlock occurs when there is a circular chain of threads or processes which each hold a locked resource and are trying to lock a resource held by the next element in the chain. For example, two threads that hold respectively lock A and lock B, and are both trying to acquire the other lock.

  10. Threading pool similar to the multiprocessing Pool?

    stackoverflow.com/questions/3033952

    from multiprocessing.dummy import Pool as ThreadPool. and then for use, this library do like that : pool = ThreadPool(threads) results = pool.map(service, tasks) pool.close() pool.join() return results. The threads are the number of threads that you want and tasks are a list of task that most map to the service.

  11. A semaphore is a way to lock a resource so that it is guaranteed that while a piece of code is executed, only this piece of code has access to that resource. This keeps two threads from concurrently accesing a resource, which can cause problems. This is not restricted to only one thread.