Skip to content

Stage 21

Process Synchronisation

eXpOS provides the Wait and Signal system calls for process synchronisation. When a process executes the wait system call specifying the process id of another process as argument, the OS puts the calling process to sleep. This means, the OS will schedule the process out and won’t execute when either the specified process terminates by the Exit system call or Signal system call.

Access Control

eXpOS provides (binary) semaphores to allow application programs to handle the critical section problem. A process can acquire a semaphore using the Semget system call, which returns a unique semid for the Semaphore. The semaphore is initially not set. A process may open several files and semaphore and execute the Fork system call multiple times to create several process that shares all the opened file handles, the heap memory region and all the semaphores acquired by the parent.

Any of these processes sharing a semaphore identifier can set the semaphore using SemLock system call. SemUnlock will unlock the semaphore.

Signals are memoryless, it never records the occurance of the signal for the future.

When a process exits, all the child processes become orphan processes.

Modifications to Exit Process

If the mode flag is not EXEC, loop through the processes and change the (WAIT_PROCESS) to READY. The child processes will become orphan processes as well.