w*s 发帖数: 7227 | 1 【 以下文字转载自 Programming 讨论区 】
发信人: wds (中原一点红:心开运就通,运通福就来), 信区: Programming
标 题: Re: a dummy OS question
发信站: BBS 未名空间站 (Sat Apr 19 10:27:23 2014, 美东)
各位大牛,容我尽力描述一下,请大家畅所欲言,非常感谢。
linux system, two rs485 ports, ~50 devices attached on these 2 ports.
~100 processes in the system from linux itself. 4 core arm.
in many sense it's like a linux desktop with our app running.
could get very busy, e.g. like the moment you open office in linux.
1. original design was like this, also tested well enough,
The main app has 10 threads on its own.
For each rs485, main process spawns off a process to monitoring all
devices on this
port. (Since this is serial bus, it's basically a for loop doing tx/rx to
each device 1 by 1. We don't have locks inside the two rs485 processes.)
so total 3 processes.
Each rs485 process doesn't talk with each other, they only talk with main
process through named pipe.
2. now after all the linux architects left, ppl asks me to change to use
threads. So only 1 process, 12 threads.
With that rs485 thread crashes without clue, no core file.
Ppl looked at code again and again and still clueless.
They don't want to go back to process, since
1. 3 processes with same name is confusing.
2. we don't know how to attach gdb to the process to debug. If only 1
process, it's easier.
3. politics
If you guys can help me with these
Q1: i think we can change process name, right ?
or create pid files for each process, i'm new to these.
Q2: if you have 3 processes with same name, how hard is it for debugging ?
Especially i want to debug the child process,
how to do this in gdb ?
can i set breakpoint in the code saying this is child, after the fork() ?
Q3: why a thread can die without core file, while main process/thread can
always generate code file ?
Q4:what can you gain if you use threads instead of processes in this case ?
(in my opinion, only gains trouble.)
Q5: named pipe through threads or processes, performance big difference ?
Many many thanks ! | G*****h 发帖数: 33134 | 2 你现在就用了一个process
gdb 下跑,看看哪儿crash了
你这个负载的确多个process 没啥优势
【在 w*s 的大作中提到】 : 【 以下文字转载自 Programming 讨论区 】 : 发信人: wds (中原一点红:心开运就通,运通福就来), 信区: Programming : 标 题: Re: a dummy OS question : 发信站: BBS 未名空间站 (Sat Apr 19 10:27:23 2014, 美东) : 各位大牛,容我尽力描述一下,请大家畅所欲言,非常感谢。 : linux system, two rs485 ports, ~50 devices attached on these 2 ports. : ~100 processes in the system from linux itself. 4 core arm. : in many sense it's like a linux desktop with our app running. : could get very busy, e.g. like the moment you open office in linux. : 1. original design was like this, also tested well enough,
| w*s 发帖数: 7227 | 3 要很大的系统很久才会发生,QA也在用这系统,deadline近了,用gdb实在是万不得已。
我的意见是有data sharing用thread才有意义。
现在没有什么data sharing, 用thread可能会造成thread之间data corruption,在这
情况下用thread比process有什么好处吗?
而且希望最底层的rs485信息能够尽快传送,有点像realtime,那么2个rs485 process
难道不比一个process多个thread竞争强吗?
请指教。
【在 G*****h 的大作中提到】 : 你现在就用了一个process : gdb 下跑,看看哪儿crash了 : 你这个负载的确多个process 没啥优势
|
|