Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.0%) to scientific vocabulary
Repository
Mutexes, Semaphores, and Message Queues for R
Basic Info
- Host: GitHub
- Owner: cmmr
- License: other
- Language: R
- Default Branch: master
- Homepage: https://cmmr.github.io/interprocess/
- Size: 8.33 MB
Statistics
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
- Releases: 3
Metadata Files
README.md
interprocess 
The goal of interprocess is to synchronize concurrent R processes.
Allows R to access low-level operating system mechanisms for performing atomic operations on shared data structures. Mutexes provide shared and exclusive locks. Semaphores act as counters. Message queues move text strings from one process to another. All these interprocess communication (IPC) tools can optionally block with or without a timeout.
Works cross-platform, including Windows, MacOS, and Linux, and can be used to synchronize a mixture of R sessions and other types of processes.
Implemented using the Boost C++ library.
Installation
``` r
Install the latest stable version from CRAN:
install.packages("interprocess")
Or the development version from GitHub:
install.packages("pak") pak::pak("cmmr/interprocess") ```
Usage
Mutexes, semaphores, and message queues are managed by the operating system. Any process that knows the resource's name can access it. Therefore, sharing the resource name (a short text string) amongst cooperating processes enables communication and synchronization.
These names can be any alphanumeric string that starts with a letter and is no
longer than 250 characters. The mutex(), semaphore(), and msg_queue()
functions will default to generating a unique identifier, or you can provide a
custom or pre-existing one with the name parameter. If the resource is
associated with a specific file or directory, the file parameter can be used
to derive a name from normalizing and hashing that path.
Setting cleanup = TRUE will automatically remove the resource when the R
session exits. Otherwise, the resource will persist until $remove() is called
or the operating system is restarted.
Mutexes
An exclusive advisory lock is acquired by default. For a shared lock, use
shared = TRUE. Set file = <path> to use a filepath hash for the name.
``` r tmp <- tempfile() mut <- interprocess::mutex(file = tmp)
mut$name
> [1] "oThd9KRpHb0"
with(mut, writeLines('Important Data', tmp))
with(mut, shared = TRUE, readLines(tmp))
> [1] "Important Data"
mut$remove() unlink(tmp) ```
Semaphores
The semaphore's value can be incremented with $post() and decremented with
$wait(). The initial value can also be set in the constructor.
``` r sem <- interprocess::semaphore('mySemaphore', value = 1)
sem$name
> [1] "mySemaphore"
sem$post()
sem$wait(timeout_ms = 0)
> [1] TRUE
sem$wait(timeout_ms = 0)
> [1] TRUE
sem$wait(timeout_ms = 0)
> [1] FALSE
sem$remove() ```
Message Queues
The constructor's max_count and max_nchar parameters determine how much
memory is allocated for the message queue.
``` r mq <- interprocess::msgqueue(maxcount = 2, max_nchar = 5)
mq$name
> [1] "Ae2udeRLWcb"
mq$send('Hello') mq$send('Hi', priority = 1)
mq$receive(timeout_ms = 0)
> [1] "Hi"
mq$receive(timeout_ms = 0)
> [1] "Hello"
mq$receive(timeout_ms = 0)
> [1] NULL
mq$remove() ```
Owner
- Name: Alkek Center for Metagenomics and Microbiome Research
- Login: cmmr
- Kind: organization
- Location: Baylor College of Medicine, Houston TX
- Website: https://www.bcm.edu/departments/molecular-virology-and-microbiology/cmmr/
- Repositories: 3
- Profile: https://github.com/cmmr
CMMR researchers develop molecular and informatic tools to advance clinical microbiome research.
GitHub Events
Total
- Create event: 5
- Release event: 3
- Issues event: 7
- Watch event: 3
- Push event: 54
Last Year
- Create event: 5
- Release event: 3
- Issues event: 7
- Watch event: 3
- Push event: 54
Packages
- Total packages: 1
-
Total downloads:
- cran 534 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 4
- Total maintainers: 1
cran.r-project.org: interprocess
Mutexes, Semaphores, and Message Queues
- Homepage: https://cmmr.github.io/interprocess/
- Documentation: http://cran.r-project.org/web/packages/interprocess/interprocess.pdf
- License: MIT + file LICENSE
-
Latest release: 1.3.0
published about 1 year ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v4 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- JamesIves/github-pages-deploy-action v4.5.0 composite
- actions/checkout v4 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- actions/checkout v4 composite
- actions/upload-artifact v4 composite
- codecov/codecov-action v4 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
- Rcpp * imports
- callr * suggests
- rmarkdown * suggests
- testthat * suggests