% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/memory_utils.R
\name{get_recommended_threads}
\alias{get_recommended_threads}
\title{Get recommended number of threads for parallel operations}
\usage{
get_recommended_threads(use_fraction = 0.8)
}
\arguments{
\item{use_fraction}{Numeric. Fraction of available cores to use (default 0.8).
Using all cores (1.0) may overload the system.}
}
\value{
Integer with recommended number of threads (minimum 1)
}
\description{
Returns a recommended number of threads for parallel operations,
based on available CPU cores and system load.
}
\details{
This function uses the C++ implementation to detect CPU cores and
returns a conservative estimate leaving room for the OS and other processes.

\strong{Default behavior} (use_fraction = 0.8):
\itemize{
\item 4 cores → 3 threads
\item 8 cores → 6 threads
\item 16 cores → 13 threads
}
}
\examples{
\donttest{
# Get recommended threads
threads <- get_recommended_threads()

# Use for OpenMP operations
options(BigDataStatMeth.threads = threads)

# More aggressive (use 90\% of cores)
threads <- get_recommended_threads(use_fraction = 0.9)
}

}
\seealso{
\code{\link{get_cpu_cores}}
}
