- 👋 Hi, I’m @osys
osys / osys.github.io Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://osyss.com
Home Page: https://osyss.com
https://osyss.com/posts/3fe1.html
对于并发执行的任务,Executor 框架是强大且灵活的。 ThreadPoolExecutor 提供了大量可调节的选项,比如创建和关闭线程的策略,处理队列任务的策略,处理过剩任务的策略,并且提供了几个钩子函数用于扩展它的行为。 钩子函数:terminated()、afteExecute()、beforeExecute()
https://osyss.com/posts/e71d.html
https://osyss.com/posts/3df5.html
https://osyss.com/posts/f030.html
Java 存储模型明确地规定了在什么时机下,操作存储器的线程的动作可以保证被另外的动作看到。 规范还规定了要保证操作是按照一种偏序关系进行排序。这种关系称为 happens-before,它是规定在独立存储器和同步操作的级别之上的。
https://osyss.com/2022/03/08/hello-world/
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick
https://osyss.com/posts/ff33.html
https://osyss.com/posts/46d8.html
https://osyss.com/posts/782e.html
死锁:静态的锁顺序死锁、动态的锁顺序死锁、协作对象之间发生的死锁、资源死锁。 在发生死锁时,可以通过线程转储 — 如使用命令 jcmd PID号 Thread.print 输出线程和锁信息,分析死锁原因。
https://osyss.com/posts/483b.html
使用 Object 超类中的 wait()、notify()、notifyAll()等方法管理条件队列 如果说 Lock 是显式的 Synchroinzed,那么也可以认为 Condition 也是一种显式的条件队列 —- Condition 提供了类似 wait()、notify()、notifyAll() 且更全面的方法
https://osyss.com/posts/406e.html
https://osyss.com/posts/6ccd.html
https://osyss.com/posts/842a.html
性能可伸缩性: 多线程能充分的发挥出闲置的处理能力,使现有任务正在运行的情况下立刻开始着手处理新的任务,提高系统的响应性。 Amdahl 定律: N 表示处理器数量,F表示串行化任务的比重。
https://osyss.com/posts/5adb.html
下载资源 jar;https://repo1.maven.org/maven2/org/lucee/jcip-annotations/1.0.0/jcip-annotations-1.0.0.jar 添加 jar 到程序中 1. 线程不安全多个线程中的操作执行顺序是不可预测的 非线程安全的序列生成器 123456789101112@NotThreadSafeclass UnsafeSequence
https://osyss.com/posts/2b7d.html
https://osyss.com/posts/2d61.html
https://osyss.com/posts/e39c.html
https://osyss.com/posts/d7d5.html
围绕任务的执行来构造应用程序,可以简化开发,便于同步。 Executor框架有助于我们在任务的提交与任务的执行策略之间进行解耦,同时还支持很多不同类型的执行策略。
https://osyss.com/posts/fff0.html
https://osyss.com/posts/ab90.html#more
https://osyss.com/posts/d008.html
所有并发问题都归结为如何协调访问并发状态,可变状态越少,保证线程安全就越容易。 尽量将域声明为 final 类型,除非它们的需要是可变的。
https://osyss.com/posts/3c21.html
显式的 Lock 与内部锁 synchronized 相比提供了一些扩展的特性,包括处理不可用的锁时更好的灵活性,以及对队列行为更好的控制。 ReentrantLock 与 synchronized各有优缺点。
https://osyss.com/posts/2bd1.html
任务、线程、服务以及应用程序在生命周期结束时的问题,可能会导致向它们引入复杂的设计和实现。 Java 没有提供具有明显优势的机制来取消活动或者终结线程。
https://osyss.com/posts/64a7.html
https://osyss.com/posts/c3e5.html
GUI框架几乎都是作为单线程化子系统实现的,所有与表现相关的代码都作为任务在一个事件线程中运行。 因为只有唯一一个线程,耗时任务会损害响应性,所以它们应该在后台线程中运行。
https://osyss.com/posts/b43f.html
比较并交换(compare-and-swap):当多个线程试图使用比较并交换(CAS),同时更新相同的变量时,其中一个线程会胜出,并且更新变量的值,而其它的线程都会失败。失败的线程允许尝试再次比较并交换操作。一个线程在竞争 CAS 时失败,不会被阻塞,它可以决定是否重试,这样的灵活性大大减少了锁相关的活跃度风险。 原子变量类,提供了广义的 volatile 变量,以支持原子的、条件的读-写-改操
https://osyss.com/posts/9a9d.html
https://osyss.com/posts/696.html
愿世间美好,与大家环环相扣 个人简介 分享很喜欢Martin Fowler的一句话: “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.“
https://osyss.com/posts/b56a.html
说明(主要是实现的思路) 对于使用 SpringBoot 中使用 MySQL 的项目来说,可能会面临一个 SpringBoot 项目连接多个不同的 MySQL 数据库。这里针对普通的 SpringBoot 项目进行实现。关注点在查询前,数据库选择上进行定义。Demo 项目代码已经放到了我的 GitHub,是 SpringBoot + MyBatis 的测试项目。通过注解,选择不同的数据库。可能
https://osyss.com/posts/6a33.html
https://osyss.com/posts/661c.html
目录结构Java并发编程实战:第1章 简介 Java并发编程实战:第2章 线程安全性 Java并发编程实战:第3章 对象的共享 Java并发编程实战:第4章 组合对象 Java并发编程实战:第5章 构建块
https://osyss.com/posts/97b4.html
https://osyss.com/posts/d3e0.html
https://osyss.com/posts/16107.html
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub. Quick
https://osyss.com/posts/f8f2.html
https://osyss.com/posts/c025.html
本章主要说明的是,如何测试并发程序。 分别从测试正确性、测试性能上说明如何编写测试程序。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.