of different parts or units of a program to be executed out-of-order or in partial order, without affecting the final outcome. Concurrency is achieved via multithreading. iconst_0 ... iload_2 ... iadd ... iconst_5 ... ... goto 4 ... iinc
thread of execution occurs at a given instant. The CPU quickly switches back and forth between several threads to create the illusion that the threads are executing at the same time. CPU I Thread 1 Thread 2 Thread 1 Thread 2 context switching
which is all the information CPU needs to execute an independent sequence of instructions. Executes as an independent sequence of instructions. val runnable = Runnable { val a = 1 val b = 2 println(a + b) } Thread(runnable).start() Java 1.1.4
executed when your program starts is called main thread - Thread which is used to work with GUI is called UI thread - On Android main and UI thread are the same thing
executed when your program starts is called main thread - Thread which is used to work with GUI is called UI thread - On Android main and UI thread are the same thing
executed when your program starts is called main thread - Thread which is used to work with GUI is called UI thread - On Android main and UI thread are the same thing
val task1 = Runnable { println("Task 1") } executor.execute(task1) val task2 = Runnable { println("Task 2") } executor.execute(task2) Executes as an independent sequence of instructions.
Thread Pool (unbound, thread has 60 seconds lifetime) - Scheduled Thread Pool - ForkJoinPool (Java 7, used in Coroutines, all threads in the pool attempt to find and execute subtasks created by other active tasks)
Thread Pool (unbound, thread has 60 seconds lifetime) - Scheduled Thread Pool - ForkJoinPool (Java 7, used in Coroutines, all threads in the pool attempt to find and execute subtasks created by other active tasks)
Thread Pool (unbound, thread has 60 seconds lifetime) - Scheduled Thread Pool - ForkJoinPool (Java 7, used in Coroutines, all threads in the pool attempt to find and execute subtasks created by other active tasks)
Thread Pool (unbound, thread has 60 seconds lifetime) - Scheduled Thread Pool - ForkJoinPool (Java 7, used in Coroutines, all threads in the pool attempt to find and execute subtasks created by other active tasks)
not bound to any particular thread. It may suspend its execution in one thread and resume in another one. Process→Thread (lightweight process)→Coroutine (lightweight thread)
to a file, database, or network - involves a lot of waiting for other hardware systems to complete their work - the upper bound for thread pool is fairly large (64 threads or unbound) CPU-intensive operations - compressing or decompressing, encryption or decryption in-memory data, image transformation - CPU won’t pause the execution as it does for an I/O operation - the upper bound for thread pool is to the number of cores the CPU has (and thus the number of threads it can run in parallel)
to a file, database, or network - involves a lot of waiting for other hardware systems to complete their work - the upper bound for thread pool is fairly large (64 threads or unbound) CPU-intensive operations - compressing or decompressing, encryption or decryption in-memory data, image transformation - CPU won’t pause the execution as it does for an I/O operation - the upper bound for thread pool is to the number of cores the CPU has (and thus the number of threads it can run in parallel)
to a file, database, or network - involves a lot of waiting for other hardware systems to complete their work - the upper bound for thread pool is fairly large (64 threads or unbound) CPU-intensive operations - compressing or decompressing, encryption or decryption in-memory data, image transformation - CPU won’t pause the execution as it does for an I/O operation - the upper bound for thread pool is to the number of cores the CPU has (and thus the number of threads it can run in parallel)