Summary

Often arithmetic functionality can be broken down into several smaller, simpler steps that are ideal candidates for optimization. These smaller steps are generally used repeatedly on large amounts of data, and most contain looped or recursive functionality, which is why high levels of gain can be had. Several optimization techniques can often be introduced in arithmetic functionality:

  • Rewriting recursive routines into iterative routines

  • Loop unrolling

  • Using data-specific knowledge (using bit arithmetic operations and so on)

  • Using lists of predetermined answers or intermediate results

  • Using optimized mathematical equations

Multitasking is either performing different tasks on different processors simultaneously (multiprocessor system) or switching between tasks on a single processor (single processor system). Multitasking can be used to enhance the performance of a program running on a single processor system by, for instance, moving different program states or slow device interaction into a separate task. This way, waiting times do not slow down the main program and complex-polling strategies can be simplified. Tasks come in different shapes, each shape with its own characteristics:

  • Process

  • Thread

  • Fiber

While multitasking software can be the answer to many problems, there are things to look out for, such as task switching overhead, possibility of deadlocks, shared memory corruption, and so on.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset