Hi all,

I noticed that when spawning a new task/process from a file in
nsh_fileapps, the scheduler is locked prior to calling posix_spawn(), which
does the file loading into memory etc.

I noticed one issue with this; when the file size is large (in the order of
MB) the scheduler is locked for very long periods at a time, in the order
of hundreds of milliseconds.

So my question is, is the scheduler lock strictly necessary in this case ?
The only reason I could surmise from the comment below is that waitpid is
not performed on a stale pid (or even a possibly re-taken pid ?):

  /* Lock the scheduler in an attempt to prevent the application from
   * running until waitpid() has been called.
   */

  sched_lock();

A follow-up question obviously is, what happens if the scheduler lock is
removed ? Will something bad happen and if so, is there a way to mitigate
this (other than the sched_lock())?

My reason for removing the scheduler lock is obviously that I lose all
real-time assurances of the OS when I'm starting a process, e.g. I start
losing sensor data during the process load time.

Any and all help on this is greatly appreciated.

BR,
Ville Juven / pussuw on github

Reply via email to