由买买提看人间百态

topics

全部话题 - 话题: pthreads
首页 上页 1 2 3 4 5 6 7 8 (共8页)
i**p
发帖数: 902
1
来自主题: Programming版 - Daemon thread
To make it more clear and less argument, I re-word my post.
In pthread on Linux,
main() {
...
pthread_create(A)
pthread_create(B) // need much more time to run than thread A does
pthread_detach(B) // B is detached
pthread_create(C) // need much more time to run than thread A does
// but neither joined nor detached
...
pthread_join(A) // #1
return // #2
}
My understanding is
1. main() will wait at #1 until thread A is done.
2. o... 阅读全帖
c*********e
发帖数: 16335
2
来自主题: Programming版 - 这年头是不是只有做网站
知道pthread,这东西用的人并不多。php没啥高深的东西在里头,貌似写这个语言的人
没有在multi-threading, concurrency, async这方面下功夫。
Y**G
发帖数: 1089
3
来自主题: Programming版 - gcc编译选项 -lpthread vs -pthread
多谢
z******n
发帖数: 1183
4

Java 也就知道简单的synchronize
C++的貌似多点。可以用pthread,有各种lock
但是现在感觉无锁的transaction更厉害
可以用到database上
今天面了一个小公司,面试官啥都不懂。想要招backend的
我讲了半天multi threading,结果人家根本云里雾里,毫不关心
问个问题也没讲清楚。我回家了才想到原来他想问的是这个
也是醉了。。。。
w****e
发帖数: 1883
5
多线程的context switch overhead早就可以做的非常小了。即使只有一个CPU,除非你
的程序是永远100% CPU不停地算,不然的话很多real world的application大部分时间
都花在等待慢几个数量级的IO上,这种时候多线程当然比单线程效率高多了。
至于C++的多线程就别拿出来说了,简直是尼玛反人类。用了几年pthread, 突然用上了
Java thread,有一种指哪儿打哪儿的感觉,想怎么操纵怎么操作。棘手的难题?看不出
来。我觉得Java最大的贡献之一就是多线程编程在保留了易用性的同时还提供了强大的
功能性。当然,这一切要归功天才的Doug Lea.

thread
W***o
发帖数: 6519
6
来自主题: Programming版 - 怎么练习C++ multi-threading?
把pthread, mutex, synch lock, open mpi 写一遍吧
w***g
发帖数: 5958
7
你这个情况,大并发,是go的核心竞争力。如果这都搞不定,还要go干嘛。如果只是几
千个thread, pthread就够了啊。


:【 在 walkrandom (walkrandom) 的大作中提到: 】
d***a
发帖数: 13752
8
来自主题: Programming版 - 看到python的multiprocessing心中一痛
我同意这个观点。Python搞并行反正是不行,不如用C/Fortran和pthread/MPI/PVM来搞
。Python的一些模块,内部可以用并行来实现。Numpy内部应该是可以用上多核并行。
w***g
发帖数: 5958
9
来自主题: Programming版 - 看到python的multiprocessing心中一痛
就是只能python call c, 反过来限制很大。
我有个torch model, 在c++服务器里用,可以起多线程,每个线程一个lua虚拟机。
python就不行,只能全局一个。多线程task并行,每个task单线程比单task跑多线程要
快好几倍。

:我同意这个观点。Python搞并行反正是不行,不如用C/Fortran和pthread/MPI/PVM来
搞。Python的一些模块,内部可以用并行来实现。Numpy内部应该是可以用上多核并行。
y*j
发帖数: 3139
10
来自主题: Programming版 - 看到python的multiprocessing心中一痛
你这个土法上马,scalibility 是个问题吧?有现成的轮子为什么不用,比如node.js
or twisted python。
具体到TF, 它也有自带的web deployment 。


: 就是只能python call c, 反过来限制很大。

: 我有个torch model, 在c 服务器里用,可以起多线程,每个线程一个
lua虚拟
机。

: python就不行,只能全局一个。多线程task并行,每个task单线程比单
task跑多
线程要

: 快好几倍。

: :我同意这个观点。Python搞并行反正是不行,不如用C/Fortran和
pthread/MPI
/PVM来

: 搞。Python的一些模块,内部可以用并行来实现。Numpy内部应该是可以
用上多
核并行。

: :

z*y
发帖数: 1311
11
thanks.
w***y
发帖数: 5
12
posix standard and solaris specific.
h******a
发帖数: 198
13
来自主题: Unix版 - multithread programming
what compiler flag do u add? try gcc -pthread or -lpthread
what platform are u working?
d***j
发帖数: 25
14
来自主题: Unix版 - multithread programming
i have done it.
Solaris X86 7.0
I set LD_LIBRARY_PATH to include all libs, then pthread works
Thanku
z*y
发帖数: 1311
15
【 以下文字转载自 Programming 讨论区 】
【 原文由 zyy 所发表 】
How can I know that a thread has exited without using
pthread_join?
Thank you.
O*****d
发帖数: 762
16
来自主题: Unix版 - Help needed, about pthread...
Can anyone help me with it?
In my main thread I am creating multiple threads to support multiple clients,
but only the first child-thread created by the main thread runs, all the
other following threads just don't run at all, anyone knows why?
thank you :(
btw, i am working on a multi-client game server, faint
m*******m
发帖数: 182
17
来自主题: Unix版 - Help needed, about pthread...

How do you tell if they are not running?
f*****e
发帖数: 2
18
来自主题: Unix版 - Help needed, about pthread...

I guess the reason is in some Unix platform thread is not
using round-robin scheduling policy by default, and your
first thread never block to give other thread a chance to
run. Try to set scheduling policy as round-robin if it's
not. Good luck!
f******k
发帖数: 26
19
A thread program for Parallel Sorting
#include
#include
#include
#include
struct thread_data{
int index_front;
int index_back;
int *array;
};
void *compare(void *threadarg)
{
int i,j,tmp;
struct thread_data *my_data;
my_data=(struct thread_data *) threadarg;
i=my_data->index_front;
j=my_data->index_back;
if(my_data->array[i]>my_data->array[j]){
tmp=my_data->array[i];
my_data->array[i]=my_data->arra
h****e
发帖数: 2125
20
来自主题: Unix版 - [转载] Pthread Multiprogramming
【 以下文字转载自 Programming 讨论区 】
【 原文由 helpme 所发表 】
Greetings!
I'm trying to generate a stand-alone c program to simulate cache coherence
issue.
I am trying to fork 4 threads, I need to find out the lower bound of the case,
which means the worst case. So I need to make my code to cause as many
cache coherence events as possible, like invalidations, copy back, etc.
CAn any of you give me a hint or provide some reference? Thank you very much
!
b******r
发帖数: 8
21
不知道为什么client在二次read的时候,返回值会是-1,它应该是0才对。
谢谢。
./server&
./client username
>>hello
/*server program
run as ./server &
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define MAXHOSTNAME 32
#define PORT 1550
#define SPACE " "
void *manage_client (void *argp);
/*
ABOUT ME
++++++++
I am a sample server, who handles messages from only one client.
I read com
h**f
发帖数: 149
22
来自主题: Computation版 - 关于Matlab+CUDA问题求教
刚装上CUDA2.0 Toolkit 和 SDK,原来的问题解决了,但又有新问题
Cuda for Matlab 1.1
Matlab R2008A
Linux- Ubuntu 8.04
>> unix('make');
/usr/local/matlab/bin/mex CFLAGS='-fPIC -D_GNU_SOURCE -pthread -fexceptions'
COPTIMFLAGS='-O3 -funroll-loops -msse2' fft2_cuda.c \
-I/usr/local/cuda/include -L/usr/local/cuda/lib -lcufft -Wl,-rpath,/
usr/local/cuda/lib
Warning: You are using gcc version "4.2.3". The earliest gcc version
supported
with mex is "4.0.0". The latest version tested for use with mex is
"4.2.
z**********6
发帖数: 68
z**********6
发帖数: 68
b********p
发帖数: 875
25
来自主题: Physics版 - 为什么很多人这么不待见matlab
呵呵, 计算物理
自从我老从物理转到计算机后, 都不用c了, 全用matlab, 并行也不用mpi了, 有时就为
了装酷用点pthread
我不知道这个问题有什么好争的, 科学计算不一定都需要很大的计算量, 并不是说你用
上几百cpu, 你就是在做科学计算了. 我们要的不是data, 我们要的是understanding.
有人可以吹嘘他每天处理上FB的数据, 可是实际又得到什么呢, 能对自然的认识有多
大帮助呢? 如果没有, 那纯粹是给外界制造熵,污染环境而已.
n****y
发帖数: 106
26
我用c, pthread,多线程 读一个很大(32M)的文件,这个文件都是数据
每个线程对一小部分 sort, 然后再合成一个大文件sort.
问题是,如果文件比较小,无论我多少线程,都可以,是对的
但是如果,用这个很大的文件(32M),如果只用一个或者两个线程的话,会segmentation
error,但是如果线程数>=3, 那么一切ok.
这种情况会是什么原因呢?谢谢
我都free了dynamic allocated memory.
谢谢
l***t
发帖数: 81
27
来自主题: Quant版 - Flextrade online test
I worked at FlexTrade about 2 years ago, I think it is a good company, it is a good start for you to walk in financial industry.
I remember the online test was basically C/C++ to me. Since FlexTrade GUI uses GTK in Linux, if you have experience in GTK, it would be a big plus. Server side programming is useful too, get familiar with socket and pthread. They also have another team in Java and J2EE, which I was not familiar with. But most of jobs are C/C++.
The Indian colleagues were friendly. Do n
h**f
发帖数: 149
28
来自主题: Quant版 - Flextrade online test
Thank you very much, it's really helpful.
Will try to figure out how to give you BAO ZI, if I have any...

is a good start for you to walk in financial industry.
uses GTK in Linux, if you have experience in GTK, it would be a big plus.
Server side programming is useful too, get familiar with socket and pthread.
They also have another team in Java and J2EE, which I was not familiar with
. But most of jobs are C/C++.
annoying. It requires you not joining the client companies within one year
after
k****r
发帖数: 176
29
来自主题: Quant版 - high frequency trading shop面经
记得楼主是物理背景,这个帖子虽然是去年的,也是值得多数求职新人借鉴
其实你没什么经验时,能先找个developer的职位也没什么不好,至少能学到一些 C++
, Pthread, TCP/IP 等在实际领域中才能掌握的技能
x**y
发帖数: 10012
30
我觉得还不够
Intro to algo
art of prog vol1
data structure
thinking in c++
design pattern
pthread tutorial and source code
以上也看上几遍好了
有兴趣最好再研究研究c++ compiler
基本上可以了
m********0
发帖数: 2717
31
来自主题: Quant版 - C++ multithreading and socket
Manning.C++.Concurrency.in.Action.
or Pthread Primer
socket I have no idea
o******s
发帖数: 416
32
来自主题: Quant版 - C++ multithreading and socket
其实pthread不是OOP的,所以用C操纵也一样。
如果从OOP的概念来说的话,boost的lib包装了多线程编程,具有良好的借口,初始化
,lock控制,资源管理等特性。
k**a
发帖数: 121
33
来自主题: Quant版 - C++ multithreading and socket
My two cents. I'm not from a CS background so I might be in a similar
situation with you.
If you want to do multithreading programming in C++, you can look up the
boost Thread library and here's the link.
http://www.boost.org/doc/libs/1_42_0/doc/html/thread.html
I personally feel that it's a lot easier to use the boost library compared
to the POSIX pthread library. And for most purposes this is good enough. Of
course you'll need to know some of the basic concepts in multithreading such
as thread
a****n
发帖数: 1887
34
来自主题: Quant版 - 有没有被面过LINUX问题的?
请复习grep, cat, ps, signal, zombie process, ipc, pthread相关知识点
w*******n
发帖数: 773
35
来自主题: Quant版 - Multiple threads
实际工作中都
一般都用什么library?
Boost?
Pthread?
大牛们回答一下。
q****x
发帖数: 7404
36
除了C++,STL,算法,数据结构,是不是还要懂socket programming,pthread,Linux
kernal programming?
A*******e
发帖数: 2419
37
来自主题: Quant版 - Eladian面试经过 (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: AlphaCode (Alpha), 信区: JobHunting
标 题: Eladian面试经过
发信站: BBS 未名空间站 (Fri Nov 11 23:34:40 2011, 美东)
猎头投的简历。
先是144分钟48题的C++网上考试,然后HR电话,有19个简单技术问题,涉及C++,算法
,数据结构,网络协议,简单统计概念,都顺利过关。
然后工程师电面,依次问了简历,以前的项目,C++,算法,数据结构,网络协议,多
线程,bash。前面没问题,但后面3个都是考知识点,好几个不会,直接答“I don't
know”对方就没兴趣了。45分钟的面试30分钟提前结束,也没让提问。
C++和算法问的都很简单,反而关注bash,pthread api细节,确实不适合。
r****t
发帖数: 10904
38
不同的就只有系统调用和 pthreads, 其他应该没啥不同的。ui 不算了。

Linux下,想请教一下我应该学习些什么,看些什么书,我本身C++很熟练,windows下
有多年经验,但很少涉及Linux。
A**u
发帖数: 2458
39
来自主题: Quant版 - 新人求教c++
太多了
effective c++
more effective c++
四人帮的 design patterns
pthreads多线程
i*****f
发帖数: 578
40
来自主题: _Python版 - can not start thread
i found this artible here.
http://www.velocityreviews.com/forums/t347990-thread-limit-in-python.html
it seems not to be a language thing, since the author did the same thing in
pthread and reached the same limit as in python. he thought it might be an
os imposed limit.
it maybe simply that you are using too much system resources that it can't
support creating more threads. should you try a thread pool instead?
首页 上页 1 2 3 4 5 6 7 8 (共8页)