V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  zhouhu  ›  全部回复第 2 页 / 共 5 页
回复总数  97
1  2  3  4  5  
190 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
@arloor
some blocking operations in the JDK do not unmount the virtual thread, and thus block both its carrier and the underlying OS thread.

If a virtual thread performs a blocking operation such as I/O or BlockingQueue.take() while it is pinned, then its carrier and the underlying OS thread are blocked for the duration of the operation. Frequent pinning for long durations can harm the scalability of an application by capturing carriers.
190 天前
回复了 cbdyzj 创建的主题 Java Java 21 今日 GA,有虚拟线程(协程)
![测试图片]( https://imgur.com/a/nxo9wQv)
190 天前
回复了 cbdyzj 创建的主题 Java Java 21 今日 GA,有虚拟线程(协程)
补充一个,堆大小为 128M:
Time: 
2023-09-20 11:13:18
Used: 108,544 kbytes
Committed: 131,072 kbytes
Max: 131,072 kbytes
GC time: 
 8.149 seconds on ZGC Minor Cycles (384 collections)

 0.006 seconds on ZGC Minor Pauses (1,185 collections)

12.133 seconds on ZGC Major Cycles (61 collections)

 0.001 seconds on ZGC Major Pauses (279 collections)
190 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
@voidmnwzp
你说的是这个吧
There are two scenarios in which a virtual thread cannot be unmounted during blocking operations because it is pinned to its carrier:

When it executes code inside a synchronized block or method, or
When it executes a native method or a foreign function.

官方解释:
The scheduler does not compensate for pinning by expanding its parallelism. Instead, avoid frequent and long-lived pinning by revising synchronized blocks or methods that run frequently and guard potentially long I/O operations to use java.util.concurrent.locks.ReentrantLock instead. There is no need to replace synchronized blocks and methods that are used infrequently (e.g., only performed at startup) or that guard in-memory operations. As always, strive to keep locking policies simple and clear.

后续优化:
In a future release we may be able to remove the first limitation above, namely pinning inside synchronized. The second limitation is required for proper interaction with native code.
191 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
@Goooooos
JEP 446 Scoped Values (Preview)
Introduce scoped values, values that may be safely and efficiently shared to methods without using method parameters. They are preferred to thread-local variables, especially when using large numbers of virtual threads. This is a preview API.
191 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
@Mirage09 升级到 11 了,据说后面再升级就容易了。
这次新版本的新特性还是很值得期待的。虚拟线程和分代 ZGC
191 天前
回复了 cbdyzj 创建的主题 Java Java 21 今日 GA,有虚拟线程(协程)
分代 ZGC 没人关注吗
191 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
@Goooooos https://openjdk.org/jeps/444

irtual threads support thread-local variables (ThreadLocal) and inheritable thread-local variables (InheritableThreadLocal), just like platform threads, so they can run existing code that uses thread locals.

没看到说有优化
191 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
我看到油管的信息,分代 ZGC 吞吐量是 ZGC 的四倍,堆大小是 ZGC 的五分之一,很期待。
191 天前
回复了 forschers 创建的主题 Java JDK21 9 月 19 日 来咯!
分代 ZGC 据说性能很强
213 天前
回复了 orangutan92 创建的主题 macOS macOS 14 如何修改 F1~F12 的默认功能?
你和我使用习惯是一样的。我觉得调节亮度不是很频繁,两只手操作也还好。

是在不行,你可以禁用掉 Snipaste 的快捷键。
你只需要关心这个函数入参和出参
2023-02-25 17:22:49 +08:00
回复了 awesomePower 创建的主题 Java 大家相互分享下 Java 中常用的工具类心得
eclipse collection +1
@EscYezi
2023-01-30 19:40:35 +08:00
回复了 NoKey 创建的主题 程序员 Java 代码 switch 分支过多,怎么改写比较优雅呢?
升级到 Java 17
2023-01-22 00:21:04 +08:00
回复了 tans0008 创建的主题 问与答 问下大家,你们的手机套餐都是多少钱的啊?
@duckgo991 怎么玩的
2022-12-14 00:17:25 +08:00
回复了 yurong3333333333 创建的主题 程序员 大家在什么业务场景使用对象作为 HashMap 的 key?
hashCode 方法的返回(默认返回对象在内存中的地址)决定了对象在 HashMap 中的位置,equal (默认比较对象的内存地址)决定了两个对象是不是相等。要不要重写在于你的业务需求。
2022-12-12 17:26:16 +08:00
回复了 awanganddong 创建的主题 程序员 非严肃的讨论下这个问题
体制内不容易感染新冠,退休待遇好,人均寿命长。
2022-11-25 22:04:43 +08:00
回复了 zhouhu 创建的主题 程序员 mac idea 快捷键冲突问题求助
@TwofacedPurple 感谢老哥回复,我电脑没有 xcode ,app shortcut 也没有找到这个快捷键。
2022-11-25 10:37:08 +08:00
回复了 zhouhu 创建的主题 程序员 mac idea 快捷键冲突问题求助
@zhouhu 没找到
1  2  3  4  5  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   971 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms · UTC 20:34 · PVG 04:34 · LAX 13:34 · JFK 16:34
Developed with CodeLauncher
♥ Do have faith in what you're doing.