How can I map moving objects using program using signal identifiers on a longitude/latitude? - modelmapper

I need to achieve an network based mapping program using signal identifiers to map location of moving objects. Map of physical long/lat.

Related

how to do synchronization between two linux modules?

I have a core driver implemented in linux(driver/mfd/. This core driver has two mfd cells each is going to touch the portion of the mapped memory. These mfd cells are separate modules ( drivers/char/ and drivers/char/). But before accessing their portion of the memory , there is a shared register which we need to touch (mapped) . This has to be done in proper sequence some sort of synchronization is required. Is there anyway to achieve this ?

How to block access to a particular memory location is accessed

I am working on a problem statement in which I have to enforce processes to not share a particular variable in the process over the network.
I am willing to learn and develop in kernel mode as well.
I will give an example.
There is a process P which is generating data. This data is stored in the process in a variable v.
Then there is my module M. Now I want M (Which can be a kernel module) to not let P share this data over network.
How should I approach this problem?

How to use shared memory in windows

Consider, I have two Windows stand alone GUI applications. Whenever I press a command button in the first GUI, other GUI should capture the status of the button and should display ON or OFF in the text box in it. How can I do this with the use of shared memory.
PS: I am using VC++ 2008.
Take a look: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366551%28v=vs.85%29.aspx
In process 1 :
CreateFileMapping() : It will create the Shared Memory Block, with the name provided in last parameter, if it is not already present and returns back a handle (you may call it a pointer), if successful.
MapViewOfFile() : It maps (includes) this shared block in the process address space and returns a handle (again u can say a pointer).
With this pointer returned by MapViewOfFile() only you can access that shared block.
In process 2 :
OpenFileMapping() : If the shared memory block is successfully created by CreateFileMapping(), you can use it with the same name (name used to create the shared memory block).
UnmapViewOfFile() : It will unmap (you can remove the shared memory block from that process address space). When you are done using the shared memory (i.e. access, modification etc) call this function .
Closehandle() : finally to detach the shared memory block from process , call this with argument,handle returned by OpenFileMapping() or CreateFileMapping().

Application counters in Linux? (and OSX?)

I'm trying to figure out if there is a library that gives me something near the equivalent of Windows custom performance counters (described here http://geekswithblogs.net/.NETonMyMind/archive/2006/08/20/88549.aspx)
Basically, I'm looking for something that can be used to both track global counters within an application, and (ideally) something that presents that information via a well-defined interface to other applications/users. These are application statistics; stuff like memory and disk can be captured in other ways, but I'm looking to expose throughput/transactions/"widgets" handled during the lifetime of my application.
I've seen this question:
Concept of "Performance Counters" in Linux/Unix
and this one
Registry level counters in Linux accessible from Java
but neither is quite what I'm looking for. I don't want to write a static file (this is dynamic information after all; I should be able to get at it even if the disk is full etc.), and would rather avoid a homegrown set of code if at all possible. Ideally, at least on Linux, this data would (I think) be surfaced through /proc in some manner, though it's not clear to me if that can be done from userland (this is less important, as long as it is surfaced in some way to clients.)
But back to the crux of the question: is there any built-in or suitable 3rd-party library that gives me custom global (thread-safe, performant) counters suitable for application metrics that I can use on Linux and other *NIXy operating systems? (And can be interfaced from C/C++?)
In addition to #user964970 comment/solution, I suggest making it OS agnostic.
Use an OS agnostic API, like ACE or BOOST, to create your own library, supplying a named-semaphore write-protected-counter, placed inside a named-shared-memory segment.
This should be your library's API :
long * createCounter(const char * name); // Create a counter
// Will create a named semaphore and a named
// shared memory segment, holding the counter
// value. Will return pointer to counter
long * getCounter(const char * name); // Get existing counter pointer
// in the calling process' address space
long incCounter(const char * name); // increment existing counter

Linux Shared Memory

The function which creates shared memory in *inux programming takes a key as one of its parameters..
What is the meaning of this key? And How can I use it?
Edit:
Not shared memory id
It's just a System V IPC (inter-process communications) key so different processes can create or attach to the same block of shared memory. The key is typically created with ftok() which turns a fully-specified filename and project ID into a usable key.
Since an application can generally use the same filename in all its different processes (the filename is often a configuration file associated with your application), each different process gets the same key (or, more likely if your using the project ID to specify multiple shared memory segments, the same set of keys).
For example, we once had an application that used a configuration file processed by our lex/yacc code so we just used that pathname and one project ID for each different shared memory block (there were three or four depending on the purpose of the process in question). This actually made a lot of sense since it was the parsed and evaluated data from that configuration file that was stored in the shared memory blocks.
Since no other application on the system should be using our configuration file for making a key, there was no conflict. The key itself is not limited to shared memory, it could be used for semaphores and other IPC mechanisms as well.
The posix shared memory functions (shm_open and friends) have a more user-friendly interface in that they can accept a unique filename which must be used by the applications to open the same shared memory block.
Having said that, it is generally also feasible to open a file in /dev/shm under Linux and then mmap it with MAP_SHARED which achieves much the same.

Resources