-   Linux - Newbie (
-   -   Best approach for producer consumer application (

ghhbak 08-21-2018 11:56 PM

Best approach for producer consumer application
I need help on a problem. The requirement is to transfer one of the DHCP option parameters from DHCP client (udhcp from busybox) to a separate and independent application running on the same device (which I'll call app2), which will consume this information. After examining the syslogs, I noticed app2 runs earlier than the dhcp client, so the information is not able to be transmitted in time. I tried using shared memory approach to transmit the information, it works. But I have to restart app2 in order for it to receive the information and successfully consume it. This may not be the optimal solution. My goal is to identify the best design choice.

AwesomeMachine 08-22-2018 12:54 AM

What kind of device is this? Does it use systemd?

rtmistler 08-22-2018 06:37 AM

This depends a lot on the need for the boot up sequencing to stay the way it is, as well as whether or not this additional app is something you're writing.

If you can alter the boot up sequencing, then consider that approach and if it solves your issue, then great.

If the boot up sequence must stay the way it is, but you are coding this app, then you can code it in such as way that it waits until the information is available.

Really you have to expand a lot more on your descriptions.

Every case is different. There are a number of manners to conduct IPC in Linux, and shared memory is one of them. Meanwhile I'm wondering how the udhcpd from Busybox would be employing SHMEM, unless you'e modifying that code too.

ghhbak 08-22-2018 11:31 PM

This device is a target board running openwrt, doesn't have systemd.

I had modifed the udhcpd to use SHMEM successfully. I have now tried the approach of changing the boot sequence order by editing the files under /etc/rc.d. The results look good. This approach resolves my issue. Thanks.

All times are GMT -5. The time now is 04:49 PM.