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 | |