Two threads print alternately

Title: start two threads to print odd and even numbers from 0 to 100 alternately You may have encountered this problem during the interview. Although you have learned the knowledge related to multithreading, you may not be able to write it for a while and a half. Now let me take you to write it again! Method 1 First, we can observe that odd ...

Posted by LuciBKen on Sat, 18 Dec 2021 21:44:40 +0100

Cloud - Solve Distributed Transactions with Message Queuing, Summarize Practical Interviews in 2021 Java

Core concepts The important components are described below: Broker: The Message Queuing service process, which consists of two parts: Exchange and Queue. (Post Office / Express) Exchange: A message queue switch that routes messages to a queue according to certain rules and cares about messages. (courier in post office/courier in express compa ...

Posted by irishred8575 on Sat, 18 Dec 2021 21:31:47 +0100

Custom metric monitors inflow and output

Statement: this series of blogs is compiled according to SGG's videos, which is very suitable for you to learn. Some articles are collected by crawlers and other technical means in order to learn and share. If there is a copyright problem, please leave a message and delete it at any time. The latest version of big data interview questions in 2 ...

Posted by mrgym on Sat, 18 Dec 2021 19:53:39 +0100

Java advanced: Java file - & - IO, in-depth interview with linux kernel architecture

fis.close(); } /* * Method to realize file replication * 1. Byte stream reads and writes a single byte */ public static void copy_1(File src,File desc)throws IOException{ FileInputStream fis = new FileInputStream(src); FileOutputStream fos = new FileOutputStream(desc); int len = 0 ; while((len = fis.read())!=-1){ ...

Posted by ryanbutler on Sat, 18 Dec 2021 15:35:23 +0100

Arthas: an artifact for troubleshooting. It was brutally abused by MySQL in the first battle

I thought it might be a log problem, but there is no evidence to support it. The trace command can monitor the time consumption of each step, and can cooperate with the conditional expression to print a detailed log when the time consumption exceeds xx ms. Find a machine, enter a command, and then wait. When rt spikes appear again, the time-c ...

Posted by hr8886 on Sat, 18 Dec 2021 09:37:44 +0100

Java code block execution order

Let's start with the summary Parent static field - > parent static code block - > child static field - > child static code block - > parent member variable and non static block (sequential loading) - > parent constructor - > child member variable and non static block (sequential loading) - > child constructor Static cod ...

Posted by charmedp3 on Sat, 18 Dec 2021 05:29:06 +0100

This paper understands three traversal methods of binary tree

Focus on official account: high performance architecture exploration. The background replies to [data], which can be collected free of charge   As the saying goes: learning is like sailing against the current. If you don't advance, you will retreat; The heart is like a horse on the plain, easy to put but difficult to collect. This sentenc ...

Posted by Senate on Sat, 18 Dec 2021 02:14:52 +0100

Java interview must ask, ThreadLocal ultimate, Java one-year work experience interview question

"Do you know ThreadLocal?" "Tell me about your understanding of ThreadLocal" Of course, some interviewers will slowly lead to this topic, such as asking "how to prevent their variables from being tampered with by other threads in a multi-threaded environment", giving the initiative to yourself, and the rest depend ...

Posted by kevin1 on Sat, 18 Dec 2021 01:58:52 +0100

X - multithreading

problem 1. If there is a very time-consuming calculation in the business: + 1 million operations (the speed is slow and the execution time becomes longer) 2. Multiple execution units in the program at the same time? And they are all cycles (dead cycles) 1, Thread 1. Background java supports multithreading (JS php) and a large number ...

Posted by psy on Fri, 17 Dec 2021 16:41:52 +0100

Multithreading review

title: multithreading review date: 2020/10/17 1. Thread life cycle and status Newborn, ready, running, blocked, dead 2. sleep,wait,join,yield 3. Understanding of thread safety Example 1: if there are 10 tickets and three people buy them at the same time, because there is no thread synchronization, they may buy the same ticket. When there ...

Posted by Infinitive on Fri, 17 Dec 2021 07:09:35 +0100