forker | launching processes from Java in the most efficient way
kandi X-RAY | forker Summary
kandi X-RAY | forker Summary
Forker is a set of utilities and helpers for executing operating system commands from Java. It can be used in a number of ways :-.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Entry point to the user agent
- Runs a command on the system
- Read a named pipe
- Get parameter string from command args
- Starts the process
- Called when the process exits
- Handle the exit code
- Wait for the process exit
- Wait for the launch
- Gets output stream
- Creates a new process
- Registers the process
- Spawn a new thread with the specified arguments
- Initialize the internal buffers
- Returns an OutputStream
- Returns the environment block as a byte array
- Initialize the buffers
- Register a process
- Create named pipes
- Returns input stream
- Create posix pipes
- Entry point for the application
- Entry point to the application
- Add a pipe to the epoll pool
- Wait for the kevent
- Register a new process
forker Key Features
forker Examples and Code Snippets
Community Discussions
Trending Discussions on forker
QUESTION
I currently use TraCIScenarioManagerForker
to spawn SUMO for each simulation, the "forker" method. However, the official VEINS documentation recommends launching the SUMO daemon separately using the veins-launchd
script and then run simulations, the "launchd" method.
Using the forker method makes running simulations just a one command job since SUMO is killed when simulation ends. However, with the launchd method, one has to take care of setting up the SUMO daemon and killing it when simulation ends.
What are the advantages and disadvantages of each method? I'm trying to understand the recommended best practices when using VEINS.
...ANSWER
Answered 2021-Mar-30 at 14:51Indeed, Veins 5.1 provides three (four, if you count an experimental one) ways of connecting a running OMNeT++ to SUMO:
assuming SUMO is already running and connecting there directly (TraCIScenarioManager)
running SUMO directly from the process - on Linux: as a fork, on Windows: as a process in the same context (TraCIScenarioManagerForker)
connecting to a Proxy (veins_launchd) that launches an isolated instance of SUMO for every client that connects to it (TraCIScenarioManagerLaunchd)
if you are feeling adventurous, the veins_libsumo fork of Veins offers a fourth option: including the SUMO engine directly in your OMNeT++ simulation and using it via method calls (instead of remote procedure calls via a network socket). Contrast, for example, TraCI based code vs. libsumo based code. This can be orders of magnitude faster with none of the drawbacks discussed below. At the time of writing (Mar 2021) this fork is just a proof of concept, though.
Each of these has unique benefits and drawbacks:
is the most flexible: you can connect to a long-running instance of SUMO which is only rolled backwards/forwards in time through the use of snapshots, connect multiple clients to a single instance, etc but
- requires you to manually take care of running exactly as many instances of SUMO as you need at exactly the time when you need them
is very convenient, but
- requires the simulation (as opposed to the person running the simulation) to "know" how to launch SUMO - so a simulation that works on one machine won't work on another because SUMO might be installed in a different path there etc.
- launches SUMO in the directory of the simulation, so file output from multiple SUMO instances overwrites each other and file output is stored in the directory storing the simulation (which might be a slow or write protected disk, etc.)
- results in both SUMO and OMNeT++ writing console output into what is potentially the same console window, requiring experience in telling one from the other when debugging crashes (and things get even more messy if one wants to debug SUMO)
does not suffer from any of these problems, but
- requires the user to remember starting the proxy before starting the simulations
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install forker
You can use forker like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the forker component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page