(Java学习笔记) Java Threading (Java线程)
● Process & Thread
|
Processes are the abstraction of running programs: A binary image, virtualized memory, various kernel resources, an associated security context, and so on. Threads are the unit of execution in a process: A virtualized processor, a stack, and program state.
Threads are sometimes called lightweight processes. Both processes and threads provide an execution environment, but creating a new thread requires fewer resources than creating a new process. Threads exist within a process — every process has at least one. Threads share the process's resources, including memory and open files. This makes for efficient, but potentially problematic, communication.
Multithreaded execution is an essential feature of the Java platform. Every application has at least one thread — or several, if you count "system" threads that do things like memory management and signal handling. But from the application programmer's point of view, you start with just one thread, called the main thread. This thread has the ability to create additional threads, as we'll demonstrate in the next section. |
●
|
● Processes --Will by default not share memory --Most file descriptors not shared --Don't share filesystem context --Don't share signal handling
● Threads --Will by default share memory --Will share file descriptors --Will share filesystem context --Will share signal handling |
● Thread pool
|
Thread pool represents a group of worker threads that are waiting for the job and reuse many times, |
● Thread life cycle & states
|
|
(Java学习笔记) Java Threading (Java线程)的更多相关文章
- Java学习笔记心得——初识Java
初识Java 拿到这本厚厚的<Java学习笔记>,翻开目录:Java平台概论.从JDK到TDE.认识对象.封装.继承与多态...看着这些似懂非懂的术语名词,心里怀着些好奇与担忧,就这样我开 ...
- Java学习笔记-基础语法Ⅹ-进程线程
学习快一个月了,现在学到了黑马Java教程的300集 打印流的特点: 只负责输出数据,不负责读取数据 有自己的特有方法 字节打印流:PrintStream,使用指定的文件名创建新的打印流 import ...
- Java学习笔记之:Java简介
一.引言 Java是由Sun Microsystems公司于1995年5月推出的Java面向对象程序设计语言和Java平台的总称.由James Gosling和同事们共同研发,并在1995年正式推出. ...
- Java学习笔记之:Java String类
一.引言 字符串广泛应用在Java编程中,在Java中字符串属于对象,Java提供了String类来创建和操作字符串. 创建字符串最简单的方式如下: String str= "Hello w ...
- Java学习笔记之:Java引用数据类型之字符串
一.简介 字符串广泛应用在Java编程中,在Java中字符串属于对象,Java提供了String类来创建和操作字符串. 创建字符串最简单的方式如下: String greeting = "H ...
- 【Java学习笔记之一】java关键字及作用
Java关键字及其作用 一. 总览: 访问控制 private protected public 类,方法和变量修饰符 abstract class extends final implements ...
- Java 学习笔记 ------第一章 Java平台概论
本章学习目标: Java版本迁移简介 认识Java SE.Java EE.Java ME 认识JDK规范与操作 了解JVM.JRE与JDK 下载与安装JDK 一.Java版本迁移简介 书上已经表达得非 ...
- 【Java学习笔记之一】 java关键字及作用
Java关键字及其作用 一. 总览: 访问控制 private protected public 类,方法和变量修饰符 abstract class extends final implements ...
- Java学习笔记三十一:Java 包(package)
Java 包(package) 一:包的作用: 如果我们在使用eclipse等工具创建Java工程的时候,经常会创建包,那么,这个包是什么呢. 为了更好地组织类,Java 提供了包机制,用于区别类名的 ...
- Java 学习笔记之 Stop停止线程
Stop停止线程: 使用stop()方法停止线程是非常暴力的,会抛出java.lang.ThreadDeath Error,但是我们无需显示捕捉, 以下捕捉只是为了看得更清晰. public clas ...
随机推荐
- Java通过ftp上传文件
首先,pom.xml添加引用 <dependency> <groupId>commons-net</groupId> <artifactId>commo ...
- 一、win+git安装
最近公司版本控制准备弃用svn,采用git.所以在个人系统安装玩了下,留点爪印... 1.下载最新的 git 包(根据电脑系统) 官网地址:https://git-scm.com/download/w ...
- spring cloud: zuul(二): zuul的serviceId/service-id配置(微网关)
spring cloud: zuul(二): zuul的serviceId/service-id配置(微网关) zuul: routes: #路由配置表示 myroute1: #路由名一 path: ...
- caffe生成log日志
参考日志: http://blog.csdn.net/sunshine_in_moon/article/details/53529028 http://blog.csdn.net/lishanlu13 ...
- Python自学:第二章 合并(拼接字符串)
first_name = "ada" last_name = "lovelace" full_name = first_name + " " ...
- c++-pimer-plus-6th-chapter03
Chapter Review Having more than one integer type lets you choose the type that is best suited to a p ...
- CF-831D Office Keys 思维题
http://codeforces.com/contest/831/problem/D 题目大意是在一条坐标轴上,给出n个人,k把钥匙(k>=n)以及终点的坐标,所有人都可以同时运动,但不可以公 ...
- android -------- NDK 入门指南
NDK介绍 原生开发工具包 (NDK) 是一组可让您在 Android 应用中利用 C 和 C++ 代码的工具. 可用以从您自己的源代码构建,或者利用现有的预构建库. NDK 不适用于大多数初学的 A ...
- Dedecmsv5.7整合ueditor 图片上传添加水印
最近的项目是做dedecmsv5.7的二次开发,被要求上传的图片要加水印,百度ueditor编辑器不支持自动加水印,所以,找了很多资料整合记录一下,具体效果图 这里不仔细写dedecmsv5.7 整合 ...
- 『TensorFlow』高级高维切片gather_nd
gather用于高级切片,有关官方文档的介绍,关于维度的说明很是费解,示例也不太直观,这里给出我的解读,示例见下面, indices = [[0, 0], [1, 1]] params ...
