concurrency (threads) threads allow you to do tasks in parallel. in an unthreaded program, you code...
DESCRIPTION
Thread Pools Thread Pools manage (and limit) the number of active threads. This tends to be more orderly and more efficient for scaled applications.TRANSCRIPT
Concurrency (Threads)
Threads allow you to do tasks in parallel. In an unthreaded program, you code is executed
procedurally from start to finish. In a threaded program, you can have multiple
threads working concurrently.
Concurrency (Threads)
Concurrency is achieved through time-slicing. This is where the processor cycles through each active thread for an indeterminate period of time (the slice). This gives the illusion that there are multiple processes.
With multi-core processors, this may mean, true multi-threading is possible, but NOT guaranteed
Thread Pools
Thread Pools manage (and limit) the number of active threads. This tends to be more orderly and more efficient for scaled applications.
Synchronizing methods
When multiple threads have access to the same object, it makes sense to synchronize those methods which are prone to concurrency errors.
The bank account example.
Thread-safe collections
//http://download.oracle.com/javase/6/docs/api/java/util/concurrent/package-summary.html
Searching
Linear search O(n) --slowBinary search O(log2n) --fastRefresher on logs:
If 23 = 8 then log28 = 3
Hashed search O(1) –fastest
Search driver class
Sorting
SelectionSort O(n2) –-slowMergeSort O(n * log2n) –- fast
HeapSort O(n * log2n) –- fast
QuickSort O(n * log2n) –- fast