- 浏览: 614246 次
- 性别:
- 来自: 上海
最新评论
-
月光杯:
问题解决了吗?
Exceptions in HDFS -
iostreamin:
神,好厉害,这是我找到的唯一可以ac的Java代码,厉害。
[leetcode] word ladder II -
standalone:
One answer I agree with:引用Whene ...
How many string objects are created? -
DiaoCow:
不错!,一开始对这些确实容易犯迷糊
erlang中的冒号 分号 和 句号 -
standalone:
Exception in thread "main& ...
one java interview question
文章列表
Multithreading in Java - Synchronizing Threads
(Page 8 of 10 )A major concern when two or more threads share the same resource is that only one of them can access the resource at one time. Programmers
address this concern by synchronizing threads, much the same way baseball players take ...
- 2009-09-24 09:41
- 浏览 1014
- 评论(0)
Multithreading in Java - Setting Thread Priorities
(Page 7 of 10 )Previously
in this chapter, you learned that each thread has an assigned priority
that is used to let more important threads use resources ahead of
lower-priority resources. Priority is used as a guide for the operating s ...
- 2009-09-24 09:23
- 浏览 956
- 评论(0)
Multithreading in Java - Using isAlive()
and join()
(Page 6 of 10 )
Typically,
the main thread is the last thread to finish in a program. However,
there isn’t any guarantee that the main thread won’t finish before a
child thread finishes. In the previous example, we told the main met ...
- 2009-09-24 09:16
- 浏览 923
- 评论(0)
Multithreading in Java - Creating a Thread by Using extends
(Page 5 of 10 )You can inherit the Thread
class
as another way to create a thread in your program. As you’ll recall
from Chapter 8, you can cause your class to inherit another class by
using the keyword extends
when defini ...
- 2009-09-24 09:12
- 浏览 912
- 评论(0)
Multithreading in Java - Creating Your Own Thread
(Page 4 of 10 )
Remember, your program is the main thread, and other portions of your program can also be a thread. You can designate a portion of your program as a thread by creating your own thread. The easiest way to do this is to implement th ...
- 2009-09-23 23:07
- 浏览 930
- 评论(0)
Multithreading in Java - The Thread Classes and the Runnable Interface
(Page 3 of 10 )
You construct threads by using the Thread
class and the Runnable
interface. This means that your class must extend the Thread
class or implement the Runnable
interface. The Thread
class define ...
- 2009-09-23 23:06
- 浏览 892
- 评论(0)
Multithreading in Java - Overhead
(Page 2 of 10 )
The operating system must do extra work to manage multitasking. Programmers call this extra work overhead because resources inside your computer are used to manage the multitasking operation rather than being used by programs for processing instr ...
- 2009-09-23 23:04
- 浏览 1066
- 评论(0)
Multithreading allows two parts of the same program to run concurrently. This article discusses how to pull off this performance-improving feat in Java. It is excerpted from chapter 10 of the book Java Demystified, written by Jim Keogh (McGraw-Hill/Osborne, 2004; ISBN: 0072254548).
Marathon runners ...
- 2009-09-23 23:01
- 浏览 926
- 评论(0)
一、预备知识—程序的内存分配
一个由c/C++编译的程序占用的内存分为以下几个部分
1、栈区(stack)— 由编译器自动分配释放
,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。
2、堆区(heap) — 一般由程序员分配释放,
若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表,呵呵。
3、全局区(静态区)(static)—,全局变量和静态变量的存储是放在一块的,初始化的全局变量和静态变量在一块区域,
未初始化的全局变量和未初始化的静态变量在相邻的另一块区域。 - 程序结束后有系统释放
...
- 2009-09-23 11:48
- 浏览 849
- 评论(0)
<!-- X-Subject-Header-End-->
<!-- X-Head-of-Message-->
From
: Rob Newberry <robnewberry at grouplogic dot com>
To
: Eddy Ilg <eddy at fericom dot net>
Cc
: gcc-help at gcc dot gnu dot org
Date
: Thu, 22 Nov 2001 12:58:25 -0500 (EST)
Subject
: Re: C++ - Calling ...
- 2009-09-22 10:17
- 浏览 1139
- 评论(0)
If you are using STL fist time , you can see that these are the classes for holding a gropup of things.
You need to
include #include <vector> and #include <list> for using
these classes, also specify they are in std namespace . This can be
done by using namespace std;
...
- 2009-09-22 10:16
- 浏览 963
- 评论(0)
built-in data types:
scalar: int, string, reference
array
hash
- 2009-09-21 18:52
- 浏览 883
- 评论(0)
printf()函数是格式输出函数,请求printf()打印变量的指令取决与变量的类型.例如,在打印整数是使用%d符号,在打印字符是用%c 符号.这些符号被称为转换说明.因为它们指定了如何不数据转换成可显示的形式.下列列出的是ANSI C标准peintf()提供的各种转换说明. 转换说明及作为结果的打印输出
%a 浮点数、十六进制数字和p-记数法(C99)%A 浮点数、十六进制数字和p-记法(C99)%c 一个字符 %d 有符号十进制整数 %e 浮点数、e-记数法%E 浮点数、E-记数法%f 浮点数、十进制记 ...
- 2009-09-20 21:48
- 浏览 1241
- 评论(0)
Semaphore
File
Signal
Pipe
Socket
Message Queue
Shared Memory
- 2009-09-20 21:48
- 浏览 922
- 评论(0)
Use Protected Constructors to Block Undesirable Object Instantiation
In order to block creation of class instances, you can declare its constructor as protected.
class CommonRoot {
protected: CommonRoot(){}//no objects of this class can be instantiated
};
class Derived: public CommonRoot { ...
- 2009-09-20 21:35
- 浏览 1001
- 评论(0)