[Mac OS development] use gcd to quickly sort the array, and use gcd multithreading to find the maximum value in the array

Function of this example: use gcd to sort an array with 40000 numbers, and the numbers in the array are randomly generated The generated array code is as follows _numsMutableArray = [[NSMutableArray alloc] init]; for (int i = 0; i < 40000; i++) { NSNumber *temp = [NSNumber numberWithInt:arc4random_uniform(1000000)]; ...

Added by k.soule on Fri, 11 Feb 2022 17:44:45 +0200

Thread pool create thread

Definition: using pooling technology to manage and use ready-made technology is called thread pool Advantages of thread pool Generally speaking, thread pool has the following advantages: (1) Reduce resource consumption. Reduce the consumption caused by thread creation and destruction by reusing the created threads. (2) Improve response speed. W ...

Added by stuworx on Thu, 10 Feb 2022 04:19:00 +0200

springMVC, spring, control inversion, dependency injection, MyBatis, springBoot, springSecurity, Java multithreading, redis (buffer breakdown, penetration, avalanche, hotspot dataset failure)

What is spring MVC springMVC Is based on MVC Architecture to simplify WEB Application framework; A framework that belongs to the presentation layer. How spring MVC works The user sends a request to the front-end controller. The front-end controller receives the request and calls the processor mapper. The processor mapper calls the processor ...

Added by Riotblade on Wed, 09 Feb 2022 14:57:14 +0200

java multithreading: detailed explanation of ThreadLocal

Scenario: the problem of saving and obtaining the login User's information. In our conventional system design, the back-end system usually has a long call link (Controller - > Service - > Dao). Usually, after logging in, the User information will be saved in session or token. However, if we need to use User information in multiple calling ...

Added by ttroutmpr on Wed, 09 Feb 2022 04:08:27 +0200

Introduction and use of thread safe Collection related classes

Original 1: https://blog.csdn.net/lkp1603645756/article/details/85016035 Original 2: https://www.cnblogs.com/shamao/p/11065885.html 1 Introduction When we use multithreading, we sometimes use collections, but when we read and write multithreaded collections, we will report the error of concurrent modificationexception. The reason is that ...

Added by fiddlehead_cons on Wed, 09 Feb 2022 03:13:53 +0200

Multithreading is the processing method of memory overflow

1, What is multithreading 2, Creation method of multithreading 3, Why use thread pools 4, What about memory overflow Oom: OUTOFMEMORY (memory overflow) Common exceptions in development: 1.StackOverFlowError Example: there are many methods after recursive call, which explodes the stack space public class StackOverFlowErrorDemo{ public sta ...

Added by ddoc on Tue, 08 Feb 2022 17:05:03 +0200

Introduction and application of ThreadLocal in Java

Introduction and application of ThreadLocal in Java brief introduction This class provides thread local variables. These variables are different from their normal counterparts because each thread accessing a variable (through its get or set method) has its own local variable, which is independent of the initialized copy of the variable. T ...

Added by badboy1245 on Tue, 08 Feb 2022 16:56:10 +0200

Multithreading concept and three creation methods of multithreading

Multithreading related concepts Threads are independent execution pathsWhen the program is running, even if it does not create its own thread, there will be multiple threads in the background, such as main thread and gc threadmain() is called the main thread, which is the entry of the system and is used to execute the whole programIn a pro ...

Added by dr4296 on Tue, 08 Feb 2022 01:40:37 +0200

ReentrantLock reentrant lock

Synchronized is called implicit Lock, also known as JVM Lock, because it holds and releases locks implicitly without developer intervention. Java 1.5 introduces a new locking mechanism, in which the implementation of the Lock is based on the Lock interface: public interface Lock { // Lock void lock(); // Unlock void unlock(); // The lock ...

Added by kjl-php on Mon, 07 Feb 2022 23:16:38 +0200

[multithreading] learning notes

Multithreading Foundation Processes and threads In the computer, we call a task a process. The browser is a process, and the video player is another process. Similarly, both the music player and Word are processes. Some processes also need to execute multiple subtasks at the same time. For example, when we use Word, Word allows us to che ...

Added by Shovinus on Mon, 07 Feb 2022 20:47:57 +0200