multithreading - What happens during an ioctl/syscall done in thread while another thread is forking? -


i've read a lot can happen when mixing threads , forking , should better avoided. i'm finding myself in situation don't have choice , receive kernel-crash of kernel-module.

my reduced test-case has 2 threads. 1 of doing ioctls open device-node in loop. other 1 doing 1 fork, waits child exit, immediately. if use pthread_atfork synchronized thread fork-call working.

where can @ find out more on happens during fork on open file-descriptors executing ioctl? kind of corruption can happen?

edit: andreas made me change test case. instead of having child exiting immediatly i'm not waiting 10 seconds before exiting. i'm collecting pid in parent-process later waitpid. i'm forking 100 times. if makes crash after 2 or 3 forks.

there should no problem caused threading in regard. there should no kernel crashes.

from description sounds writing own kernel module handles file descriptor in question. note forked process gets copies of open file descriptors. when exits closes those.

it doesn't matter apparently nothing exit immediately, close (and flush in file_operations) happens always. should looking in kernel code.


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -