Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.arch.embedded > #24384
| From | Mel Wilson <mwilson@the-wire.com> |
|---|---|
| Newsgroups | comp.arch.embedded |
| Subject | Re: Embedded Linux: share data among different processes |
| Date | 2016-06-26 15:25 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <nkos5n$90j$1@dont-email.me> (permalink) |
| References | <nkgihf$dn7$1@dont-email.me> <nkgp8u$49u$1@dont-email.me> <nkj5vt$nea$1@dont-email.me> |
On Fri, 24 Jun 2016 13:36:36 +0200, pozz wrote: > Il 23/06/2016 15:47, Mel Wilson ha scritto: >> On Thu, 23 Jun 2016 13:52:21 +0200, pozz wrote: >> [ ... ] >>> I think a good approach will be to develop a simple application, the >>> poller, that communicates with the electronic device and implements >>> the RS485 protocol. The poller continuously acquires the current >>> status/settings of the device and store them in some "shared" way. >>> >>> The graphic application (QT-based) and the web server (CGI) should >>> access to the data retrieved by the poller. >>> >>> What is the best method to share the data generated by an application >>> (the poller) among two or more applications (QT and CGI)? >>> In this scenario, I think it's important to lock the "shared data" >>> before accessing them (reading or writing), in order to avoid reading >>> incoerent data. Indeed, if the poller writes the data at the same time >>> (Linux OS is multi-tasking) the web server reads them, they could be >>> incoerent. >>> >>> I'm thinking to use SQLite database to store the data. The poller >>> writes the database, HTTP and QT reads from it. It seems SQLite will >>> take care the multi-thread/multi-process scenario. >>> >>> Any suggestions? >> >> I did that with System V IPC, using message passing for control > > Yes, another problem to solve is the other way: QT and HTTP server could > send some control commands to the electronic device (switch on, switch > off, change this...). > > >> and shared memory blocks for info common to all the processes. I was >> able to avoid any locking using the one-writer/many-readers trick. > > It is exactly what I will have: one writer (the poller that will > continuously fetch updated data from the device) and some readers (at > least, HTTP server and QT graphic libraries). > Doesn't it needed a syncronization mechanism (semaphore) in this > scenario, using shared memory to share common data? Just in case I should mention -- my system didn't contain just one Big Writer. Rather, different processes were responsible for different sections of the application, and each of those processes was the sole writer for the shared data concerned with its section. In this system, the Linux did the "cerebral" operations, and it communicated over a serial link with a "hind-brain" or "spinal column" run by a PIC32. There was a polling process that communicated with the PIC32 and dispatched input via IPC messages to the responsible processes. Some processes did quasi-real-time operations and, along with the polling process, ran at negative niceness for fastest response. Others could be given a twentieth of a second or so to respond and ran as normal processes. But each task was the sole writer of shared data that it "owned" and ordered any other changes through IPC messages. There were a bunch of Apache/CGI processes concerned with displaying diagnostic info remotely, and they never wrote shared data. Some other CGI that implemented remote testing and control did their thing by sending IPC messages to the responsible processes. Mel.
Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-23 13:52 +0200
Re: Embedded Linux: share data among different processes Jack <jack4747@gmail.com> - 2016-06-23 05:30 -0700
Re: Embedded Linux: share data among different processes Reinhardt Behm <rbehm@hushmail.com> - 2016-06-23 21:05 +0800
Re: Embedded Linux: share data among different processes Clifford Heath <no.spam@please.net> - 2016-06-24 09:45 +1000
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-23 17:19 -0700
Re: Embedded Linux: share data among different processes Clifford Heath <no.spam@please.net> - 2016-06-24 13:25 +1000
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-23 21:27 -0700
Re: Embedded Linux: share data among different processes Clifford Heath <no.spam@please.net> - 2016-06-24 14:40 +1000
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-23 22:20 -0700
Re: Embedded Linux: share data among different processes Clifford Heath <no.spam@please.net> - 2016-06-24 17:19 +1000
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-24 01:01 -0700
Re: Embedded Linux: share data among different processes Dimiter_Popoff <dp@tgi-sci.com> - 2016-06-24 16:38 +0300
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-24 11:13 -0700
Re: Embedded Linux: share data among different processes Reinhardt Behm <rbehm@hushmail.com> - 2016-06-24 12:39 +0800
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-24 01:53 -0700
Re: Embedded Linux: share data among different processes Reinhardt Behm <rbehm@hushmail.com> - 2016-06-26 09:34 +0800
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-26 00:30 -0700
Re: Embedded Linux: share data among different processes Les Cargill <lcargill99@comcast.com> - 2016-06-24 15:18 -0500
Re: Embedded Linux: share data among different processes Mel Wilson <mwilson@the-wire.com> - 2016-06-23 13:47 +0000
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-24 13:36 +0200
Re: Embedded Linux: share data among different processes Mel Wilson <mwilson@the-wire.com> - 2016-06-26 15:25 +0000
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-23 12:11 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-24 13:40 +0200
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-24 10:44 -0700
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-23 12:31 -0700
Re: Embedded Linux: share data among different processes George Neuner <gneuner2@comcast.net> - 2016-06-23 17:27 -0400
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-24 13:43 +0200
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-24 10:48 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-27 14:46 +0200
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-27 13:41 -0700
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-24 13:52 -0700
Re: Embedded Linux: share data among different processes Les Cargill <lcargill99@comcast.com> - 2016-06-24 16:42 -0500
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-27 16:00 +0200
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-27 20:06 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-28 08:41 +0200
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-28 00:27 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-28 12:50 +0200
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-28 10:01 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-29 13:10 +0200
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-29 10:47 -0700
Re: Embedded Linux: share data among different processes edward.ming.lee@gmail.com - 2016-06-29 14:01 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-30 15:11 +0200
Re: Embedded Linux: share data among different processes edward.ming.lee@gmail.com - 2016-06-30 08:19 -0700
Re: Embedded Linux: share data among different processes Les Cargill <lcargill99@comcast.com> - 2016-06-23 14:53 -0500
Re: Embedded Linux: share data among different processes Paul Rubin <no.email@nospam.invalid> - 2016-06-23 13:05 -0700
Re: Embedded Linux: share data among different processes pozz <pozzugno@gmail.com> - 2016-06-24 13:54 +0200
Re: Embedded Linux: share data among different processes Les Cargill <lcargill99@comcast.com> - 2016-06-24 14:27 -0500
Re: Embedded Linux: share data among different processes Les Cargill <lcargill99@comcast.com> - 2016-06-24 16:39 -0500
Re: Embedded Linux: share data among different processes Don Y <blockedofcourse@foo.invalid> - 2016-06-24 15:11 -0700
csiph-web