What are the thread limitations when working on Linux compared to processes for network/IO-bound apps?
Tag : linux , By : user179190
Date : March 29 2020, 07:55 AM
will help you I've heard that under linux on multicore server it would be impossible to reach top performance when you have just 1 process but multiple threads because Linux have some limitations on the IO, so that 1 process with 8 threads on 8-core server might be slower than 8 processes. , Drawbacks of Threads Threads:
|
Share state between processes in different network namespaces
Date : March 29 2020, 07:55 AM
Does that help 32 processes in 32 network name spaces is already pretty significant, so I guess you want something serious and that can scale. Then I'd suggest you use a modern and scalable Linux IPC system.
|
Is there a programmatic way in C to determine the number of processes ever used in a group of processes under Linux?
Date : March 29 2020, 07:55 AM
it should still fix some issue To enforce the RLIMIT_NPROC limit, linux kernel reads &p->real_cred->user->processes field in copy_process function (on fork() for example) http://lxr.free-electrons.com/source/kernel/fork.c?v=4.8#L1371 1371 if (atomic_read(&p->real_cred->user->processes) >=
1372 task_rlimit(p, RLIMIT_NPROC)) {
1504 if ((current->flags & PF_NPROC_EXCEEDED) &&
1505 atomic_read(¤t_user()->processes) > rlimit(RLIMIT_NPROC)) {
1506 retval = -EAGAIN;
1507 goto out_ret;
atomic_t processes; /* How many processes does this user have? */
1655 bad_fork_cleanup_count:
1656 atomic_dec(&p->cred->user->processes);
313 /*
314 * Copy credentials for the new process created by fork()
315 *
316 * We share if we can, but under some circumstances we have to generate a new
317 * set.
318 *
319 * The new process gets the current process's subjective credentials as its
320 * objective and subjective credentials
321 */
322 int copy_creds(struct task_struct *p, unsigned long clone_flags)
339 atomic_inc(&p->cred->user->processes);
372 atomic_inc(&new->user->processes);
RLIMIT_NPROC
The maximum number of processes (or, more precisely on Linux,
threads) that can be created for the real user ID of the
calling process. Upon encountering this limit, fork(2) fails
with the error EAGAIN.
|
start an application with linux network namespaces using a bash function
Tag : bash , By : mobi phil
Date : March 29 2020, 07:55 AM
wish helps you The key issue here is that sudo -u myuser -i starts a new shell session. Further commands, like cd /home, aren't run until in the shell session; instead, they're run after the shell session. Thus, you need to move startServer into the sudo command, instead of running it after the sudo command. #!/bin/bash
sudo ip netns exec controlnet sudo -u myuser bash -s <<'EOF'
startServer() {
local endTime startTime retval
while :; do
startTime=$SECONDS
./hlds_run -game cstrike -pidfile ogp_game_startup.pid +map de_dust +ip 1.2.3.4 +port 27015 +maxplayers 14; retval=$?
endTime=$SECONDS
if (( (endTime - startTime) > 15 )); then
echo "Server crashed with exit code $retval. Respawning..." >&2
else
echo "Server exited with status $retval after less than 15 seconds" >&2
echo " not attempting to respawn" >&2
return "$retval"
fi
sleep 3
done
}
cd /home/ || exit
startServer
EOF
|
List all Processes & Threads under processes from Linux core dump using gdb
Tag : linux , By : Piotr Balas
Date : March 29 2020, 07:55 AM
|