【 以下文字转载自 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 !