V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  GeekGao  ›  全部回复第 13 页 / 共 113 页
回复总数  2259
1 ... 9  10  11  12  13  14  15  16  17  18 ... 113  
翻译过来 "非常适合大型团队,但当我单独工作或与 1-2 位朋友一起工作时,它就会拖慢我的速度"

有道理啊,用 ts 有明显熵增,js 看不出来,直到多人改代码时…
VM 的本质就是 C/C++指针和数据结构的 tricky skills 。内存分配和管理是非常大的知识范畴,几句话也说不明白
主干过程:
1.Bootstrap:JVM 需要先进行 bootstrap 过程,这个过程中会初始化一堆的标准库,包括 Java 的核心类库;
2.加载主类:在 bootstrap 过程中,JVM 还需要加载包含 main 方法的类。这是因为 Java 程序的执行是从 main 方法开始的,所以 JVM 需要先找到并加载这个类;
3.初始化 Java 线程:Java 线程的栈帧是寄生在 native thread stack 上的,这意味着 JVM 需要在执行字节码之前,为 Java 线程准备好运行环境

抛开过程谈本质: 用数组、自定义 struct 、指针内存模拟 CPU 寄存器、内存。把 class 文件解析后加载到常量池、异常处理表等对应的结构中。然后调用 OS API ( ABI )开辟新的线程来模拟 CPU 工作。
非预期故障一般做不到提前通知。事后应该有个公告,才是合理的。
67 天前
回复了 lvwzhen 创建的主题 分享创造 AI 模型价格对比
质量分怎么算出来的?依据是啥?
69 天前
回复了 kekeones 创建的主题 程序员 请教下 windows 驱动里的加解密
当然适合。很多透明加密程序的驱动实现都是用了 AES
69 天前
回复了 luxu 创建的主题 Kubernetes 自建 k8s, 外部如果访问对应的 TCP 服务?
Ingress 就行了啊
个人最近感觉:
咖啡机
外卖
都涨价了
线上产品的集群里曾经有几十个核,但是最大使用率估计不超过 10% 我们是用华为云的 x86 实例。除非感受到性能瓶颈了,不然还是不要提前折腾了
全局状态用 Jotai 库管理即可
71 天前
回复了 biuyixia 创建的主题 程序员 QQ 邮箱不要 FACE 啊
tx 邮箱只有几个码农维护… 有问题也属于正常了,沟通能解决最好(企业邮那边服务还凑合),不能的话就不要用了。
@liuidetmks 中国不允许有小利益集团存在,例如什么工会、互助会、行会 (手动猫头
这种站,只适合骗骗国内新人。在国际上属于垃圾站,权重不会高的。
72 天前
回复了 xzour 创建的主题 程序员 内部系统如何优雅的管理各种第三方接口
还是多年前的 SOA 治理问题
72 天前
回复了 wangpugod2003 创建的主题 程序员 讨论一道面试题啊(take home task)
意思是说这思路不行???

import java.io.*;
import java.util.PriorityQueue;

public class ExternalSorter {
public static void main(String[] args) throws IOException {
String inputFile = "bigfile.txt"; // 输入文件路径
String tempDirectory = "temp"; // 临时文件目录
int maxMemory = 1024*1024*1024; // 假设最大内存使用量限制为 1GB

try (BufferedReader reader = new BufferedReader(new FileReader(inputFile))) {
String line;
int fileCounter = 0;
while ((line = reader.readLine()) != null) {
// 使用 PriorityQueue 在内存中对行进行排序
PriorityQueue<String> sortedLines = new PriorityQueue<>();
sortedLines.add(line);

// 继续读取行,直到内存使用达到限制
int memoryUsage = line.length();
while (memoryUsage <= maxMemory && (line = reader.readLine()) != null) {
sortedLines.add(line);
memoryUsage += line.length();
}

// 将排序后的行写入临时文件
File tempFile = new File(tempDirectory, "tempfile" + fileCounter + ".txt");
try (BufferedWriter writer = new BufferedWriter(new FileWriter(tempFile))) {
while (!sortedLines.isEmpty()) {
writer.write(sortedLines.poll());
writer.newLine();
}
}

fileCounter++;
}
}

// 合并临时文件
mergeTemporaryFiles(tempDirectory);

// 清理临时文件
cleanUpTemporaryFiles(tempDirectory);
}

private static void mergeTemporaryFiles(String tempDirectory) throws IOException {
File[] tempFiles = new File(tempDirectory).listFiles();
PriorityQueue<BufferedReader> readers = new PriorityQueue<>((br1, br2) -> {
try {
String line1 = br1.readLine();
String line2 = br2.readLine();
return line1.compareTo(line2);
} catch (IOException e) {
throw new RuntimeException(e);
}
});

for (File tempFile : tempFiles) {
BufferedReader reader = new BufferedReader(new FileReader(tempFile));
readers.add(reader);
}

String outputFile = "output.txt"; // 输出文件路径
try (BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile))) {
while (!readers.isEmpty()) {
BufferedReader reader = readers.poll();
String line = reader.readLine();
if (line != null) {
writer.write(line);
writer.newLine();
readers.add(reader);
} else {
reader.close();
}
}
}
}

private static void cleanUpTemporaryFiles(String tempDirectory) {
File[] tempFiles = new File(tempDirectory).listFiles();
for (File tempFile : tempFiles) {
tempFile.delete();
}
}
}
72 天前
回复了 wangpugod2003 创建的主题 程序员 讨论一道面试题啊(take home task)
外部排序:

1.将文件分割成多个小块,每个小块可以在内存中排序。
2. 对每个小块进行排序,并将排序后的小块写入临时文件。
3. 合并所有排序后的小块,得到一个大的排序数组。
4.从排序后的数组中选择最大的 n 个值的 ID 。
1 ... 9  10  11  12  13  14  15  16  17  18 ... 113  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   5056 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 42ms · UTC 03:44 · PVG 11:44 · LAX 20:44 · JFK 23:44
Developed with CodeLauncher
♥ Do have faith in what you're doing.