0

I need to implement a system call inside minix that waits until some condition is true before it returns. However, I am finding that simply trying something like

while (var != desired_value)
{
    // wait
}

does not work because while it does block the process, it also blocks every other process running in minix. I cannot even switch to another virtual terminal and log in. I thought minix processes were supposed to run independently of one another, but it looks like when any process blocks on a system call then all of the other processes are simultaneously suspended. Can this be correct? Thank you

2 Answers2

0

Of course Minix has a non-blocking wait mechanism:

#include <sys/types.h>
#include <sys/wait.h>

pid_t wait(int *status)
pid_t waitpid(pid_t pid, int *status, int options)

wait causes its caller to delay until a signal is received or one of its child processes terminates.

waitpid provides an alternate interface for programs that must not block when collecting the status of child processes, or that wish to wait for one particular child.

Minix provides POSIX, so you can use fork, exec, etc to manipulate processes.

ymn
  • 2,175
  • 2
  • 21
  • 39
0

Minix system calls are atomic procedures, this means they can't be interrupted, even by scheduler. Waiting for condition that can't happen will lead to deadlock.

Rafalini
  • 23
  • 1
  • 5