|
b****n 发帖数: 84 | 2 c++的话用boost::thread::join() |
|
n*********e 发帖数: 86 | 3 thread vs. process(or task can mean entirely different program) |
|
m********l 发帖数: 4394 | 4 i is not thread safe?
这有意义吗?
counter都是0 |
|
x***i 发帖数: 23 | 5 no difficult. you can use atomic varibles and operations that is new
features ( #include ) from the new standard of C++11. it is lock-
free programming for multi-threads. |
|
k******a 发帖数: 2436 | 6 t1.join() will block the calling thread until t1 exits |
|
h*****3 发帖数: 1391 | 7 我朋友有一上来,就上机操作,全是thread的东西。好像是amd还是啥公司的 |
|
t*****e 发帖数: 53 | 8 Implements a thread safe version of hash table. it should support
concurrent reads but protects on write.
Please paste your code. |
|
j*****y 发帖数: 1071 | 9 function A(), B()
Thread #1, #2
#1 call A()
#2 call B()
如何保证 A() 在 B() 前面被 call 阿? |
|
l*********u 发帖数: 19053 | 10 用semaphore
哪位给说说,俺thread用的不多,理解的对不对:
semaphore像个on/off flag,mutex lock/unlock是锁门/开门。 |
|
l*********u 发帖数: 19053 | 11 哪位给说说,俺thread用的不多,理解的对不对:
semaphore像个on/off flag,mutex lock/unlock是锁门/开门。 |
|
s****e 发帖数: 75 | 12 看careercup上实现thread-safe singleton:
class Singleton{
private:
static Lock lock;
...
};
Lock Singleton::lock;
T * Singleton::Instance(){
if(object == 0){
lock.Acquirelock();
if(object == 0) {
object = new T;
}
lock.ReleaseLock();
}
return object;
}
请问可不可以把Instance函数写成这样的?不管三七二十一先锁起来再来判断
T * Singleton::Instance(){
lock.AcquireLock();
if(inst == 0) {
inst = new T;
}
lock.ReleaseLock();
return inst;
}
多谢大家指点。 |
|
G****A 发帖数: 4160 | 13 想申一个position,要求有一点multi-threading的背景知识,不是核心要求。
online link或者在线书都行,谢谢。 |
|
|
w**n 发帖数: 122 | 15 你这个跟我goog到的那个很象。
但是我没看太懂
这个CAS是做什么的呢?
if (NULL == compare_and_swap(&tail->next, NULL, node))
如果tail->next是NULL(就说明没有别的thread来改过),然后就把tail->next置成node
? 是这意思吗? |
|
s********r 发帖数: 403 | 16 基本上是这个意思,
CAS 返回本内存地址的 old value, 如果是 NULL,证明当前thread 操作得手
这个是个 atomic, 没有条件判断的先后
node |
|
p*****3 发帖数: 488 | 17 queue->settail(node);
Race condition here?? When other thread is reading tail?? |
|
|
s*w 发帖数: 729 | 19 我前一阵子刚使劲看过 C++11 里面的 multithreading
对 thread, mutex, lock_guard, condition_variable 比较熟悉, C++11 没
semaphore, 最高深的使用 promise/future, async 来做,还不大会 |
|
n****e 发帖数: 678 | 20 在网上和版上搜了半天,implement一个thread-safe blockingqueue. 大家看看有没有
问题:
import java.utils.LinkedList;
public class BlockingQueue {
private int capactiy;
private LinkedList elements;
public BlockingQueue(int capacity) {
if (capacity <=0 ) {
throw new exception();
}
this.capacity = capacity;
this.elements = new LinkedList ();
}
public synchronized void put(T t) {
while(elements.size() == capacity) {
w... 阅读全帖 |
|
m**p 发帖数: 189 | 21 这个怎么样?
#include
#include
#include
#include
template
class Queue
{
public:
T pop()
{
std::unique_lock mlock(mutex_);
while (queue_.empty())
{
cond_.wait(mlock);
}
auto item = queue_.front();
queue_.pop();
return item;
}
void pop(T& item)
{
std::unique_lock mlock(mutex_);
while (queue_.empty())
{
cond_.wait(mlock);
}
item = queue_.front();
que... 阅读全帖 |
|
w*******e 发帖数: 395 | 22 不懂题目什么意思
这俩thread难道不已经是用semaphore实现的了吗? |
|
|
|
m*********0 发帖数: 46 | 25 2. Call stack上存的是当前正被调度运行的线程调用栈
3. heap是process wide。stack是thread wide, 函数调用结束后会frame会被unwind
give |
|
c**z 发帖数: 669 | 26 被问了两次,一次apple,一次expedia
一个线程是如何和stack 和 heap联系在一起的
如果你创造一个 thread,这是在stack上还是heap上, |
|
w**z 发帖数: 8232 | 27 每个thread 都有一个stack, 一个process 只有一个heap。 local variable
reference 在stack 里。 |
|
w********s 发帖数: 1570 | 28 一个thread有自己的stack,通常是2m
share一个heap,通常情况下。 |
|
g********o 发帖数: 132 | 29 请问
thread和process区别,
parallel和concurrent 区别
谢谢 |
|
z******g 发帖数: 271 | 30 A process is associated with an execution context which includes a virtual
memory space, opened file handles, signals and etc. Whereas forked threads
share those resources.
Concurrency is when things look like they happen at the same time.
Parallelism is when things do happen at the same time. You can think of
parallelism a subset of concurrency. |
|
c**z 发帖数: 669 | 31 In a multithreaded environment, what are two types of methods to protect
memory from being written over
by two threads at the same time?
mutex, 还有什么? |
|
D**C 发帖数: 6754 | 32 我觉得你对许多multi threading的基本知识还不太明白,推荐你看 Java Concurrency
in Practice
versus |
|
|
c********t 发帖数: 5706 | 34 我总结了下面这些。
其实面试中multi-threading coding的题很少,一般是问一下基本概念。我简历上写了
multithreading, 但是很多次onsite,只被问过一次ReadWriteLock。
基本概念就是以下这些
synchronized, lock (ReentrantLock, ReadWriteLock), semaphore, condition,
atomic, mutex,wait, notify, notifyAll, condition.wait, condition.signal
这些概念最好都看看例子。
其次coding 题,准备好这三道题:ReadWriteLock, BlockingQueue, H2O |
|
R********r 发帖数: 3415 | 35 no, not necessarily
IPS size means OD, but "1/2 In. thread" may be ID, and, for the tubing using
in home water/sewer system, it is using ID, which confused me when I went
to HD to pick up the hose for my sink. |
|
|
|
p****u 发帖数: 2596 | 38 800 Thread 是不是足够好拉?还看到有1200的。也不知道有多大区别。amazon上
看到的 |
|
|
|
m*******p 发帖数: 1978 | 41 search for "thread clevis yoke" |
|
|
y*****a 发帖数: 580 | 43 1. bt/aor:
http://www.fatwallet.com/t/52/632935/
2. apr for saving/chcking:
http://www.fatwallet.com/t/52/437553/
almost answer all the questions, except cc application bonus. (there is a
thread, but not good.)
From my experience:
(1) BOA mma is good, if you have chking as well with boa, and careful enough.
(2) citi is best in bt, because perks in application, bt, credit protector
(3) boa is the next in bt, because of perks of application, and bt
(4) amex is the best to be the denominator
(5) ch |
|
m**********n 发帖数: 27535 | 44 【 以下文字转载自 Military 讨论区 】
发信人: ddyourself (nah), 信区: Military
标 题: Re: 家里有男孩的应该好好读一下reddit上的这个thread
发信站: BBS 未名空间站 (Thu Jan 19 23:08:19 2017, 美东)
看到不看到有个蛋用。难道老中们自己不知道被歧视?ABC小孩都是自己抱团取暖难道
老中父母不知道? |
|
n*******2 发帖数: 603 | 45 【 以下文字转载自 Living 讨论区 】
发信人: nikki0202 (nikki), 信区: Living
标 题: bed sheets 多少thread count好?
发信站: BBS 未名空间站 (Thu Jun 24 20:37:34 2010, 美东)
越高越好么?
1000以上? |
|
s*****r 发帖数: 1745 | 46 Wavelets shall do suck type of thread. |
|
s*****r 发帖数: 1745 | 47 what I meants is you shall do a specific journal thread so we froggies could
learn better from you. |
|
|
w***e 发帖数: 452 | 49 马甲逃不过偶的火眼金睛◎◎
你要去纽约么?
shapes threading salon
1030 39th street (6th avenue)
2nd floor
212-703-9311
是一群印度大妈开的,用线刮眉毛的那种,如果眉毛浓的话弄出来很pp。 |
|
j**4 发帖数: 10425 | 50 the thread is sooo long. u get a bunch of women, and they can talk nonstop
and repetitive |
|