Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
5 ratings:
 4.40 out of 5   

Why Does Fork Fail in Linux?



Primary Software: Driver Software>>NI-488.2
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: Driver Software>>NI-DAQmx Base

Problem:
I am using a fork() call in my code that's running in Linux, and the fork() fails.  What is going on?

Solution:
This may happen in Linux kernels 2.6.13 and newer, due to the way the NI driver handles page-locked user mode memory.  In kernels 2.6.13 and later, the driver calls mlock() to lock user mode memory.  If there is not enough lockable memory available, mlock() can fail, causing fork() to fail.
 
Try running the process as root user, and see if fork() succeeds.  If fork() succeeds, it's possible that fork() failed because mlock() failed.
As a non-root user, run "ulimit -a" to determine the amount of maximum locked memory.  This value can be increased by editing /etc/security/limits.conf.  See your Linux distribution documents for more information about how to do this.

Related Links:

Attachments:





Report Date: 06/20/2007
Last Updated: 09/29/2017
Document ID: 4AJE5KQA

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit