A few easy examples of CPU-intensive tasks:
- searching for prime numbers (involves lots of BigInteger divisions)
- calculating large factorials e.g. 2000! ((involves lots of BigInteger multiplications)
- many Math.tan() calculations (this is interesting because Math.tan is native, so you’re using two call stacks: one for Java calls, the other for C calls.)
Related Contents:
- How do servlets work? Instantiation, sessions, shared variables and multithreading
- How do you kill a Thread in Java?
- What is a daemon thread in Java?
- JTextFields on top of active drawing on JPanel, threading problems
- Difference between wait() and sleep()
- Why is spawning threads in Java EE container discouraged?
- When and how should I use a ThreadLocal variable?
- How to catch an Exception from a thread
- How to make a Java thread wait for another thread’s output?
- What does SwingUtilities.invokeLater do? [duplicate]
- How to start/stop/restart a thread in Java?
- Waiting on a list of Future
- How to properly shutdown java ExecutorService
- Green Threads vs Non Green Threads
- What is recommended way for spawning threads from a servlet in Tomcat
- Why should wait() always be called inside a loop
- How is CountDownLatch used in Java Multithreading?
- How to call a method with a separate thread in Java?
- Happens-before relationships with volatile fields and synchronized blocks in Java – and their impact on non-volatile variables?
- Is it safe to construct Swing/AWT widgets NOT on the Event Dispatch Thread?
- Are java primitive ints atomic by design or by accident?
- How does memory reordering help processors and compilers?
- AsyncTask.executeOnExecutor() before API Level 11
- Volatile variable in Java
- Is a HashMap thread-safe for different keys?
- Java Synchronized Block for .class
- Java: starting a new thread in a constructor
- ThreadLocal & Memory Leak
- Threads and file writing
- Java’s Fork/Join vs ExecutorService – when to use which?
- Are Thread.sleep(0) and Thread.yield() statements equivalent?
- How do I implement task prioritization using an ExecutorService in Java 5?
- What is the difference between a synchronized method and synchronized block in Java? [duplicate]
- Is ExecutorService (specifically ThreadPoolExecutor) thread safe?
- Java Server with Multiclient communication.
- How does Java makes use of multiple cores?
- How to debug a multi-threaded app in IntelliJ?
- Java threads and number of cores
- Java Multithreading concept and join() method
- How to test methods that call System.exit()?
- Throttling javafx gui updates
- Instruction reordering & happens-before relationship [duplicate]
- Who is calling the Java Thread interrupt() method if I’m not?
- Why doesn’t volatile in java 5+ ensure visibility from another thread?
- How Threadpool re-use Threads and how it works
- Do Java sockets support full duplex?
- If a synchronized method calls another non-synchronized method, is there a lock on the non-synchronized method
- Any good Spring threading with a TaskExecutor examples? [closed]
- Concurrent JUnit testing
- Java Synchronized list