由买买提看人间百态

topics

全部话题 - 话题: threaded
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
f******e
发帖数: 164
1
pthread和Linux thread没关系么?
m***t
发帖数: 254
2
posix thread is the spec, linuxthread is the older implementation of this
spec. nptl is the current implementation of this spec.
d*****l
发帖数: 8441
3
Solved this problem after consulting our software team. The reason was that
I used an API function inside my thread to invalidate a displaying view-port
. That is not good for a work thread although it remains workable under
usual conditions.
c***d
发帖数: 996
4
来自主题: Programming版 - [合集] thread safe or not???
☆─────────────────────────────────────☆
pxu (Lingua Franca) 于 (Wed Sep 20 16:23:26 2006) 提到:
Please take a look at following Pseudocode. I don't think
it's thread-safe. any ideas how to make it thread-safe?
class A
{
public:
A() : ptr(NULL) { };

void startup(B b, int i)
{
static C c(i);
ptr = &c;
b.dostuff(ptr);
}
private:
const C * ptr;
};
class B
{
public:
B() { };

/*
* value th
l**t
发帖数: 6971
5
来自主题: Programming版 - 请教multi-threading工具 (转载)
【 以下文字转载自 SanFrancisco 讨论区 】
发信人: lopt (NextStep), 信区: SanFrancisco
标 题: 请教multi-threading工具
发信站: BBS 未名空间站 (Thu Apr 17 19:29:07 2008)
c/c++, unit/linux environment
大家用什么debug?
用什么package?有人用Intel的thread building block吗?
用什么memory allocator?
有人听说过Cilk吗?
多谢。
p.s. 这才是我们硅工上班灌水的正题啊。以后可以理直气壮了。
j***n
发帖数: 301
6
简单地说,你不能从一个thread的外部将其终止。
process可以
W*Z
发帖数: 10
7
来自主题: Programming版 - 一般thread-safe access
I don't think there are any key words in C++ to support thread safe, however
, there are design and implementation rules to enforce thread safe while
writing C++ codes. It is not an easy topic, search online for various
discussions.
I think the key would be what is a valid state of an object and how to keep
it valid all the time.
r****t
发帖数: 10904
8
来自主题: Programming版 - 多个thread的通信
什么叫多个thread之间的*实时*通信?you got to block and wait for data in some
threads. 这种事干多了,你就觉得还是twisted省心。
D*******a
发帖数: 3688
9
来自主题: Programming版 - multi-thread 一问,
thread,mutex,semaphore本来是OS的东西,所以不同操作系统下面用法不同
不过现在好像可以用boost::thread库
m***t
发帖数: 254
10
来自主题: Programming版 - 我也请问一个multi-thread的问题
the original post does not make much sense to me. so
udp connection -> unpack -> filter -> makebook,
so if there is error in udp packet, you donot clear the buffer till the new
response comes in to correct the error? then thread stack overflow happens
at unpack stage?
if i were you i will test first part first. given If that does not give you
problem, i think it might be you are not dequeing thread buffer incorrectly
at latter stages.
F*******i
发帖数: 190
11
来自主题: Programming版 - c++ multi-thread 一问,
class A{
public:
int a;
int b;
void function();
}
suppose 在 function 中 create 2 个 thread, 如果 pass a or b by
reference, 请问两个 thread 可以 share a 或 b 吗 ?
谢谢
D*******a
发帖数: 3688
12
来自主题: Programming版 - 精华区翻出来的MS老题,thread safe
mutex cannot be unlocked by another thread other than the owner thread

the
occupied.
and
D*******a
发帖数: 3688
13
来自主题: Programming版 - 精华区翻出来的MS老题,thread safe
mutex can only be unlocked by the thread which locks it
semaphore can be released by any thread
therefore you cannot use mutex as a binary semaphore under some cases
b***y
发帖数: 2799
14
☆─────────────────────────────────────☆
ylyly (转回原点) 于 (Thu Feb 14 17:29:53 2008) 提到:
每次面试别人都问这方面你懂多少?
我只能说,我上过parallel and distributed computing课,做过course project
写过multi-thread RPC server-client程序
到底multi-thread programming需要懂些什么东西,做什么project呢?
有什么好书/网站推荐么?
☆─────────────────────────────────────☆
microbe (纵使相逢应不识) 于 (Thu Feb 14 17:31:28 2008) 提到:
这个基本上只能通过做project。学校里这方面锻炼很少。

☆─────────────────────────────────────☆
pptwo (pp) 于 (Thu Feb 14 18:17:36 2008) 提到:
你太谦虚了,基本的去看UNP第二册。
b***y
发帖数: 2799
15
☆─────────────────────────────────────☆
ylyly (转回原点) 于 (Thu Feb 14 17:29:53 2008) 提到:
每次面试别人都问这方面你懂多少?
我只能说,我上过parallel and distributed computing课,做过course project
写过multi-thread RPC server-client程序
到底multi-thread programming需要懂些什么东西,做什么project呢?
有什么好书/网站推荐么?
☆─────────────────────────────────────☆
microbe (纵使相逢应不识) 于 (Thu Feb 14 17:31:28 2008) 提到:
这个基本上只能通过做project。学校里这方面锻炼很少。

☆─────────────────────────────────────☆
pptwo (pp) 于 (Thu Feb 14 18:17:36 2008) 提到:
你太谦虚了,基本的去看UNP第二册。
b*******a
发帖数: 68
16
来自主题: Programming版 - 怎么 kill 一个 thread 啊
在大部分平台上,KIll thread从来不是个好主意,thread应该自己正常退出,只有一
个情况一般比较合理,就是用户从console直接KILL 整个PROCESS
a*****t
发帖数: 30
17
来自主题: Programming版 - 关于thread的stack
Thanks a lot. At first I thought that the "stack area" was the stack of the
process. And each thread use a part of the "stack area" as its local stack.
And this made me very confused.
I think it makes more sense that each thread is allocated with a signle "
stack area", which probably comes from the heap of the process. Am I right?
b******n
发帖数: 592
18
来自主题: Programming版 - thread or process
Our system runs 16 copy of same application on a Barcelona platform, each pr
ocess is taking about 900Mbyte memory. We try to reduce the memory by sharin
g about 200Mbyte data between processes/threads without changing too much co
de.Because these data are readonly, so it should be a probably sharing. I di
d a bit research on processes and threads, found:
processes: sharing data between processes will invalids raw pointers. Also t
he data creation needs to use allocator from shared segments. Use
c*********t
发帖数: 1861
19
来自主题: Programming版 - p-thread profiling
I used RUSAGE_SELF as the first argument, and I got *accumulated* resource
usage for all threads within the same process. Seems Linux kernel does not
have per-thread statistics accounting, is that true?
m******n
发帖数: 155
20
来自主题: Programming版 - 请教C++ thread library
Boost thread基本上就是给posix和windows的thread library写了一个统一的wrapper
啊。
z****e
发帖数: 2024
21
来自主题: Programming版 - 多线程计时不准std::thread尝鲜 问题
为什么多线程计时的时候就不准了呢?
mywork是一个干活的类,里边对n1和n2分别进行计算,用cal1和cal2函数。
然后生成两个线程类,都引用同一个mywork,算cal1和cal2.
比较对象是一个普通函数f()。
我明明,用手表计时,发现多线程是快的,大概19秒左右完成,看任务管理器的cpu实用状态也大体符合20秒。
怎么用程序计时,就是这个输出了呢?太奇怪了,真着急。
output:
1000000000
33.84 seconds elapsed for multithreading.(这句话出现的时候,其实是20秒)
1000000000
27.82 seconds elapsed for one thread.
以下是源码。
#include
#include
#include
using namespace std;
const long long int M=5e8;
class mywork{
public:
mywork():n1(1),n2(1),flag1(0),flag2(0){}
void
t****o
发帖数: 89
22
OMP比thread抽象层次高,能有就用。
如果用pthread,你就得自己控制有多少个threads.
而且OMP提供许多collective操作,比pthreads好用多了
M**********n
发帖数: 432
23
来自主题: Programming版 - 请问这是 multi-thread 吗?
No. Multi-threaded program is a single process running on a single machine.
Different threads in the same process share some common resources.
t****t
发帖数: 6806
24
no, when i said "current" thread, means the thread executing the code
snippet you provide. it starts t1 and t2 and waits for t1 and t2. it can
never be t1 or t2.
t****t
发帖数: 6806
25
well, actually the creater thread is blocked immediately. so yes,
effectively it's single-threaded.
EM
发帖数: 715
26
来自主题: Programming版 - C++11 native thread问题
怎么知道一个thread已经complete了?
thread.joinable(), future<>.valid, future<>.wait_for(), future<>.wait_util()
好像都不行嘛
请C++大侠们指教
t****t
发帖数: 6806
27
来自主题: Programming版 - C++11 native thread问题
i don't think you can check whether a thread is completed. So you have to do
it yourself: set a shared flag at the end of thread.

()
t****t
发帖数: 6806
28
来自主题: Programming版 - C++11 native thread问题
POSIX thread can not check whether a thread is completed.
h**********c
发帖数: 4120
29
来自主题: Programming版 - C++11 native thread问题
A thread is complete, you will know it.
But there is no reliable way, as far as I know, to check a thread is
complete.
Let's say a process, you must set the read or write lock for the process
table,you read a state, when you release the lock, another state.
c*******y
发帖数: 1630
30
来自主题: Programming版 - C++11 native thread问题
thread::timed_join(0) but possible race condition.
It will return false if the thread is still running.

()
l*******G
发帖数: 1191
31
来自主题: Programming版 - 新书推荐 working with ruby threads
http://www.jstorimer.com/products/working-with-ruby-threads
rails concurrency and threading in depth story and solution.
c*******9
发帖数: 6411
32
【 以下文字转载自 Java 讨论区 】
发信人: cplus2009 (in the woods (木老虎)), 信区: Java
标 题: update main UI from child thread issue
发信站: BBS 未名空间站 (Tue May 21 14:13:10 2013, 美东)
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 She... 阅读全帖
r*******n
发帖数: 3020
33
event based 和 thread based的架构都有各自的优缺点,
据说nodejs 在选择event-based 和thread based也是考虑很多,最后选了event-based。
基于C Python的我觉得event based架构要好,因为C Python做多线程弱。
w****k
发帖数: 6244
34
来自主题: Programming版 - 有人熟悉Python里的threading吗
python thread is not real multiple thread
use multiprocess if u want use multi cpus
m********a
发帖数: 128
35
来自主题: Programming版 - what is "recursive locks by the same thread"
Java has limit on the # of recursive locks by the same thread.
can someone give an example of such locks? thanks!
Must the recursive locks be locking different objects? so this means the
limit is on the # of locks one thread can hold, right? but why recursive
locks?
k**********g
发帖数: 989
36

The C++ multithreading gurus should study the Microsoft implementation of
Parallel Patterns Library. http://msdn.microsoft.com/en-us/library/dd492418.aspx
Even if one has a hatred for Microsoft, one must admit that PPL is one
advanced implementation of a concurrency (and multithreading) library where
a lot of design effort has been invested.
C++ already has mechanism for capturing the exception thrown in one thread,
and rethrowing or retrieving it from a different thread.
k****5
发帖数: 546
37
来自主题: Programming版 - c++ thread 求助
这个问题不许要用底层的thread api, 用openmp解决比较简单
google openmp pragma omp for schedule
还有,不需要那么多thread, 最多core number的两倍差不多了
W***o
发帖数: 6519
38
I am trying to write a user-level thread library in C. My strategy is to use
ucontext_t, signal, sigaction to support thread creation, initiation, join,
mutex, yield, cancel, and exit.
Without pre-emption, my code currently works with all the methods. But when
I try to add pre-emption support, the program seems running funny and
confusing. So I need to see some examples, better implemented in C.
I am new to C, and have only started C program from 20 days ago. I am
comfortable with using struct, ... 阅读全帖
p*****2
发帖数: 21240
39
来自主题: Programming版 - Node.js 是有 multiple-threading 支持的?

internal有thread pool,但是你自己的code只能运行在single thread上。
w***g
发帖数: 5958
40
来自主题: Programming版 - wdong你可以把event和thread拆开来
goroutine是一种用户态的thread。gochannel跟命令行的管道或者message queue啥的
差不多,用来进行thread通信的。
l**********n
发帖数: 8443
41
来自主题: Programming版 - coroutine or thread
scala有轻量thread吗?actor用的是thread吧?
g*****g
发帖数: 34805
42
You don't, it's normal for a web server to have dozens of cpus and hundreds
of threads.
s******u
发帖数: 501
43
可以,这个没问题,就把main thread当成普通的一个thread,直接用mutex.lock/
unlock就可以了
w***g
发帖数: 5958
44
来自主题: Programming版 - malloc per-thread arena
有人遇到过这个问题吗?这事情搞了我整整两天,一直以为是内存泄漏。
结果发现是glibc的问题-- 这个thread释放的内存那个thread没法用。
这次大涨见识了。
c*********e
发帖数: 16335
45
怎么测试?有没有专业软件测试?
看起来,java multi-threading project很容易有deadlock, race condition;而且很
难测试出来。大家的java multi-threading project,写出来之后怎么测试deadlock,
race condition的?
c*********e
发帖数: 16335
46
我一个同事,用multi-threading做一个c# 课题,出现deadlock,半天都搞不定,最后
用single thread async做,交差了。

你懂个P.
c*********e
发帖数: 16335
47
c# 直接用task,不用管thread,asp.net自己自动根据threadpool来分配要用几个thread.
奇怪,c#有这么好的功能,怎么出名的大project很少?
k**0
发帖数: 19737
48
太简单了呗
不过用threadpool还是稍微慢一点,不如自己写thread快。

thread.
d*******r
发帖数: 3299
49
Python 不用 multi-threading ...
Python 2 用 tornado, gevent 之类
Python 3 用 async io
c*********e
发帖数: 16335
50
个人感觉python比php在multi-threading方面做得好。
是这样的吗?大虾请confirm.
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)