boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 问几个multithreading的问题
相关主题
面试题: Multithreads 之间怎么通信?
问道OS的面试题。
问道多线程的简单题目
关于multithread programming大家看什么书
BB面试一题
爸说,没想到你就当了个程序员 (转载)
生物PHD 转行找CS, 报Offer和罗嗦的面经
问几个关于G M A F面试的general问题
递交PERM之前打广告的工作描述有啥要注意的吗
有几个东西我一直想学,但是没时间
相关话题的讨论汇总
话题: reentrant话题: 线程话题: thread话题: 进程话题: lock
进入JobHunting版参与讨论
1 (共1页)
s*****r
发帖数: 773
1
1 如何detect dead lock, avoid dead lock 和break dead lock
how to make sure there is no dead lock?
2 mutex 和 binary semaphore有什么区别
3 线程之间如何通讯?
谢谢了
t******e
发帖数: 1293
2

Modern Operating System里面第四章有讲deadlock的,四个条件
hold and wait, mutual exclusion, cycle chain, no preemptive...
用banker's algorithm去avoid
如何break,那就是直接把四个条件之一破坏掉,具体来说,可以
让root来kill掉一些导致死锁的进程。
http://stackoverflow.com/questions/62814/difference-between-binary-semaphore-and-mutex
IPC: file, socket, pipe, share memory, message, ...

【在 s*****r 的大作中提到】
: 1 如何detect dead lock, avoid dead lock 和break dead lock
: how to make sure there is no dead lock?
: 2 mutex 和 binary semaphore有什么区别
: 3 线程之间如何通讯?
: 谢谢了

m****n
发帖数: 589
3
detect:
Approximately:
1,lot of jobs in computer,but ready queue is small
2,some blocked job have been blocked for a long time
to know definitly:
eaxm RAG

【在 s*****r 的大作中提到】
: 1 如何detect dead lock, avoid dead lock 和break dead lock
: how to make sure there is no dead lock?
: 2 mutex 和 binary semaphore有什么区别
: 3 线程之间如何通讯?
: 谢谢了

s*****r
发帖数: 773
4
最后一个是进程通信吧, 我问的是线程.

【在 t******e 的大作中提到】
:
: Modern Operating System里面第四章有讲deadlock的,四个条件
: hold and wait, mutual exclusion, cycle chain, no preemptive...
: 用banker's algorithm去avoid
: 如何break,那就是直接把四个条件之一破坏掉,具体来说,可以
: 让root来kill掉一些导致死锁的进程。
: http://stackoverflow.com/questions/62814/difference-between-binary-semaphore-and-mutex
: IPC: file, socket, pipe, share memory, message, ...

m****n
发帖数: 589
5
线程之间
shared variable?

【在 s*****r 的大作中提到】
: 1 如何detect dead lock, avoid dead lock 和break dead lock
: how to make sure there is no dead lock?
: 2 mutex 和 binary semaphore有什么区别
: 3 线程之间如何通讯?
: 谢谢了

f****4
发帖数: 1359
6
lz要面bloomberg?
进程通信可以用在不同进程的线程
同进程线程也可以用,就是效率不好
同进程线程可以直接share memory
可我不知道同进程线程share memory有啥库支持不,有没有啥系统库提供锁,信号量之
类的东西
s*****r
发帖数: 773
7
版上bloomberg的面经都没有问这些问题, 反而以前没有提过的算法出现很多

【在 f****4 的大作中提到】
: lz要面bloomberg?
: 进程通信可以用在不同进程的线程
: 同进程线程也可以用,就是效率不好
: 同进程线程可以直接share memory
: 可我不知道同进程线程share memory有啥库支持不,有没有啥系统库提供锁,信号量之
: 类的东西

l******o
发帖数: 144
8
统一进程还需要shared memory么?线程通信不就是锁、信号量这些同步原语么?用
pipe之类的东西也行吧。

lz要面bloomberg?
进程通信可以用在不同进程的线程
同进程线程也可以用,就是效率不好
同进程线程可以直接share memory
可我不知道同进程线程share memory有啥库支持不,有没有啥系统库提供锁,信号量之
类的东西

【在 f****4 的大作中提到】
: lz要面bloomberg?
: 进程通信可以用在不同进程的线程
: 同进程线程也可以用,就是效率不好
: 同进程线程可以直接share memory
: 可我不知道同进程线程share memory有啥库支持不,有没有啥系统库提供锁,信号量之
: 类的东西

l*******y
发帖数: 1498
9
关于1,俺的总结。
There are four necessary conditions for a deadlock to occur:
• Mutual exclusion condition: a resource that cannot be used by more
than one process at a time
• Hold and wait condition: processes already holding resources may
request new resources
• No preemption condition: No resource can be forcibly removed from a
process holding it, resources can be released only by the explicit action of
the process
• Circular wait condition: two or more processes form a circu
s*******e
发帖数: 27
10
There are some details related to multithreaded issues.
If each thread has its own signal handling procedure, although the process
does send the signal to the correct thread, there might be some race
conditions in handling the signal. One solution is to dedicate one thread
just to handle the signals for all threads and decides which thread to call
(wait up).
The other issue is that some functions like string token function, strtok,
uses a static variable to implement its recursive calls. So if m

【在 l******o 的大作中提到】
: 统一进程还需要shared memory么?线程通信不就是锁、信号量这些同步原语么?用
: pipe之类的东西也行吧。
:
: lz要面bloomberg?
: 进程通信可以用在不同进程的线程
: 同进程线程也可以用,就是效率不好
: 同进程线程可以直接share memory
: 可我不知道同进程线程share memory有啥库支持不,有没有啥系统库提供锁,信号量之
: 类的东西

g********d
发帖数: 43
11

call
accessed
"If it behaves correctly, it is called thread safe, or reentrant"
This is not correct. It is called thread safe, not reentrant. Reentrant is
more restrict.
量之

【在 s*******e 的大作中提到】
: There are some details related to multithreaded issues.
: If each thread has its own signal handling procedure, although the process
: does send the signal to the correct thread, there might be some race
: conditions in handling the signal. One solution is to dedicate one thread
: just to handle the signals for all threads and decides which thread to call
: (wait up).
: The other issue is that some functions like string token function, strtok,
: uses a static variable to implement its recursive calls. So if m

s*******e
发帖数: 27
12
Thank you for pointing it out.
Before I made the my previous post, I actually looked up in the Advenced
Programming ... book ( i am self learning Linux now) and I looked at it
again,
it says on page 402,
'If a function is reentrant with respect to multiple threads, we say that it
is thread safe. This doesn't tell us, however, whether the function is
reentrant with repsect to signal handlers, we say that a function that is
safe to be reentered from an asynchronous singal handler is async-signal
s

【在 g********d 的大作中提到】
:
: call
: accessed
: "If it behaves correctly, it is called thread safe, or reentrant"
: This is not correct. It is called thread safe, not reentrant. Reentrant is
: more restrict.
: 量之

c******f
发帖数: 2144
13
多线程 mark
1 (共1页)
进入JobHunting版参与讨论
相关主题
有几个东西我一直想学,但是没时间
问一下Multithreaded Programming有啥经典书籍可以推荐?
找工作需要:推荐一本multithreaded programming的书吧
VMware的面试题
unix network programming (Stevens) book V1 (2ed, 3ed) code cannot run on Linux
FLAG面试考OOD或者multithreading吗?
MS Azure组面试
面试data scientist职位,被问java multithread programming
上周Onsite题目及不爽之事
面经+一点个人体会
相关话题的讨论汇总
话题: reentrant话题: 线程话题: thread话题: 进程话题: lock