由买买提看人间百态

topics

全部话题 - 话题: thread
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)
c******n
发帖数: 4965
1
来自主题: Java版 - 多少个thread 就算不正常?
TP stats 都是间接的。 直接看thread count 也是一样的啊
a***n
发帖数: 584
2
来自主题: Java版 - 问个关于thread的问题
当你想用有限的资源做更多的运算的时候.特别是即时多重运算.
另外,做web app效率测试的时候,很多问题都可以通过增加伺服器解决.但用thread
其实也可以.
h**********c
发帖数: 4120
3
thread safe singleton
q**q
发帖数: 266
4
如题。比如一个thread用sleep进入timed_waiting或用wait,join进入waiting state之
前,它是不是要释放它所拥有的所有lock?
谢谢。
r*****l
发帖数: 2859
5
Method wait() is associated with one object. Calling this method will cause
the thread to surrender the lock of that object.
r*****l
发帖数: 2859
6
http://docs.oracle.com/javase/6/docs/api/
One comment on that page for sleep():
"The thread does not lose ownership of any monitors."
e***a
发帖数: 1661
7
来自主题: Java版 - what is the use of thread.yield()?
what is the use of thread.yield()?
p*****2
发帖数: 21240
8
来自主题: Java版 - thread signaling 的一个问题

and
不过用个thread也无所谓吧?这个应该不是关键吧?
c*******9
发帖数: 6411
9
I tried the following code, and looks like text.setText("test") caused
the "org.eclipse.swt.SWTException: Invalid thread access" error.
the UI here has text field, and a browser button, the browser button will
display JFileChooser to choose a file.
any idea how to get this work?
thanks.
testing code:
private void createContents(final Shell shell)
shell.setLayout(new GridLayout(3, false));
final Label lable = new Label(shell, SWT.READ_ONLY);
lable.setText("File Path");
... 阅读全帖
z****e
发帖数: 54598
10
我尝试了一下用kill -3 PID > test.txt去获取thread dump
但是貌似不行,只能用jstack PID > test.txt才可以
e*****t
发帖数: 1005
11
kill -3 should work, but the thread dump does not necessarily go to your
test.txt
If the jvm were started already redirecting to somewhere, the threaddump
shall goes to that console or file or whatever.
g*****g
发帖数: 34805
12
来自主题: Java版 - one multi-threading question
You don't need one thread for each queue, you need a threadpool.

is
c*********e
发帖数: 16335
13
volatile貌似很少人用,一般就是用volatile boolean来设一个true,false.
synchronized更常用。
volatile让这个值不要存到cpu的register里面,而是存到内存里,这样就保证了永远
是最新的值。
貌似现在都是用web application + framework,里面已经有了multi-threading这些东
西了,没必要自己还用这些。一般过去的桌面的application,才需要搞这些高深的东西。
s****y
发帖数: 503
14
两个Java问题
1. How to make code thread-safe?
2. What code is good code?
第一题怎么答?是不是答synchronized,java.util.concurrent,threadlocal之类的?
第二题是不是答stable, maintainable, scalable, flexible就可以了?
s****y
发帖数: 503
15

回答thread-safe还有其他的吗?
S*******C
发帖数: 822
16
1. use local variables
2. use immutable objects
3. use thread-safe classes
4. use synchronized keyword
j********3
发帖数: 245
17
And use Frameworks, like Hibernate, each session is a singly thread?
不知道补充的对不对,请大牛们指教。最近在找工作,快2个月了还没有进展。
m**k
发帖数: 290
18
they are not the same thing.
In old Unix, creating a new process is much more expensive than creating a
new thread, because the child process needs to copy parent's address space.
In modern Linux, fork() uses copy on write, and thus has similar performance
to pthread_create(). Plus they use the same syscall clone().
S*O
发帖数: 52
19
来自主题: Programming版 - [转载] anybody familiar w/ java thread dump?
【 以下文字转载自 Java 讨论区,原文如下 】
发信人: SFO (sneeze my head off), 信区: Java
标 题: anybody familiar w/ java thread dump?
发信站: Unknown Space - 未名空间 (Fri Apr 8 19:02:07 2005) WWW-POST
how to detect if there is a dead lock or not?
any good experience about how to intepret a java dump correctly?
thanks!
q***z
发帖数: 934
20
来自主题: Programming版 - A thread question
Hello I am new on threads.
I am reading this example code, however, I can't understand it,
even though I search the usage of setpid, umask.
Can anyone explain it for me?
What's daemon?
Thank you very much!
#include
#include
int daemon_init(void)
{pid_t pid, pid1;
if((pid=fork())<0) exit(-1);
else if(pid)
{printf("pid=%d\n",(int)pid);e­xit( 0);} /* parent */
/* child */
printf("uid=%d gid=%d egid=%d \n",
(int) getuid(),(int) getgid(),(int) getegid() );
c********e
发帖数: 383
21
来自主题: Programming版 - How to know # of threads in an app?
one way /proc/self/stat
anothe way is to query on the thread group if you know the parent id
g****c
发帖数: 299
22
来自主题: Programming版 - multi threading 还是 multi processing
some example http://en.wikipedia.org/wiki/Thread_(computing)

multithread each thread share its resource
multiprocess each process own its resource(more memory), if needing process
communication,
I would choose multithread.
~~~~~~~~what does that
refer to
what does that mean?
p*u
发帖数: 2454
23
来自主题: Programming版 - multi threading 还是 multi processing
or you may use single thread but coroutine implementation.
b******y
发帖数: 139
24
来自主题: Programming版 - C# thread
When I run the following C# program and pull other windows at the same time,
painting will be messed up. But if the program is writeen in Java, such a
problem doesn't occur, so the reason is the C# thread. Anyone can help me to
fix it? Thanks.
// Calc.cs -----------------------------------------------------------------
k*k
发帖数: 508
25
来自主题: Programming版 - C# thread
不知道你到底想干吗,那个 Thread.Sleep 干吗用的?让程序 freeze 一段时间么?

time,
to
A**********e
发帖数: 3102
26
来自主题: Programming版 - C# thread
你得把 thread 定义好,从主程序启动,单独跑,给个名字, MSDN 上面有例子。你这
么干,不是把主程序给挂了么?

time,
to
m*****r
发帖数: 130
27
来自主题: Programming版 - Windows Thread API
MFC has c++ thread wrapper, but no good.
maybe you can look at boost c++ lib
j******a
发帖数: 1599
28
来自主题: Programming版 - thread, semaphore, 问题。
why user-mode threads in a single process can use a user-mode semaphore but
cannot use a kernel semaphore to perform synchronization?
t****t
发帖数: 6806
29
来自主题: Programming版 - thread, semaphore, 问题。
because a kernel sem will not yield control to another user-mode thread in
case a waiting has to happen.

but
bz
发帖数: 1770
30
来自主题: Programming版 - thread, semaphore, 问题。
you can, if you can give the user thread the access to the kernl sem. need
to be cautious though.

but
p*u
发帖数: 2454
31
来自主题: Programming版 - C++一个类中多个thread的问题
那你的ctor和dtor在哪个thread里?
s****l
发帖数: 137
32
来自主题: Programming版 - C++一个类中多个thread的问题
the object is constructed in main(). then I want to run multiple threads
within
the object. Is it possible or my model is wrong? thanks.
s******e
发帖数: 273
33
来自主题: Programming版 - 请推荐几本Multi-threading的编程书籍
想自学multi-threading, 请过来的大侠们推荐几本入门
及深入的书籍。谢谢。
h****e
发帖数: 2125
34
来自主题: Programming版 - 请推荐几本Multi-threading的编程书籍
programming with POSIX threads
c***d
发帖数: 996
35
☆─────────────────────────────────────☆
seashore (今年三十明年十八) 于 (Fri Oct 5 01:11:42 2007) 提到:
想自学multi-threading, 请过来的大侠们推荐几本入门
及深入的书籍。谢谢。
☆─────────────────────────────────────☆
jqfei (化装路过) 于 (Fri Oct 5 02:10:52 2007) 提到:
入门:
Windows下的,Multithreading Applications in Win32

☆─────────────────────────────────────☆
seashore (今年三十明年十八) 于 (Fri Oct 5 12:17:44 2007) 提到:
有 Linux的吗?
☆─────────────────────────────────────☆
helpme (范坚强) 于 (Fri Oct 5 12:24:37 2007) 提到:
programming wi
f*******y
发帖数: 988
36
来自主题: Programming版 - 如何强制thread和cpu绑定?
看了,都是说process的
问题是这玩意对thread来说存在么
l********s
发帖数: 358
37
来自主题: Programming版 - 请教multi-threading工具 (转载)
I am using Intel's Threading Building Blocks for my course's project.
s*****g
发帖数: 323
38
来自主题: Programming版 - 一般thread-safe access
thread-safe access to public member functions and variables在C++里是怎么写的?
我记得在java里,好像就是加一个synchronized.
在C++里,是不是也有类似的呢?
m***t
发帖数: 254
39
来自主题: Programming版 - thread, smp, 和grid computing
最近有点想不明白,在server端的运算,硬件方面显然是smp, 更快的interconnect,
blade。 但从programmerbility, run time efficiency, maintainbility, market
segment annd technology growth potential, 这些方面来看, 传统的sequential变
化来的multi-thread programming model, 对比erlang代表的functional language,
和map-reduce programming model和utility computing such as amazon ec2 and
hadoop, 哪个才是几年以后一统江湖的真命天子呢?
F*******i
发帖数: 190
40
来自主题: Programming版 - multi-thread 一问,
如果 我的程序需要同时 读和写很多数据,
请问可以用multi-thread 来 提高 IO 的 performance 吗?
比如现在有可能是写的太慢了, 导致会miss 掉一些读进来的数据,
如果 可以, 请问 c++ 有什么比较好的工具 或者 tutorial ?
谢谢
p*u
发帖数: 2454
41
来自主题: Programming版 - multi-thread 一问,
I think you need read-write lock for this purpose. you also need to buffer d
ata in your writer thread.
You can check out Linux AIO, though it's not C++ but C.
a****l
发帖数: 8211
42
来自主题: Programming版 - multi-thread 一问,
why do you think multi-threading will improve IO performance? If you hard-
drive can only write this fast, how can you make it write faster?
You need to refine your writing routines to make it faster.
a****l
发帖数: 8211
43
来自主题: Programming版 - multi-thread 一问,
Ok, I thought you meant your io is not writing fast enough.
Yes, in this case, it is almost always you must use 2 threads.
m*****e
发帖数: 4193
44
来自主题: Programming版 - multi-thread 一问,
He is asking multi-threading.
AIO is completely opposite.
a****n
发帖数: 230
45
来自主题: Programming版 - 我也请问一个multi-thread的问题
目前做一个real time的股票trading book系统,具体就是用UDP协议从市场读进data,然
后unpack,然后做filter,然后构建一个trading book.
data->unpack->filter->make book
其中信息的顺序和完整性很重要,可是可恶的udp会丢失一些数据,只能过后发request要
丢失的数据,来了的又不能让等着(超不多几个微秒一个数据包),其实丢失的概率也就是
百万分之一的机会...,但是关系重大,不能忽视. 代价就是filter要花很长一段时间(
20ms),然后做这个Book也要花~80ms. ( 重建的filter基本干得就是search的工作,我差
不多都用了hash-table 0(n),或者大家有更好的算法....)
我按照上面的箭头每一步做了一个thread,然后之间做Buffer承接,结果可像而知,越到
后面的步骤越慢,buffer过了一段时间就会暴掉memory.难道只能靠多买些physical
memory吗?
第一次开发一个软件,out of memory问题还是无法解决.希望哪位有经验的大侠给点意
见...
s******e
发帖数: 431
46
来自主题: Programming版 - 我也请问一个multi-thread的问题
后面的应该比前面的快,这也是一般使用buffer的原因。
但是你这个后面的比前面的慢,解决方法要不让前面慢点,要不就得想办法加快后面的
处理速度。看看make book或者filter能不能用多个thread 并行处理。
a****l
发帖数: 8211
47
来自主题: Programming版 - c++ multi-thread 一问,
thread has nothing to do with class.
r******m
发帖数: 6
48
来自主题: Programming版 - 精华区翻出来的MS老题,thread safe
“2)写一个circular queue,要求thread safe”
safe倒是简单,弄个mutex就行,但是策略应该如何?
比如,一个线程要插入,检测到锁了,是报错返回呢,还是等?
有没有大虾讲解讲解,谢谢了。
r****t
发帖数: 10904
49
threading debug 太难了。
g*********s
发帖数: 1782
50
来自主题: Programming版 - gdb如何跟踪multi-threading程序?
发现gdb只是显示main thread的情况,是不是设置有问题?
首页 上页 1 2 3 4 5 6 7 8 9 10 (共10页)