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 // pi/java/util/concurrent/package- summary.html
Searching Linear search O(n) --slow Binary search O(log 2 n) --fast Refresher on logs: If 2 3 = 8 then log 2 8 = 3 Hashed search O(1) –fastest Search driver class
Sorting SelectionSort O(n 2 ) –-slow MergeSort O(n * log 2 n) –- fast HeapSort O(n * log 2 n) –- fast QuickSort O(n * log 2 n) –- fast